From d47dc156883f301eb09a5310386c9333317a5174 Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Tue, 27 May 2025 15:04:20 +0200 Subject: [PATCH] Fix Menu + misc --- ...nslation_input_and_resource_container.dart | 44 ++++++------- .../Section/SubSection/Menu/menu_config.dart | 2 +- .../SubSection/Puzzle/puzzle_config.dart | 4 +- lib/Screens/Resources/resource_body_grid.dart | 2 +- lib/api/openApiTest.dart | 2 +- lib/api/swagger.yaml | 6 +- manager_api_new/doc/MenuDTO.md | 2 +- manager_api_new/lib/model/menu_dto.dart | 62 +++++++++---------- 8 files changed, 61 insertions(+), 63 deletions(-) diff --git a/lib/Components/translation_input_and_resource_container.dart b/lib/Components/translation_input_and_resource_container.dart index aa2ab16..c3a3498 100644 --- a/lib/Components/translation_input_and_resource_container.dart +++ b/lib/Components/translation_input_and_resource_container.dart @@ -9,6 +9,28 @@ import 'package:quill_html_editor/quill_html_editor.dart'; import 'flag_decoration.dart'; +class TranslationInputAndResourceContainer extends StatefulWidget { + TranslationInputAndResourceContainer({ + Key? key, + required this.isTitle, + required this.values, + required this.newValues, + required this.onGetResult, + required this.maxLines, + required this.resourceTypes, + }) : super(key: key); + + bool isTitle; + List values; + List newValues; + Function onGetResult; + int maxLines; + List? resourceTypes; + + @override + State createState() => _TranslationInputAndResourceContainerState(); +} + class _TranslationInputAndResourceContainerState extends State with TickerProviderStateMixin { TabController? _tabController; QuillEditorController controllerQuill = QuillEditorController(); @@ -228,25 +250,3 @@ class _TranslationInputAndResourceContainerState extends State values; - List newValues; - Function onGetResult; - int maxLines; - List? resourceTypes; - - @override - State createState() => _TranslationInputAndResourceContainerState(); -} diff --git a/lib/Screens/Configurations/Section/SubSection/Menu/menu_config.dart b/lib/Screens/Configurations/Section/SubSection/Menu/menu_config.dart index af85a0e..9fb803d 100644 --- a/lib/Screens/Configurations/Section/SubSection/Menu/menu_config.dart +++ b/lib/Screens/Configurations/Section/SubSection/Menu/menu_config.dart @@ -119,7 +119,7 @@ class _MenuConfigState extends State { List sectionList = rawSubsections.whereType().toList(); menuDTO.sections = sectionList; - menuDTO.sections!.sort((a, b) => a.order!.compareTo(b.order!)); + //menuDTO.sections!.sort((a, b) => a.order!.compareTo(b.order!)); return ReorderableListView( onReorder: _onReorder, diff --git a/lib/Screens/Configurations/Section/SubSection/Puzzle/puzzle_config.dart b/lib/Screens/Configurations/Section/SubSection/Puzzle/puzzle_config.dart index 504dc2d..2c6e3e5 100644 --- a/lib/Screens/Configurations/Section/SubSection/Puzzle/puzzle_config.dart +++ b/lib/Screens/Configurations/Section/SubSection/Puzzle/puzzle_config.dart @@ -75,7 +75,7 @@ class _PuzzleConfigState extends State { fontSize: 20, color: kPrimaryColor, initialValue: puzzleDTO.messageDebut != null ? puzzleDTO.messageDebut! : [], - resourceTypes: [ResourceType.Image, ResourceType.ImageUrl], + resourceTypes: [ResourceType.Image, ResourceType.ImageUrl, ResourceType.VideoUrl, ResourceType.Video, ResourceType.Audio], onGetResult: (value) { if (puzzleDTO.messageDebut != value) { setState(() { @@ -96,7 +96,7 @@ class _PuzzleConfigState extends State { fontSize: 20, color: kPrimaryColor, initialValue: puzzleDTO.messageFin != null ? puzzleDTO.messageFin! : [], - resourceTypes: [ResourceType.Image, ResourceType.ImageUrl], + resourceTypes: [ResourceType.Image, ResourceType.ImageUrl, ResourceType.VideoUrl, ResourceType.Video, ResourceType.Audio], onGetResult: (value) { if (puzzleDTO.messageFin != value) { setState(() { diff --git a/lib/Screens/Resources/resource_body_grid.dart b/lib/Screens/Resources/resource_body_grid.dart index c32349b..832ab31 100644 --- a/lib/Screens/Resources/resource_body_grid.dart +++ b/lib/Screens/Resources/resource_body_grid.dart @@ -198,7 +198,7 @@ boxDecoration(dynamic resourceDetailDTO, appContext) { borderRadius: BorderRadius.circular(30.0), image: resourceDetailDTO.id != null && (resourceDetailDTO.type == ResourceType.Image || resourceDetailDTO.type == ResourceType.ImageUrl) && resourceDetailDTO.url != null ? new DecorationImage( fit: BoxFit.cover, - colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.3), BlendMode.dstATop), + colorFilter: new ColorFilter.mode(Colors.black.withValues(alpha: 0.3), BlendMode.dstATop), image: new NetworkImage( resourceDetailDTO.url!, ), diff --git a/lib/api/openApiTest.dart b/lib/api/openApiTest.dart index 5b208c6..67bf0c5 100644 --- a/lib/api/openApiTest.dart +++ b/lib/api/openApiTest.dart @@ -1,4 +1,4 @@ -// Openapi Generator last run: : 2025-05-15T14:44:57.478150 +// Openapi Generator last run: : 2025-05-27T14:44:29.936214 import 'package:openapi_generator_annotations/openapi_generator_annotations.dart'; @Openapi( diff --git a/lib/api/swagger.yaml b/lib/api/swagger.yaml index f5170cd..a9dd489 100644 --- a/lib/api/swagger.yaml +++ b/lib/api/swagger.yaml @@ -4,7 +4,7 @@ "info": { "title": "Manager Service", "description": "API Manager Service", - "version": "Version Alpha 3" + "version": "Version Alpha" }, "servers": [ { @@ -4300,9 +4300,7 @@ "sections": { "type": "array", "nullable": true, - "items": { - "$ref": "#/components/schemas/SectionDTO" - } + "items": {} } } } diff --git a/manager_api_new/doc/MenuDTO.md b/manager_api_new/doc/MenuDTO.md index df119df..991ec03 100644 --- a/manager_api_new/doc/MenuDTO.md +++ b/manager_api_new/doc/MenuDTO.md @@ -26,7 +26,7 @@ Name | Type | Description | Notes **meterZoneGPS** | **int** | | [optional] **isBeacon** | **bool** | | [optional] **beaconId** | **int** | | [optional] -**sections** | [**List**](SectionDTO.md) | | [optional] [default to const []] +**sections** | [**List**](Object.md) | | [optional] [default to const []] [[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/lib/model/menu_dto.dart b/manager_api_new/lib/model/menu_dto.dart index b94e973..298fba9 100644 --- a/manager_api_new/lib/model/menu_dto.dart +++ b/manager_api_new/lib/model/menu_dto.dart @@ -94,36 +94,36 @@ class MenuDTO { int? beaconId; - List? sections; + dynamic? sections; @override bool operator ==(Object other) => identical(this, other) || - other is MenuDTO && - other.id == id && - other.label == label && - _deepEquality.equals(other.title, title) && - _deepEquality.equals(other.description, description) && - other.imageId == imageId && - other.imageSource == imageSource && - other.configurationId == configurationId && - other.isSubSection == isSubSection && - other.parentId == parentId && - other.type == type && - other.dateCreation == dateCreation && - other.order == order && - other.instanceId == instanceId && - other.latitude == latitude && - other.longitude == longitude && - other.meterZoneGPS == meterZoneGPS && - other.isBeacon == isBeacon && - other.beaconId == beaconId && - _deepEquality.equals(other.sections, sections); + other is MenuDTO && + other.id == id && + other.label == label && + _deepEquality.equals(other.title, title) && + _deepEquality.equals(other.description, description) && + other.imageId == imageId && + other.imageSource == imageSource && + other.configurationId == configurationId && + other.isSubSection == isSubSection && + other.parentId == parentId && + other.type == type && + other.dateCreation == dateCreation && + other.order == order && + other.instanceId == instanceId && + other.latitude == latitude && + other.longitude == longitude && + other.meterZoneGPS == meterZoneGPS && + other.isBeacon == isBeacon && + other.beaconId == beaconId && + _deepEquality.equals(other.sections, sections); @override int get hashCode => // ignore: unnecessary_parenthesis - (id == null ? 0 : id!.hashCode) + + (id == null ? 0 : id!.hashCode) + (label == null ? 0 : label!.hashCode) + (title == null ? 0 : title!.hashCode) + (description == null ? 0 : description!.hashCode) + @@ -260,9 +260,9 @@ class MenuDTO { assert(() { requiredKeys.forEach((key) { assert(json.containsKey(key), - 'Required key "MenuDTO[$key]" is missing from JSON.'); + 'Required key "MenuDTO[$key]" is missing from JSON.'); assert(json[key] != null, - 'Required key "MenuDTO[$key]" has a null value in JSON.'); + 'Required key "MenuDTO[$key]" has a null value in JSON.'); }); return true; }()); @@ -286,16 +286,16 @@ class MenuDTO { meterZoneGPS: mapValueOfType(json, r'meterZoneGPS'), isBeacon: mapValueOfType(json, r'isBeacon'), beaconId: mapValueOfType(json, r'beaconId'), - sections: SectionDTO.listFromJson(json[r'sections']), + sections: json[r'sections'], ); } return null; } static List listFromJson( - dynamic json, { - bool growable = false, - }) { + dynamic json, { + bool growable = false, + }) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -324,9 +324,9 @@ class MenuDTO { // maps a json object with a list of MenuDTO-objects as value to a dart map static Map> mapListFromJson( - dynamic json, { - bool growable = false, - }) { + dynamic json, { + bool growable = false, + }) { final map = >{}; if (json is Map && json.isNotEmpty) { // ignore: parameter_assignments