From 700201ed005e5bba55644f3806f4286a11561b71 Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Fri, 28 May 2021 19:51:05 +0200 Subject: [PATCH] update service generation + section reorder (wip) --- lib/Models/managerContext.dart | 1 + ...rderList.dart => geopoint_image_list.dart} | 21 +-- .../Map/showNewOrUpdateGeoPoint.dart | 2 +- .../Section/section_detail_screen.dart | 1 + .../configuration_detail_screen.dart | 106 +++----------- .../Configurations/listView_card_section.dart | 122 ++++++++++++++++ .../Configurations/new_section_popup.dart | 4 +- .../Configurations/section_reorderList.dart | 132 ++++++++++++++++++ lib/Screens/Resources/new_resource_popup.dart | 3 +- manager_api/doc/ConfigurationDTO.md | 1 - manager_api/doc/ImageGeoPoint.md | 1 - manager_api/doc/SectionDTO.md | 2 + manager_api/lib/model/configuration_dto.dart | 13 +- manager_api/lib/model/image_geo_point.dart | 15 +- manager_api/lib/model/section_dto.dart | 24 +++- manager_api/swagger.yaml | 14 +- 16 files changed, 315 insertions(+), 147 deletions(-) rename lib/Screens/Configurations/Section/SubSection/Map/{image_reorderList.dart => geopoint_image_list.dart} (85%) create mode 100644 lib/Screens/Configurations/listView_card_section.dart create mode 100644 lib/Screens/Configurations/section_reorderList.dart diff --git a/lib/Models/managerContext.dart b/lib/Models/managerContext.dart index a3845fc..55c734c 100644 --- a/lib/Models/managerContext.dart +++ b/lib/Models/managerContext.dart @@ -11,6 +11,7 @@ class ManagerAppContext with ChangeNotifier{ String currentRoute; ConfigurationDTO selectedConfiguration; SectionDTO selectedSection; + bool isLoading = false; ManagerAppContext({this.email, this.token, this.currentRoute}); diff --git a/lib/Screens/Configurations/Section/SubSection/Map/image_reorderList.dart b/lib/Screens/Configurations/Section/SubSection/Map/geopoint_image_list.dart similarity index 85% rename from lib/Screens/Configurations/Section/SubSection/Map/image_reorderList.dart rename to lib/Screens/Configurations/Section/SubSection/Map/geopoint_image_list.dart index 6c3e563..d3ddadb 100644 --- a/lib/Screens/Configurations/Section/SubSection/Map/image_reorderList.dart +++ b/lib/Screens/Configurations/Section/SubSection/Map/geopoint_image_list.dart @@ -26,10 +26,7 @@ class _GeoPointImageListState extends State { @override void initState() { super.initState(); - imagesGeo = new List.from(widget.images); - - //imagesGeo = widget.images; } void _onReorder(int oldIndex, int newIndex) { @@ -41,12 +38,6 @@ class _GeoPointImageListState extends State { final ImageGeoPoint item = imagesGeo.removeAt(oldIndex); imagesGeo.insert(newIndex, item); - /*var i = 0; - menuDTO.sections.forEach((image) { - //image.order = i; // TODO - i++; - });*/ - widget.onChanged(imagesGeo); }, ); @@ -89,7 +80,7 @@ class _GeoPointImageListState extends State { top: 10, left: 10, child: Text( - "Images test", + "Images", style: TextStyle(fontSize: 15), ), ), @@ -110,16 +101,6 @@ class _GeoPointImageListState extends State { true, context ); - /*showNewOrUpdateGeoPoint( - null, - (GeoPointDTO geoPoint) { - setState(() { - mapDTO.points.add(geoPoint); - widget.onChanged(jsonEncode(mapDTO).toString()); - }); - }, - appContext, - context);*/ }, child: Container( height: MediaQuery.of(context).size.width * 0.04, diff --git a/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart b/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart index 4de33f0..c23373b 100644 --- a/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart +++ b/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart @@ -5,7 +5,7 @@ import 'package:manager_app/Components/rounded_button.dart'; import 'package:manager_app/Components/string_input_container.dart'; import 'package:manager_app/Components/text_form_input_container.dart'; import 'package:manager_app/Models/managerContext.dart'; -import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/image_reorderList.dart'; +import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/geopoint_image_list.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:managerapi/api.dart'; diff --git a/lib/Screens/Configurations/Section/section_detail_screen.dart b/lib/Screens/Configurations/Section/section_detail_screen.dart index b617fc8..b1c9807 100644 --- a/lib/Screens/Configurations/Section/section_detail_screen.dart +++ b/lib/Screens/Configurations/Section/section_detail_screen.dart @@ -142,6 +142,7 @@ class _SectionDetailScreenState extends State { onChanged: (ResourceDTO resource) { print("received value in grant older"); sectionDTO.imageId = resource.id; + sectionDTO.imageSource = resource.type == ResourceType.imageUrl ? resource.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resource.id; }, ), ], diff --git a/lib/Screens/Configurations/configuration_detail_screen.dart b/lib/Screens/Configurations/configuration_detail_screen.dart index 8604b69..06a88f4 100644 --- a/lib/Screens/Configurations/configuration_detail_screen.dart +++ b/lib/Screens/Configurations/configuration_detail_screen.dart @@ -10,7 +10,9 @@ import 'package:manager_app/Components/multi_select_container.dart'; import 'package:manager_app/Components/rounded_button.dart'; import 'package:manager_app/Components/string_input_container.dart'; import 'package:manager_app/Models/managerContext.dart'; +import 'package:manager_app/Screens/Configurations/listView_card_section.dart'; import 'package:manager_app/Screens/Configurations/new_section_popup.dart'; +import 'package:manager_app/Screens/Configurations/section_reorderList.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/client.dart'; import 'package:manager_app/constants.dart'; @@ -29,6 +31,7 @@ class ConfigurationDetailScreen extends StatefulWidget { class _ConfigurationDetailScreenState extends State { ConfigurationDTO configurationDTO; SectionDTO selectedSection; + List sections; @override Widget build(BuildContext context) { @@ -171,9 +174,8 @@ class _ConfigurationDetailScreenState extends State { future: getSections(configurationDTO, appContext.getContext().clientAPI), builder: (context, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.done) { - var tempOutput = new List.from(snapshot.data).where((section) => !section.isSubSection).toList(); - tempOutput.add(SectionDTO(id: null)); - return bodyGrid(configurationDTO, tempOutput, size, appContext); + sections = new List.from(snapshot.data).where((section) => !section.isSubSection).toList(); + return bodyGrid(configurationDTO, size, appContext); } else if (snapshot.connectionState == ConnectionState.none) { return Text("No data"); } else { @@ -199,57 +201,6 @@ class _ConfigurationDetailScreenState extends State { ); } - getElement(dynamic element, Size size) { - if (element.id != null) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Align( - alignment: Alignment.center, - child: AutoSizeText( - element.label, - style: new TextStyle(fontSize: 15), - maxLines: 2, - textAlign: TextAlign.center, - ), - ), - Align( - alignment: Alignment.bottomCenter, - child: Icon( - getSectionIcon(element.type), - color: kPrimaryColor, - size: 25, - ), - ), - ], - ); - } else { - return Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Icon( - Icons.add, - color: kTextLightColor, - size: 40.0, - ), - Container( - height: size.height*0.05, - child: AutoSizeText( - "Nouvelle section", - maxLines: 2, - style: new TextStyle(color: kWhite, fontWeight: FontWeight.w400), - minFontSize: 2, - maxFontSize: 40, - textAlign: TextAlign.center, - ), - ) - ], - ); - } - } - getButtons(ConfigurationDTO configurationDTO, AppContext appContext) { return Align( alignment: AlignmentDirectional.bottomCenter, @@ -300,43 +251,22 @@ class _ConfigurationDetailScreenState extends State { ); } - Widget bodyGrid(ConfigurationDTO configurationDTO, data, Size size, AppContext appContext) { + Widget bodyGrid(ConfigurationDTO configurationDTO, Size size, AppContext appContext) { return SingleChildScrollView( child: Container( height: size.height *0.40, child: Padding( padding: const EdgeInsets.all(8.0), - child: GridView.builder( - shrinkWrap: true, - gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 8), - itemCount: data.length, - itemBuilder: (BuildContext context, int index) { - return - InkWell( - onTap: () { - if (data[index].id == null) { - showNewSection(configurationDTO.id, appContext, context, false, null); - } else { - setState(() { - ManagerAppContext managerAppContext = appContext.getContext(); - managerAppContext.selectedSection = data[index]; - selectedSection = data[index]; - appContext.setContext(managerAppContext); - }); - } - }, - child: Container( - decoration: boxDecoration(data[index]), - padding: const EdgeInsets.all(15), - margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15), - child: Align( - alignment: Alignment.center, - child: getElement(data[index], size) - ), - ), - ); - } - ), + child: SectionReorderList( + sectionsIn: sections, + configurationId: configurationDTO.id, + onChanged: (List sectionsOut) { + print("onChanged parent SectionReorderList"); + sections = sectionsOut; + print(sections[0].label); + print(sections[1].label); + }, + ), ), ), ); @@ -378,7 +308,11 @@ class _ConfigurationDetailScreenState extends State { } Future> getSections(ConfigurationDTO configurationDTO, Client client) async { + print("getSections"); + print(configurationDTO.id); List sections = await client.sectionApi.sectionGetFromConfiguration(configurationDTO.id); + print(sections); + sections.sort((a, b) => a.order.compareTo(b.order)); return sections; } } diff --git a/lib/Screens/Configurations/listView_card_section.dart b/lib/Screens/Configurations/listView_card_section.dart new file mode 100644 index 0000000..43813df --- /dev/null +++ b/lib/Screens/Configurations/listView_card_section.dart @@ -0,0 +1,122 @@ +import 'package:auto_size_text/auto_size_text.dart'; +import 'package:flutter/material.dart'; +import 'package:manager_app/Components/fetch_section_icon.dart'; +import 'file:///C:/Users/Thomas%20Fransolet/Documents/Documents/Perso/MuseeDeLaFraise/manager-app/lib/Screens/Configurations/Section/SubSection/Slider/new_update_image_slider.dart'; +import 'file:///C:/Users/Thomas%20Fransolet/Documents/Documents/Perso/MuseeDeLaFraise/manager-app/lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart'; +import 'package:manager_app/app_context.dart'; +import 'package:manager_app/constants.dart'; +import 'package:managerapi/api.dart'; +import 'package:provider/provider.dart'; + +class ListViewCardSections extends StatefulWidget { + final int index; + final Key key; + final List sections; + final AppContext appContext; + final Function onSelect; + //final ValueChanged> onChanged; + + ListViewCardSections( + this.sections, + this.index, + this.key, + this.appContext, + this.onSelect + ); + + @override + _ListViewCardSectionsState createState() => _ListViewCardSectionsState(); +} + +class _ListViewCardSectionsState extends State { + @override + Widget build(BuildContext context) { + final appContext = Provider.of(context); + Size size = MediaQuery.of(context).size; + + return Card( + margin: EdgeInsets.all(4), + child: Center( + child: Stack( + children: [ + InkWell( + onTap: () { + widget.onSelect(widget.sections[widget.index]); + }, + child: Container( + width: 250, + height: 200, + child: Padding( + padding: const EdgeInsets.only(right: 30.0), + child: getElement(widget.index, widget.sections[widget.index], size, appContext) + ), + ), + ), + ], + ), + ), + ); + } + + getElement(int index, SectionDTO sectionDTO, Size size, AppContext appContext) { + return Container( + decoration: boxDecoration(sectionDTO, appContext), + padding: const EdgeInsets.all(15), + margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15), + child: Align( + alignment: Alignment.center, + child: getDetails(sectionDTO, size), + ), + ); + } + + getDetails(dynamic element, Size size) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Align( + alignment: Alignment.center, + child: AutoSizeText( + element.label, + style: new TextStyle(fontSize: 15), + maxLines: 2, + textAlign: TextAlign.center, + ), + ), + Align( + alignment: Alignment.bottomCenter, + child: Icon( + getSectionIcon(element.type), + color: kPrimaryColor, + size: 25, + ), + ), + ], + ); + } +} + +boxDecoration(SectionDTO sectionDTO, appContext) { + return BoxDecoration( + color: kBackgroundColor, + shape: BoxShape.rectangle, + border: Border.all(width: 1.5, color: kSecond), + borderRadius: BorderRadius.circular(10.0), + image: sectionDTO.imageSource != null ? new DecorationImage( + fit: BoxFit.cover, + colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.18), BlendMode.dstATop), + image: new NetworkImage( + sectionDTO.imageSource, + ), + ) : null, + boxShadow: [ + BoxShadow( + color: kSecond, + spreadRadius: 0.5, + blurRadius: 5, + offset: Offset(0, 1.5), // changes position of shadow + ), + ], + ); +} \ No newline at end of file diff --git a/lib/Screens/Configurations/new_section_popup.dart b/lib/Screens/Configurations/new_section_popup.dart index bbbb868..a95519f 100644 --- a/lib/Screens/Configurations/new_section_popup.dart +++ b/lib/Screens/Configurations/new_section_popup.dart @@ -103,10 +103,10 @@ void create(SectionDTO sectionDTO, AppContext appContext, BuildContext context, if (!isSubSection) { ManagerAppContext managerAppContext = appContext.getContext(); - if (managerAppContext.selectedConfiguration.sectionIds == null) { + /*if (managerAppContext.selectedConfiguration.sectionIds == null) { managerAppContext.selectedConfiguration.sectionIds = []; } - managerAppContext.selectedConfiguration.sectionIds.add(newSection.id); + managerAppContext.selectedConfiguration.sectionIds.add(newSection.id);*/ appContext.setContext(managerAppContext); showNotification(Colors.green, kWhite, 'La section a été créée avec succès !', context); } else { diff --git a/lib/Screens/Configurations/section_reorderList.dart b/lib/Screens/Configurations/section_reorderList.dart new file mode 100644 index 0000000..5db78c7 --- /dev/null +++ b/lib/Screens/Configurations/section_reorderList.dart @@ -0,0 +1,132 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:manager_app/Models/managerContext.dart'; +import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/listView_card_geoPoint_images.dart'; +import 'package:manager_app/Screens/Configurations/listView_card_section.dart'; +import 'package:manager_app/Screens/Configurations/new_section_popup.dart'; +import 'package:manager_app/Screens/Resources/select_resource_modal.dart'; +import 'package:manager_app/app_context.dart'; +import 'package:manager_app/constants.dart'; +import 'package:managerapi/api.dart'; +import 'package:provider/provider.dart'; + +class SectionReorderList extends StatefulWidget { + final String configurationId; + final List sectionsIn; + final ValueChanged> onChanged; + const SectionReorderList({ + Key key, + this.configurationId, + this.sectionsIn, + this.onChanged, + }) : super(key: key); + + @override + _SectionReorderListState createState() => _SectionReorderListState(); +} + +class _SectionReorderListState extends State { + List sections; + + @override + void initState() { + super.initState(); + sections = new List.from(widget.sectionsIn); + } + + void _onReorder(int oldIndex, int newIndex) { + setState( + () { + if (newIndex > oldIndex) { + newIndex -= 1; + } + final SectionDTO item = sections.removeAt(oldIndex); + sections.insert(newIndex, item); + + var i = 0; + sections.forEach((section) { + section.order = i; + i++; + }); + + widget.onChanged(sections); + }, + ); + } + + @override + Widget build(BuildContext context) { + final appContext = Provider.of(context); + Size size = MediaQuery.of(context).size; + + return Stack( + children: [ + Padding( + padding: const EdgeInsets.only(left: 10.0, right: 10.0, bottom: 10.0, top: 15.0), + child: ReorderableListView( + onReorder: _onReorder, + scrollDirection: Axis.horizontal, + padding: const EdgeInsets.symmetric(vertical: 20.0), + children: List.generate( + sections.length, + (index) { + return ListViewCardSections( + sections, + index, + Key('$index'), + appContext, + (section) { + setState(() { + ManagerAppContext managerAppContext = appContext.getContext(); + managerAppContext.selectedSection = section; + appContext.setContext(managerAppContext); + }); + } + ); + }, + ), + ), + ), + Positioned( + top: 10, + left: 10, + child: Text( + "Sections", + style: TextStyle(fontSize: 15), + ), + ), + Positioned( + bottom: 10, + right: 10, + child: InkWell( + onTap: () { + showNewSection(widget.configurationId, appContext, context, false, null); + }, + child: Container( + height: MediaQuery.of(context).size.width * 0.04, + width: MediaQuery.of(context).size.width * 0.04, + child: Icon( + Icons.add, + color: kTextLightColor, + size: 30.0, + ), + decoration: BoxDecoration( + color: Colors.lightGreen, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(20.0), + boxShadow: [ + BoxShadow( + color: kSecond, + spreadRadius: 0.5, + blurRadius: 5, + offset: Offset(0, 1.5), // changes position of shadow + ), + ], + ), + ), + ), + ) + ], + ); + } +} diff --git a/lib/Screens/Resources/new_resource_popup.dart b/lib/Screens/Resources/new_resource_popup.dart index 9a68bd4..ac21e33 100644 --- a/lib/Screens/Resources/new_resource_popup.dart +++ b/lib/Screens/Resources/new_resource_popup.dart @@ -17,6 +17,7 @@ void showNewResource(AppContext appContext, BuildContext context) { Size size = MediaQuery.of(context).size; var fileName; File fileToSend; + showDialog( builder: (BuildContext context) => AlertDialog( shape: RoundedRectangleBorder( @@ -55,7 +56,7 @@ void showNewResource(AppContext appContext, BuildContext context) { ), ), actions: [ - Row( + Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Align( diff --git a/manager_api/doc/ConfigurationDTO.md b/manager_api/doc/ConfigurationDTO.md index b1a7371..425da4d 100644 --- a/manager_api/doc/ConfigurationDTO.md +++ b/manager_api/doc/ConfigurationDTO.md @@ -10,7 +10,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | [optional] **label** | **String** | | [optional] -**sectionIds** | **List** | | [optional] [default to const []] **primaryColor** | **String** | | [optional] **secondaryColor** | **String** | | [optional] **languages** | **List** | | [optional] [default to const []] diff --git a/manager_api/doc/ImageGeoPoint.md b/manager_api/doc/ImageGeoPoint.md index 5d13253..e290427 100644 --- a/manager_api/doc/ImageGeoPoint.md +++ b/manager_api/doc/ImageGeoPoint.md @@ -10,7 +10,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **imageResourceId** | **String** | | [optional] **imageSource** | **String** | | [optional] -**order** | **int** | | [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/doc/SectionDTO.md b/manager_api/doc/SectionDTO.md index 5befdea..46dec96 100644 --- a/manager_api/doc/SectionDTO.md +++ b/manager_api/doc/SectionDTO.md @@ -13,12 +13,14 @@ Name | Type | Description | Notes **title** | [**List**](TranslationDTO.md) | | [optional] [default to const []] **description** | [**List**](TranslationDTO.md) | | [optional] [default to const []] **imageId** | **String** | | [optional] +**imageSource** | **String** | | [optional] **configurationId** | **String** | | [optional] **isSubSection** | **bool** | | [optional] **parentId** | **String** | | [optional] **type** | [**SectionType**](SectionType.md) | | [optional] **data** | **String** | | [optional] **dateCreation** | [**DateTime**](DateTime.md) | | [optional] +**order** | **int** | | [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/lib/model/configuration_dto.dart b/manager_api/lib/model/configuration_dto.dart index 132182c..06db575 100644 --- a/manager_api/lib/model/configuration_dto.dart +++ b/manager_api/lib/model/configuration_dto.dart @@ -14,7 +14,6 @@ class ConfigurationDTO { ConfigurationDTO({ this.id, this.label, - this.sectionIds, this.primaryColor, this.secondaryColor, this.languages, @@ -25,8 +24,6 @@ class ConfigurationDTO { String label; - List sectionIds; - String primaryColor; String secondaryColor; @@ -39,7 +36,6 @@ class ConfigurationDTO { bool operator ==(Object other) => identical(this, other) || other is ConfigurationDTO && other.id == id && other.label == label && - other.sectionIds == sectionIds && other.primaryColor == primaryColor && other.secondaryColor == secondaryColor && other.languages == languages && @@ -49,14 +45,13 @@ class ConfigurationDTO { int get hashCode => (id == null ? 0 : id.hashCode) + (label == null ? 0 : label.hashCode) + - (sectionIds == null ? 0 : sectionIds.hashCode) + (primaryColor == null ? 0 : primaryColor.hashCode) + (secondaryColor == null ? 0 : secondaryColor.hashCode) + (languages == null ? 0 : languages.hashCode) + (dateCreation == null ? 0 : dateCreation.hashCode); @override - String toString() => 'ConfigurationDTO[id=$id, label=$label, sectionIds=$sectionIds, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation]'; + String toString() => 'ConfigurationDTO[id=$id, label=$label, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation]'; Map toJson() { final json = {}; @@ -66,9 +61,6 @@ class ConfigurationDTO { if (label != null) { json[r'label'] = label; } - if (sectionIds != null) { - json[r'sectionIds'] = sectionIds; - } if (primaryColor != null) { json[r'primaryColor'] = primaryColor; } @@ -91,9 +83,6 @@ class ConfigurationDTO { : ConfigurationDTO( id: json[r'id'], label: json[r'label'], - sectionIds: json[r'sectionIds'] == null - ? null - : (json[r'sectionIds'] as List).cast(), primaryColor: json[r'primaryColor'], secondaryColor: json[r'secondaryColor'], languages: json[r'languages'] == null diff --git a/manager_api/lib/model/image_geo_point.dart b/manager_api/lib/model/image_geo_point.dart index 786ecc8..923877f 100644 --- a/manager_api/lib/model/image_geo_point.dart +++ b/manager_api/lib/model/image_geo_point.dart @@ -14,29 +14,24 @@ class ImageGeoPoint { ImageGeoPoint({ this.imageResourceId, this.imageSource, - this.order, }); String imageResourceId; String imageSource; - int order; - @override bool operator ==(Object other) => identical(this, other) || other is ImageGeoPoint && other.imageResourceId == imageResourceId && - other.imageSource == imageSource && - other.order == order; + other.imageSource == imageSource; @override int get hashCode => (imageResourceId == null ? 0 : imageResourceId.hashCode) + - (imageSource == null ? 0 : imageSource.hashCode) + - (order == null ? 0 : order.hashCode); + (imageSource == null ? 0 : imageSource.hashCode); @override - String toString() => 'ImageGeoPoint[imageResourceId=$imageResourceId, imageSource=$imageSource, order=$order]'; + String toString() => 'ImageGeoPoint[imageResourceId=$imageResourceId, imageSource=$imageSource]'; Map toJson() { final json = {}; @@ -46,9 +41,6 @@ class ImageGeoPoint { if (imageSource != null) { json[r'imageSource'] = imageSource; } - if (order != null) { - json[r'order'] = order; - } return json; } @@ -59,7 +51,6 @@ class ImageGeoPoint { : ImageGeoPoint( imageResourceId: json[r'imageResourceId'], imageSource: json[r'imageSource'], - order: json[r'order'], ); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => diff --git a/manager_api/lib/model/section_dto.dart b/manager_api/lib/model/section_dto.dart index 3da5c8f..7d29c5e 100644 --- a/manager_api/lib/model/section_dto.dart +++ b/manager_api/lib/model/section_dto.dart @@ -17,12 +17,14 @@ class SectionDTO { this.title, this.description, this.imageId, + this.imageSource, this.configurationId, this.isSubSection, this.parentId, this.type, this.data, this.dateCreation, + this.order, }); String id; @@ -35,6 +37,8 @@ class SectionDTO { String imageId; + String imageSource; + String configurationId; bool isSubSection; @@ -47,6 +51,8 @@ class SectionDTO { DateTime dateCreation; + int order; + @override bool operator ==(Object other) => identical(this, other) || other is SectionDTO && other.id == id && @@ -54,12 +60,14 @@ class SectionDTO { other.title == title && other.description == description && other.imageId == imageId && + other.imageSource == imageSource && other.configurationId == configurationId && other.isSubSection == isSubSection && other.parentId == parentId && other.type == type && other.data == data && - other.dateCreation == dateCreation; + other.dateCreation == dateCreation && + other.order == order; @override int get hashCode => @@ -68,15 +76,17 @@ class SectionDTO { (title == null ? 0 : title.hashCode) + (description == null ? 0 : description.hashCode) + (imageId == null ? 0 : imageId.hashCode) + + (imageSource == null ? 0 : imageSource.hashCode) + (configurationId == null ? 0 : configurationId.hashCode) + (isSubSection == null ? 0 : isSubSection.hashCode) + (parentId == null ? 0 : parentId.hashCode) + (type == null ? 0 : type.hashCode) + (data == null ? 0 : data.hashCode) + - (dateCreation == null ? 0 : dateCreation.hashCode); + (dateCreation == null ? 0 : dateCreation.hashCode) + + (order == null ? 0 : order.hashCode); @override - String toString() => 'SectionDTO[id=$id, label=$label, title=$title, description=$description, imageId=$imageId, configurationId=$configurationId, isSubSection=$isSubSection, parentId=$parentId, type=$type, data=$data, dateCreation=$dateCreation]'; + String toString() => 'SectionDTO[id=$id, label=$label, title=$title, description=$description, imageId=$imageId, imageSource=$imageSource, configurationId=$configurationId, isSubSection=$isSubSection, parentId=$parentId, type=$type, data=$data, dateCreation=$dateCreation, order=$order]'; Map toJson() { final json = {}; @@ -95,6 +105,9 @@ class SectionDTO { if (imageId != null) { json[r'imageId'] = imageId; } + if (imageSource != null) { + json[r'imageSource'] = imageSource; + } if (configurationId != null) { json[r'configurationId'] = configurationId; } @@ -113,6 +126,9 @@ class SectionDTO { if (dateCreation != null) { json[r'dateCreation'] = dateCreation.toUtc().toIso8601String(); } + if (order != null) { + json[r'order'] = order; + } return json; } @@ -126,6 +142,7 @@ class SectionDTO { title: TranslationDTO.listFromJson(json[r'title']), description: TranslationDTO.listFromJson(json[r'description']), imageId: json[r'imageId'], + imageSource: json[r'imageSource'], configurationId: json[r'configurationId'], isSubSection: json[r'isSubSection'], parentId: json[r'parentId'], @@ -134,6 +151,7 @@ class SectionDTO { dateCreation: json[r'dateCreation'] == null ? null : DateTime.parse(json[r'dateCreation']), + order: json[r'order'], ); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => diff --git a/manager_api/swagger.yaml b/manager_api/swagger.yaml index b8c42ca..cbdf2a3 100644 --- a/manager_api/swagger.yaml +++ b/manager_api/swagger.yaml @@ -1193,11 +1193,6 @@ components: label: type: string nullable: true - sectionIds: - type: array - nullable: true - items: - type: string primaryColor: type: string nullable: true @@ -1320,6 +1315,9 @@ components: imageId: type: string nullable: true + imageSource: + type: string + nullable: true configurationId: type: string nullable: true @@ -1336,6 +1334,9 @@ components: dateCreation: type: string format: date-time + order: + type: integer + format: int32 TranslationDTO: type: object additionalProperties: false @@ -1434,9 +1435,6 @@ components: imageSource: type: string nullable: true - order: - type: integer - format: int32 SliderDTO: type: object additionalProperties: false