diff --git a/lib/Components/image_input_container.dart b/lib/Components/image_input_container.dart index c220a5c..0daad0a 100644 --- a/lib/Components/image_input_container.dart +++ b/lib/Components/image_input_container.dart @@ -61,8 +61,8 @@ class _ImageInputContainerState extends State { child: Padding( padding: EdgeInsets.only(left: widget.isSmall ? 5 : 10, top: 10, bottom: 10), child: Container( - width: size.width *0.08, - height: size.width *0.08, + width: 90, + height: 90, child: InkWell( onTap: () async { ResourceDTO? result = await showSelectResourceModal( diff --git a/lib/Screens/Configurations/configuration_detail_screen.dart b/lib/Screens/Configurations/configuration_detail_screen.dart index 14d7413..515dba8 100644 --- a/lib/Screens/Configurations/configuration_detail_screen.dart +++ b/lib/Screens/Configurations/configuration_detail_screen.dart @@ -184,18 +184,21 @@ class _ConfigurationDetailScreenState extends State { //print(configurationDTO.languages); }, ), - /*MultiSelectContainer( - label: "Langues :", - initialValue: configurationDTO.languages != null ? configurationDTO.languages: [], - values: languages, - isMultiple: true, - isAtLeastOne: true, - onChanged: (value) { - var tempOutput = new List.from(value); - configurationDTO.languages = tempOutput; - //print(configurationDTO.languages); + ImageInputContainer( + label: "Image loader :", + fontSize: 20, + initialValue: configurationDTO.loaderImageId, + color: kPrimaryColor, + onChanged: (ResourceDTO resource) { + if(resource.id == null) { + configurationDTO.loaderImageId = null; + configurationDTO.loaderImageUrl = null; + } else { + configurationDTO.loaderImageId = resource.id; + configurationDTO.loaderImageUrl = resource.url; + } }, - ),*/ + ), ], ), Column( @@ -282,7 +285,7 @@ class _ConfigurationDetailScreenState extends State { ), ), ImageInputContainer( - label: "Image :", + label: "Image fond d'écran :", fontSize: 20, initialValue: configurationDTO.imageId, color: kPrimaryColor, @@ -296,6 +299,14 @@ class _ConfigurationDetailScreenState extends State { } }, ), + StringInputContainer( + label: "Ville météo :", + fontSize: 20, + initialValue: configurationDTO.weatherCity, + onChanged: (value) { + configurationDTO.weatherCity = value; + }, + ), ]) ], ), diff --git a/lib/Screens/Configurations/new_configuration_popup.dart b/lib/Screens/Configurations/new_configuration_popup.dart index 70fcc4a..3fa14da 100644 --- a/lib/Screens/Configurations/new_configuration_popup.dart +++ b/lib/Screens/Configurations/new_configuration_popup.dart @@ -22,21 +22,21 @@ void showNewConfiguration(AppContext appContext, ValueChanged isImport, Bu ), content: SingleChildScrollView( child: SizedBox( - width: size.width*0.3, + width: size.width*0.35, height: size.height*0.3, child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, children: [ - Text("Nouvelle visite", style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400)), - Column( - children: [ - StringInputContainer( - label: "Nom :", - initialValue: configurationDTO.label, - onChanged: (value) { - configurationDTO.label = value; - }, - ), - ], + Center(child: Text("Nouvelle configuration", style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400))), + Center( + child: StringInputContainer( + label: "Nom :", + initialValue: configurationDTO.label, + onChanged: (value) { + configurationDTO.label = value; + }, + ), ), Text("ou"), Column( @@ -138,6 +138,10 @@ String filePicker() { void create(ConfigurationDTO configurationDTO, AppContext appContext, context) async { if (configurationDTO.label != null) { + configurationDTO.dateCreation = DateTime.now(); + configurationDTO.isMobile = false; + configurationDTO.isTablet = false; + configurationDTO.isOffline = false; configurationDTO.instanceId = (appContext.getContext() as ManagerAppContext).instanceId; await (appContext.getContext() as ManagerAppContext).clientAPI!.configurationApi!.configurationCreate(configurationDTO); ManagerAppContext managerAppContext = appContext.getContext(); diff --git a/lib/Screens/Resources/get_element_for_resource.dart b/lib/Screens/Resources/get_element_for_resource.dart index d0f2746..6f6ac5c 100644 --- a/lib/Screens/Resources/get_element_for_resource.dart +++ b/lib/Screens/Resources/get_element_for_resource.dart @@ -83,13 +83,10 @@ getElementForResource(dynamic resourceDTO, AppContext appContext) { } );*/ //return Text("Fichier audio - aucune visualisation possible"); - break; case ResourceType.Video: return Text("Vidéo locale - aucune visualisation possible"); - break; case ResourceType.VideoUrl: return Text(resourceDTO.url); - break; } } diff --git a/lib/Screens/Resources/resource_body_grid.dart b/lib/Screens/Resources/resource_body_grid.dart index 5f3a002..b46d18a 100644 --- a/lib/Screens/Resources/resource_body_grid.dart +++ b/lib/Screens/Resources/resource_body_grid.dart @@ -122,7 +122,7 @@ class _ResourceBodyGridState extends State { Expanded( child: GridView.builder( shrinkWrap: true, - gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 6), + gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 9), itemCount: data.length, itemBuilder: (BuildContext context, int index) { return diff --git a/lib/api/swagger.yaml b/lib/api/swagger.yaml index e884bc9..86fbead 100644 --- a/lib/api/swagger.yaml +++ b/lib/api/swagger.yaml @@ -1805,9 +1805,15 @@ components: nullable: true items: type: string - pinCode: - type: integer - format: int32 + loaderImageId: + type: string + nullable: true + loaderImageUrl: + type: string + nullable: true + weatherCity: + type: string + nullable: true TranslationDTO: type: object additionalProperties: false diff --git a/manager_api_new/doc/ConfigurationDTO.md b/manager_api_new/doc/ConfigurationDTO.md index 3b901be..ef72403 100644 --- a/manager_api_new/doc/ConfigurationDTO.md +++ b/manager_api_new/doc/ConfigurationDTO.md @@ -22,7 +22,9 @@ Name | Type | Description | Notes **isOffline** | **bool** | | [optional] **instanceId** | **String** | | [optional] **sectionIds** | **List** | | [optional] [default to const []] -**pinCode** | **int** | | [optional] +**loaderImageId** | **String** | | [optional] +**loaderImageUrl** | **String** | | [optional] +**weatherCity** | **String** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/manager_api_new/doc/ExportConfigurationDTO.md b/manager_api_new/doc/ExportConfigurationDTO.md index 1711fbb..41beb8d 100644 --- a/manager_api_new/doc/ExportConfigurationDTO.md +++ b/manager_api_new/doc/ExportConfigurationDTO.md @@ -22,7 +22,9 @@ Name | Type | Description | Notes **isOffline** | **bool** | | [optional] **instanceId** | **String** | | [optional] **sectionIds** | **List** | | [optional] [default to const []] -**pinCode** | **int** | | [optional] +**loaderImageId** | **String** | | [optional] +**loaderImageUrl** | **String** | | [optional] +**weatherCity** | **String** | | [optional] **sections** | [**List**](SectionDTO.md) | | [optional] [default to const []] **resources** | [**List**](ResourceDTO.md) | | [optional] [default to const []] diff --git a/manager_api_new/lib/model/configuration_dto.dart b/manager_api_new/lib/model/configuration_dto.dart index 7f523e0..a7196bd 100644 --- a/manager_api_new/lib/model/configuration_dto.dart +++ b/manager_api_new/lib/model/configuration_dto.dart @@ -27,7 +27,9 @@ class ConfigurationDTO { this.isOffline, this.instanceId, this.sectionIds = const [], - this.pinCode, + this.loaderImageId, + this.loaderImageUrl, + this.weatherCity, }); String? id; @@ -82,13 +84,11 @@ class ConfigurationDTO { List? sectionIds; - /// - /// Please note: This property should have been non-nullable! Since the specification file - /// does not include a default value (using the "default:" property), however, the generated - /// source code must fall back to having a nullable type. - /// Consider adding a "default:" property in the specification file to hide this note. - /// - int? pinCode; + String? loaderImageId; + + String? loaderImageUrl; + + String? weatherCity; @override bool operator ==(Object other) => identical(this, other) || other is ConfigurationDTO && @@ -106,7 +106,9 @@ class ConfigurationDTO { other.isOffline == isOffline && other.instanceId == instanceId && other.sectionIds == sectionIds && - other.pinCode == pinCode; + other.loaderImageId == loaderImageId && + other.loaderImageUrl == loaderImageUrl && + other.weatherCity == weatherCity; @override int get hashCode => @@ -125,10 +127,12 @@ class ConfigurationDTO { (isOffline == null ? 0 : isOffline!.hashCode) + (instanceId == null ? 0 : instanceId!.hashCode) + (sectionIds == null ? 0 : sectionIds!.hashCode) + - (pinCode == null ? 0 : pinCode!.hashCode); + (loaderImageId == null ? 0 : loaderImageId!.hashCode) + + (loaderImageUrl == null ? 0 : loaderImageUrl!.hashCode) + + (weatherCity == null ? 0 : weatherCity!.hashCode); @override - 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, instanceId=$instanceId, sectionIds=$sectionIds, pinCode=$pinCode]'; + 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, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity]'; Map toJson() { final json = {}; @@ -202,10 +206,20 @@ class ConfigurationDTO { } else { json[r'sectionIds'] = null; } - if (this.pinCode != null) { - json[r'pinCode'] = this.pinCode; + if (this.loaderImageId != null) { + json[r'loaderImageId'] = this.loaderImageId; } else { - json[r'pinCode'] = null; + json[r'loaderImageId'] = null; + } + if (this.loaderImageUrl != null) { + json[r'loaderImageUrl'] = this.loaderImageUrl; + } else { + json[r'loaderImageUrl'] = null; + } + if (this.weatherCity != null) { + json[r'weatherCity'] = this.weatherCity; + } else { + json[r'weatherCity'] = null; } return json; } @@ -247,7 +261,9 @@ class ConfigurationDTO { sectionIds: json[r'sectionIds'] is List ? (json[r'sectionIds'] as List).cast() : const [], - pinCode: mapValueOfType(json, r'pinCode'), + loaderImageId: mapValueOfType(json, r'loaderImageId'), + loaderImageUrl: mapValueOfType(json, r'loaderImageUrl'), + weatherCity: mapValueOfType(json, r'weatherCity'), ); } return null; diff --git a/manager_api_new/lib/model/export_configuration_dto.dart b/manager_api_new/lib/model/export_configuration_dto.dart index 19ca31a..dd16d90 100644 --- a/manager_api_new/lib/model/export_configuration_dto.dart +++ b/manager_api_new/lib/model/export_configuration_dto.dart @@ -27,7 +27,9 @@ class ExportConfigurationDTO { this.isOffline, this.instanceId, this.sectionIds = const [], - this.pinCode, + this.loaderImageId, + this.loaderImageUrl, + this.weatherCity, this.sections = const [], this.resources = const [], }); @@ -84,13 +86,11 @@ class ExportConfigurationDTO { List? sectionIds; - /// - /// Please note: This property should have been non-nullable! Since the specification file - /// does not include a default value (using the "default:" property), however, the generated - /// source code must fall back to having a nullable type. - /// Consider adding a "default:" property in the specification file to hide this note. - /// - int? pinCode; + String? loaderImageId; + + String? loaderImageUrl; + + String? weatherCity; List? sections; @@ -112,7 +112,9 @@ class ExportConfigurationDTO { other.isOffline == isOffline && other.instanceId == instanceId && other.sectionIds == sectionIds && - other.pinCode == pinCode && + other.loaderImageId == loaderImageId && + other.loaderImageUrl == loaderImageUrl && + other.weatherCity == weatherCity && other.sections == sections && other.resources == resources; @@ -133,12 +135,14 @@ class ExportConfigurationDTO { (isOffline == null ? 0 : isOffline!.hashCode) + (instanceId == null ? 0 : instanceId!.hashCode) + (sectionIds == null ? 0 : sectionIds!.hashCode) + - (pinCode == null ? 0 : pinCode!.hashCode) + + (loaderImageId == null ? 0 : loaderImageId!.hashCode) + + (loaderImageUrl == null ? 0 : loaderImageUrl!.hashCode) + + (weatherCity == null ? 0 : weatherCity!.hashCode) + (sections == null ? 0 : sections!.hashCode) + (resources == null ? 0 : resources!.hashCode); @override - 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, instanceId=$instanceId, sectionIds=$sectionIds, pinCode=$pinCode, 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, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity, sections=$sections, resources=$resources]'; Map toJson() { final json = {}; @@ -212,10 +216,20 @@ class ExportConfigurationDTO { } else { json[r'sectionIds'] = null; } - if (this.pinCode != null) { - json[r'pinCode'] = this.pinCode; + if (this.loaderImageId != null) { + json[r'loaderImageId'] = this.loaderImageId; } else { - json[r'pinCode'] = null; + json[r'loaderImageId'] = null; + } + if (this.loaderImageUrl != null) { + json[r'loaderImageUrl'] = this.loaderImageUrl; + } else { + json[r'loaderImageUrl'] = null; + } + if (this.weatherCity != null) { + json[r'weatherCity'] = this.weatherCity; + } else { + json[r'weatherCity'] = null; } if (this.sections != null) { json[r'sections'] = this.sections; @@ -267,7 +281,9 @@ class ExportConfigurationDTO { sectionIds: json[r'sectionIds'] is List ? (json[r'sectionIds'] as List).cast() : const [], - pinCode: mapValueOfType(json, r'pinCode'), + loaderImageId: mapValueOfType(json, r'loaderImageId'), + loaderImageUrl: mapValueOfType(json, r'loaderImageUrl'), + weatherCity: mapValueOfType(json, r'weatherCity'), sections: SectionDTO.listFromJson(json[r'sections']), resources: ResourceDTO.listFromJson(json[r'resources']), ); diff --git a/manager_api_new/lib/model/image_dto.dart b/manager_api_new/lib/model/image_dto.dart index b567355..a275b85 100644 --- a/manager_api_new/lib/model/image_dto.dart +++ b/manager_api_new/lib/model/image_dto.dart @@ -18,7 +18,6 @@ class ImageDTO { this.resourceId, this.source_, this.order, - this.type, }); List? title; @@ -37,35 +36,25 @@ class ImageDTO { /// int? order; - /// - /// Please note: This property should have been non-nullable! Since the specification file - /// does not include a default value (using the "default:" property), however, the generated - /// source code must fall back to having a nullable type. - /// Consider adding a "default:" property in the specification file to hide this note. - /// - ResourceType? type; - @override bool operator ==(Object other) => identical(this, other) || other is ImageDTO && - other.title == title && - other.description == description && - other.resourceId == resourceId && - other.source_ == source_ && - other.order == order && - other.type == type; + other.title == title && + other.description == description && + other.resourceId == resourceId && + other.source_ == source_ && + other.order == order; @override int get hashCode => - // ignore: unnecessary_parenthesis - (title == null ? 0 : title!.hashCode) + - (description == null ? 0 : description!.hashCode) + - (resourceId == null ? 0 : resourceId!.hashCode) + - (source_ == null ? 0 : source_!.hashCode) + - (order == null ? 0 : order!.hashCode) + - (type == null ? 0 : type!.hashCode); + // ignore: unnecessary_parenthesis + (title == null ? 0 : title!.hashCode) + + (description == null ? 0 : description!.hashCode) + + (resourceId == null ? 0 : resourceId!.hashCode) + + (source_ == null ? 0 : source_!.hashCode) + + (order == null ? 0 : order!.hashCode); @override - String toString() => 'ImageDTO[title=$title, description=$description, resourceId=$resourceId, source_=$source_, order=$order, type=$type]'; + String toString() => 'ImageDTO[title=$title, description=$description, resourceId=$resourceId, source_=$source_, order=$order]'; Map toJson() { final json = {}; @@ -94,11 +83,6 @@ class ImageDTO { } else { json[r'order'] = null; } - if (this.type != null) { - json[r'type'] = this.type; - } else { - json[r'type'] = null; - } return json; } @@ -126,7 +110,6 @@ class ImageDTO { resourceId: mapValueOfType(json, r'resourceId'), source_: mapValueOfType(json, r'source'), order: mapValueOfType(json, r'order'), - type: ResourceType.fromJson(json[r'type']), ); } return null; diff --git a/manager_api_new/lib/model/image_geo_point.dart b/manager_api_new/lib/model/image_geo_point.dart index 4ecb68c..4ed4612 100644 --- a/manager_api_new/lib/model/image_geo_point.dart +++ b/manager_api_new/lib/model/image_geo_point.dart @@ -23,14 +23,14 @@ class ImageGeoPoint { @override bool operator ==(Object other) => identical(this, other) || other is ImageGeoPoint && - other.imageResourceId == imageResourceId && - other.imageSource == imageSource; + other.imageResourceId == imageResourceId && + other.imageSource == imageSource; @override int get hashCode => - // ignore: unnecessary_parenthesis - (imageResourceId == null ? 0 : imageResourceId!.hashCode) + - (imageSource == null ? 0 : imageSource!.hashCode); + // ignore: unnecessary_parenthesis + (imageResourceId == null ? 0 : imageResourceId!.hashCode) + + (imageSource == null ? 0 : imageSource!.hashCode); @override String toString() => 'ImageGeoPoint[imageResourceId=$imageResourceId, imageSource=$imageSource]'; diff --git a/manager_api_new/lib/model/map_type_app.dart b/manager_api_new/lib/model/map_type_app.dart index eaa9273..735acb9 100644 --- a/manager_api_new/lib/model/map_type_app.dart +++ b/manager_api_new/lib/model/map_type_app.dart @@ -40,7 +40,7 @@ class MapTypeApp { static MapTypeApp? fromJson(dynamic value) => MapTypeAppTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -72,14 +72,27 @@ class MapTypeAppTypeTransformer { /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, /// and users are still using an old app with the old code. MapTypeApp? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data.toString()) { + case r'None': return MapTypeApp.none; + case r'Normal': return MapTypeApp.normal; + case r'Satellite': return MapTypeApp.satellite; + case r'Terrain': return MapTypeApp.terrain; + case r'Hybrid': return MapTypeApp.hybrid; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } if (data != null) { if(data.runtimeType == String) { switch (data.toString()) { - case "none": return MapTypeApp.none; - case "normal": return MapTypeApp.normal; - case "satellite": return MapTypeApp.satellite; - case "terrain": return MapTypeApp.terrain; - case "hybrid": return MapTypeApp.hybrid; + case r'None': return MapTypeApp.none; + case r'Normal': return MapTypeApp.normal; + case r'Satellite': return MapTypeApp.satellite; + case r'Terrain': return MapTypeApp.terrain; + case r'Hybrid': return MapTypeApp.hybrid; default: if (!allowNull) { throw ArgumentError('Unknown enum value to decode: $data'); @@ -100,6 +113,7 @@ class MapTypeAppTypeTransformer { } } } + } return null; } diff --git a/manager_api_new/lib/model/section_type.dart b/manager_api_new/lib/model/section_type.dart index 85d03d2..29523c6 100644 --- a/manager_api_new/lib/model/section_type.dart +++ b/manager_api_new/lib/model/section_type.dart @@ -10,7 +10,7 @@ part of openapi.api; -/// 0 = Map 1 = Slider 2 = Video 3 = Web 4 = Menu 5 = Quizz 6 = Article +/// 0 = Map 1 = Slider 2 = Video 3 = Web 4 = Menu 5 = Quizz 6 = Article 7 = PDF 8 = Puzzle 9 = Agenda class SectionType { /// Instantiate a new enum with the provided [value]. const SectionType._(this.value); @@ -30,6 +30,9 @@ class SectionType { static const Menu = SectionType._(4); static const Quizz = SectionType._(5); static const Article = SectionType._(6); + static const Pdf = SectionType._(7); + static const Puzzle = SectionType._(8); + static const Agenda = SectionType._(9); /// List of all possible values in this [enum][SectionType]. static const values = [ @@ -39,12 +42,15 @@ class SectionType { Web, Menu, Quizz, - Article + Article, + Pdf, + Puzzle, + Agenda ]; static SectionType? fromJson(dynamic value) => SectionTypeTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -86,6 +92,9 @@ class SectionTypeTypeTransformer { case r'Menu': return SectionType.Menu; case r'Quizz': return SectionType.Quizz; case r'Article': return SectionType.Article; + case r'PDF': return SectionType.Pdf; + case r'Puzzle': return SectionType.Puzzle; + case r'Agenda': return SectionType.Agenda; default: if (!allowNull) { throw ArgumentError('Unknown enum value to decode: $data'); @@ -101,6 +110,9 @@ class SectionTypeTypeTransformer { case 4: return SectionType.Menu; case 5: return SectionType.Quizz; case 6: return SectionType.Article; + case 7: return SectionType.Pdf; + case 8: return SectionType.Puzzle; + case 9: return SectionType.Agenda; default: if (!allowNull) { throw ArgumentError('Unknown enum value to decode: $data');