From 4e7fcd8d51215bc61ad90ecf0de412544aaf7873 Mon Sep 17 00:00:00 2001 From: Fransolet Thomas Date: Sat, 17 Sep 2022 22:42:20 +0200 Subject: [PATCH] Update generation from back + update layout --- lib/Components/image_input_container.dart | 1 + .../configuration_detail_screen.dart | 60 +++++++++++++++---- manager_api/doc/ConfigurationDTO.md | 3 + manager_api/doc/ExportConfigurationDTO.md | 3 + manager_api/lib/model/configuration_dto.dart | 29 ++++++++- .../lib/model/export_configuration_dto.dart | 29 ++++++++- .../{swagger.yaml.bak => swagger.yaml.bak0} | 0 .../{swagger.yaml => swagger.yaml.bak1} | 0 8 files changed, 110 insertions(+), 15 deletions(-) rename manager_api/{swagger.yaml.bak => swagger.yaml.bak0} (100%) rename manager_api/{swagger.yaml => swagger.yaml.bak1} (100%) diff --git a/lib/Components/image_input_container.dart b/lib/Components/image_input_container.dart index bc2f2d0..bfb62e0 100644 --- a/lib/Components/image_input_container.dart +++ b/lib/Components/image_input_container.dart @@ -51,6 +51,7 @@ class _ImageInputContainerState extends State { padding: EdgeInsets.only(left: widget.isSmall ? 15 : 70, top: 10, bottom: 10), child: Container( width: size.width *0.08, + height: size.height *0.08, child: InkWell( onTap: () async { var result = await showSelectResourceModal( diff --git a/lib/Screens/Configurations/configuration_detail_screen.dart b/lib/Screens/Configurations/configuration_detail_screen.dart index e3e941a..876cdd5 100644 --- a/lib/Screens/Configurations/configuration_detail_screen.dart +++ b/lib/Screens/Configurations/configuration_detail_screen.dart @@ -7,9 +7,11 @@ import 'package:flutter/material.dart'; import 'package:manager_app/Components/check_input_container.dart'; import 'package:manager_app/Components/color_picker_input_container.dart'; import 'package:manager_app/Components/confirmation_dialog.dart'; +import 'package:manager_app/Components/image_input_container.dart'; import 'package:manager_app/Components/loading_common.dart'; import 'package:manager_app/Components/message_notification.dart'; import 'package:manager_app/Components/multi_select_dropdown_container.dart'; +import 'package:manager_app/Components/multi_string_input_container.dart'; import 'package:manager_app/Components/rounded_button.dart'; import 'package:manager_app/Components/string_input_container.dart'; import 'package:manager_app/Helpers/FileHelper.dart'; @@ -191,14 +193,6 @@ class _ConfigurationDetailScreenState extends State { //print(configurationDTO.languages); }, ),*/ - CheckInputContainer( - icon: Icons.signal_wifi_off, - label: "Hors ligne :", - isChecked: configurationDTO.isOffline, - onChanged: (value) { - configurationDTO.isOffline = value; - }, - ), ], ), Column( @@ -212,11 +206,12 @@ class _ConfigurationDetailScreenState extends State { configurationDTO.primaryColor = value; }, ),*/ - ColorPickerInputContainer( - label: "Couleur fond d'écran :", - color: configurationDTO.secondaryColor, + CheckInputContainer( + icon: Icons.signal_wifi_off, + label: "Hors ligne :", + isChecked: configurationDTO.isOffline, onChanged: (value) { - configurationDTO.secondaryColor = value; + configurationDTO.isOffline = value; }, ), CheckInputContainer( @@ -247,7 +242,46 @@ class _ConfigurationDetailScreenState extends State { }, ) ], - ) + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if(!configurationDTO.isMobile) + ColorPickerInputContainer( + label: "Couleur fond d'écran :", + color: configurationDTO.secondaryColor, + onChanged: (value) { + configurationDTO.secondaryColor = value; + }, + ), + if(configurationDTO.isMobile) + Padding( + padding: const EdgeInsets.only(bottom: 15), + child: MultiStringContainer( + label: "Titre affiché:", + modalLabel: "Titre", + color: kPrimaryColor, + initialValue: configurationDTO != null ? configurationDTO.title : [], + onGetResult: (value) { + if (configurationDTO.title != value) { + configurationDTO.title = value; + } + }, + maxLines: 1, + isTitle: true, + ), + ), + ImageInputContainer( + label: "Image :", + initialValue: configurationDTO != null ? configurationDTO.imageId : "", + color: kPrimaryColor, + onChanged: (ResourceDTO resource) { + configurationDTO.imageId = resource.id; + configurationDTO.imageSource = resource.type == ResourceType.imageUrl ? resource.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resource.id; + }, + ), + ]) ], ), ), diff --git a/manager_api/doc/ConfigurationDTO.md b/manager_api/doc/ConfigurationDTO.md index 43694ec..6452ac3 100644 --- a/manager_api/doc/ConfigurationDTO.md +++ b/manager_api/doc/ConfigurationDTO.md @@ -10,6 +10,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | [optional] **label** | **String** | | [optional] +**title** | [**List**](TranslationDTO.md) | | [optional] [default to const []] +**imageId** | **String** | | [optional] +**imageSource** | **String** | | [optional] **primaryColor** | **String** | | [optional] **secondaryColor** | **String** | | [optional] **languages** | **List** | | [optional] [default to const []] diff --git a/manager_api/doc/ExportConfigurationDTO.md b/manager_api/doc/ExportConfigurationDTO.md index 44a4f2d..92ece38 100644 --- a/manager_api/doc/ExportConfigurationDTO.md +++ b/manager_api/doc/ExportConfigurationDTO.md @@ -10,6 +10,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | [optional] **label** | **String** | | [optional] +**title** | [**List**](TranslationDTO.md) | | [optional] [default to const []] +**imageId** | **String** | | [optional] +**imageSource** | **String** | | [optional] **primaryColor** | **String** | | [optional] **secondaryColor** | **String** | | [optional] **languages** | **List** | | [optional] [default to const []] diff --git a/manager_api/lib/model/configuration_dto.dart b/manager_api/lib/model/configuration_dto.dart index ae287cf..31fe1ee 100644 --- a/manager_api/lib/model/configuration_dto.dart +++ b/manager_api/lib/model/configuration_dto.dart @@ -14,6 +14,9 @@ class ConfigurationDTO { ConfigurationDTO({ this.id, this.label, + this.title, + this.imageId, + this.imageSource, this.primaryColor, this.secondaryColor, this.languages, @@ -27,6 +30,12 @@ class ConfigurationDTO { String label; + List title; + + String imageId; + + String imageSource; + String primaryColor; String secondaryColor; @@ -45,6 +54,9 @@ class ConfigurationDTO { bool operator ==(Object other) => identical(this, other) || other is ConfigurationDTO && other.id == id && other.label == label && + other.title == title && + other.imageId == imageId && + other.imageSource == imageSource && other.primaryColor == primaryColor && other.secondaryColor == secondaryColor && other.languages == languages && @@ -57,6 +69,9 @@ class ConfigurationDTO { int get hashCode => (id == null ? 0 : id.hashCode) + (label == null ? 0 : label.hashCode) + + (title == null ? 0 : title.hashCode) + + (imageId == null ? 0 : imageId.hashCode) + + (imageSource == null ? 0 : imageSource.hashCode) + (primaryColor == null ? 0 : primaryColor.hashCode) + (secondaryColor == null ? 0 : secondaryColor.hashCode) + (languages == null ? 0 : languages.hashCode) + @@ -66,7 +81,7 @@ class ConfigurationDTO { (isOffline == null ? 0 : isOffline.hashCode); @override - String toString() => 'ConfigurationDTO[id=$id, label=$label, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline]'; + String toString() => 'ConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline]'; Map toJson() { final json = {}; @@ -76,6 +91,15 @@ class ConfigurationDTO { if (label != null) { json[r'label'] = label; } + if (title != null) { + json[r'title'] = title; + } + if (imageId != null) { + json[r'imageId'] = imageId; + } + if (imageSource != null) { + json[r'imageSource'] = imageSource; + } if (primaryColor != null) { json[r'primaryColor'] = primaryColor; } @@ -107,6 +131,9 @@ class ConfigurationDTO { : ConfigurationDTO( id: json[r'id'], label: json[r'label'], + title: TranslationDTO.listFromJson(json[r'title']), + imageId: json[r'imageId'], + imageSource: json[r'imageSource'], primaryColor: json[r'primaryColor'], secondaryColor: json[r'secondaryColor'], languages: json[r'languages'] == null diff --git a/manager_api/lib/model/export_configuration_dto.dart b/manager_api/lib/model/export_configuration_dto.dart index 5f62ec4..b892853 100644 --- a/manager_api/lib/model/export_configuration_dto.dart +++ b/manager_api/lib/model/export_configuration_dto.dart @@ -14,6 +14,9 @@ class ExportConfigurationDTO { ExportConfigurationDTO({ this.id, this.label, + this.title, + this.imageId, + this.imageSource, this.primaryColor, this.secondaryColor, this.languages, @@ -29,6 +32,12 @@ class ExportConfigurationDTO { String label; + List title; + + String imageId; + + String imageSource; + String primaryColor; String secondaryColor; @@ -51,6 +60,9 @@ class ExportConfigurationDTO { bool operator ==(Object other) => identical(this, other) || other is ExportConfigurationDTO && other.id == id && other.label == label && + other.title == title && + other.imageId == imageId && + other.imageSource == imageSource && other.primaryColor == primaryColor && other.secondaryColor == secondaryColor && other.languages == languages && @@ -65,6 +77,9 @@ class ExportConfigurationDTO { int get hashCode => (id == null ? 0 : id.hashCode) + (label == null ? 0 : label.hashCode) + + (title == null ? 0 : title.hashCode) + + (imageId == null ? 0 : imageId.hashCode) + + (imageSource == null ? 0 : imageSource.hashCode) + (primaryColor == null ? 0 : primaryColor.hashCode) + (secondaryColor == null ? 0 : secondaryColor.hashCode) + (languages == null ? 0 : languages.hashCode) + @@ -76,7 +91,7 @@ class ExportConfigurationDTO { (resources == null ? 0 : resources.hashCode); @override - String toString() => 'ExportConfigurationDTO[id=$id, label=$label, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, sections=$sections, resources=$resources]'; + String toString() => 'ExportConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, sections=$sections, resources=$resources]'; Map toJson() { final json = {}; @@ -86,6 +101,15 @@ class ExportConfigurationDTO { if (label != null) { json[r'label'] = label; } + if (title != null) { + json[r'title'] = title; + } + if (imageId != null) { + json[r'imageId'] = imageId; + } + if (imageSource != null) { + json[r'imageSource'] = imageSource; + } if (primaryColor != null) { json[r'primaryColor'] = primaryColor; } @@ -123,6 +147,9 @@ class ExportConfigurationDTO { : ExportConfigurationDTO( id: json[r'id'], label: json[r'label'], + title: TranslationDTO.listFromJson(json[r'title']), + imageId: json[r'imageId'], + imageSource: json[r'imageSource'], primaryColor: json[r'primaryColor'], secondaryColor: json[r'secondaryColor'], languages: json[r'languages'] == null diff --git a/manager_api/swagger.yaml.bak b/manager_api/swagger.yaml.bak0 similarity index 100% rename from manager_api/swagger.yaml.bak rename to manager_api/swagger.yaml.bak0 diff --git a/manager_api/swagger.yaml b/manager_api/swagger.yaml.bak1 similarity index 100% rename from manager_api/swagger.yaml rename to manager_api/swagger.yaml.bak1