diff --git a/lib/Screens/Configurations/Section/SubSection/Map/image_reorderList.dart b/lib/Screens/Configurations/Section/SubSection/Map/image_reorderList.dart new file mode 100644 index 0000000..6c3e563 --- /dev/null +++ b/lib/Screens/Configurations/Section/SubSection/Map/image_reorderList.dart @@ -0,0 +1,151 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/listView_card_geoPoint_images.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 GeoPointImageList extends StatefulWidget { + final List images; + final ValueChanged> onChanged; + const GeoPointImageList({ + Key key, + this.images, + this.onChanged, + }) : super(key: key); + + @override + _GeoPointImageListState createState() => _GeoPointImageListState(); +} + +class _GeoPointImageListState extends State { + List imagesGeo; + + @override + void initState() { + super.initState(); + + imagesGeo = new List.from(widget.images); + + //imagesGeo = widget.images; + } + + void _onReorder(int oldIndex, int newIndex) { + setState( + () { + if (newIndex > oldIndex) { + newIndex -= 1; + } + 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); + }, + ); + } + + @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( + imagesGeo.length, + (index) { + return ListViewCardGeoPointImages( + imagesGeo, + index, + Key('$index'), + appContext, + (imagesOutput) { + setState(() { + //List test = new List.from(imagesOutput); + imagesGeo = imagesOutput; + widget.onChanged(imagesGeo); + }); + } + ); + }, + ), + ), + ), + Positioned( + top: 10, + left: 10, + child: Text( + "Images test", + style: TextStyle(fontSize: 15), + ), + ), + Positioned( + bottom: 10, + right: 10, + child: InkWell( + onTap: () { + showSelectResourceModal( + "Sélectionner une ressource", + (ResourceDTO resource) { + setState(() { + ImageGeoPoint newImage = new ImageGeoPoint( imageResourceId: resource.id, imageSource: resource.type == ResourceType.imageUrl ? resource.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resource.id); + imagesGeo.add(newImage); + }); + }, + 1, + 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, + 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/Configurations/Section/SubSection/Map/listView_card_geoPoint_images.dart b/lib/Screens/Configurations/Section/SubSection/Map/listView_card_geoPoint_images.dart new file mode 100644 index 0000000..f55712a --- /dev/null +++ b/lib/Screens/Configurations/Section/SubSection/Map/listView_card_geoPoint_images.dart @@ -0,0 +1,138 @@ +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 ListViewCardGeoPointImages extends StatefulWidget { + final int index; + final Key key; + final List listImages; + final AppContext appContext; + final ValueChanged> onChanged; + + ListViewCardGeoPointImages( + this.listImages, + this.index, + this.key, + this.appContext, + this.onChanged + ); + + @override + _ListViewCardGeoPointImagesState createState() => _ListViewCardGeoPointImagesState(); +} + +class _ListViewCardGeoPointImagesState 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: [ + Container( + width: 200, + height: 200, + /*decoration: BoxDecoration( + color: kWhite, + border: Border.all(width: 0.5, color: kSecond), + ),*/ + child: Padding( + padding: const EdgeInsets.only(right: 30.0), + child: getElement(widget.index, widget.listImages[widget.index], size, appContext) + ), + ), + Positioned( + right: 0, + bottom: 0, + child: Row( + children: [ + InkWell( + onTap: () { + widget.listImages.removeAt(widget.index); + widget.onChanged(widget.listImages); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Icon( + Icons.delete, + color: kPrimaryColor, + size: 25.0, + ), + ) + ), + ], + ) + ), + ], + ), + ), + ); + } + + getElement(int index, ImageGeoPoint imageGeoPoint, Size size, AppContext appContext) { + return Container( + width: double.infinity, + height: double.infinity, + child: Stack( + children: [ + Center( + child: Image.network( + imageGeoPoint.imageSource, + fit:BoxFit.scaleDown + ), + ) + /*Align( + alignment: Alignment.center, + child: AutoSizeText( + imageGeoPoint., + style: new TextStyle(fontSize: 15), + maxLines: 2, + textAlign: TextAlign.center, + ), + ),*/ + /*Positioned( + top: 20, + left: 20, + child: Icon( + getSectionIcon(sectionDTO.type), + color: kSecond, + size: 18.0, + ), + ),*/ + ], + ), + ); + } +} + +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.title != null ? new DecorationImage( + fit: BoxFit.scaleDown, + /*image: new NetworkImage( + sectionDTO., + ),*/ + ) : 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/Section/SubSection/map_config.dart b/lib/Screens/Configurations/Section/SubSection/Map/map_config.dart similarity index 98% rename from lib/Screens/Configurations/Section/SubSection/map_config.dart rename to lib/Screens/Configurations/Section/SubSection/Map/map_config.dart index 3427733..456fcec 100644 --- a/lib/Screens/Configurations/Section/SubSection/map_config.dart +++ b/lib/Screens/Configurations/Section/SubSection/Map/map_config.dart @@ -5,7 +5,7 @@ import 'package:manager_app/Components/fetch_section_icon.dart'; import 'package:manager_app/Components/image_input_container.dart'; import 'package:manager_app/Components/multi_select_container.dart'; import 'package:manager_app/Components/slider_input_container.dart'; -import 'package:manager_app/Screens/Configurations/Section/SubSection/showNewOrUpdateGeoPoint.dart'; +import 'file:///C:/Users/Thomas%20Fransolet/Documents/Documents/Perso/MuseeDeLaFraise/manager-app/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.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/SubSection/showNewOrUpdateGeoPoint.dart b/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart similarity index 72% rename from lib/Screens/Configurations/Section/SubSection/showNewOrUpdateGeoPoint.dart rename to lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart index 7a186ae..4de33f0 100644 --- a/lib/Screens/Configurations/Section/SubSection/showNewOrUpdateGeoPoint.dart +++ b/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart @@ -5,6 +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/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:managerapi/api.dart'; @@ -12,8 +13,6 @@ import 'package:managerapi/api.dart'; void showNewOrUpdateGeoPoint(GeoPointDTO inputGeoPointDTO, Function getResult, AppContext appContext, BuildContext context) { GeoPointDTO geoPointDTO = new GeoPointDTO(); - print("showNewOrUpdateGeoPoint"); - print(inputGeoPointDTO); if (inputGeoPointDTO != null) { geoPointDTO = inputGeoPointDTO; } else { @@ -37,7 +36,7 @@ void showNewOrUpdateGeoPoint(GeoPointDTO inputGeoPointDTO, Function getResult, A borderRadius: BorderRadius.all(Radius.circular(20.0)) ), content: Container( - width: size.width *0.5, + width: size.width *0.7, child: SingleChildScrollView( child: Column( children: [ @@ -45,43 +44,53 @@ void showNewOrUpdateGeoPoint(GeoPointDTO inputGeoPointDTO, Function getResult, A Column( children: [ Row( - mainAxisAlignment: MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - ImageInputContainer( - label: "Image :", - initialValue: geoPointDTO.imageResourceId, - color: kPrimaryColor, - onChanged: (ResourceDTO resource) { - geoPointDTO.imageSource = resource.type == ResourceType.imageUrl ? resource.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resource.id; - geoPointDTO.imageResourceId = resource.id; + StringInputContainer( + label: "Latitude :", + initialValue: geoPointDTO.latitude, + onChanged: (value) { + geoPointDTO.latitude = value; }, ), - Column( - children: [ - StringInputContainer( - label: "Latitude :", - initialValue: geoPointDTO.latitude, - onChanged: (value) { - geoPointDTO.latitude = value; - }, - ), - StringInputContainer( - label: "Longitude :", - initialValue: geoPointDTO.longitude, - onChanged: (value) { - geoPointDTO.longitude = value; - }, - ) - ], + StringInputContainer( + label: "Longitude :", + initialValue: geoPointDTO.longitude, + onChanged: (value) { + geoPointDTO.longitude = value; + }, ) ], ), Container( - child: SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: getTranslations(context, appContext, geoPointDTO), - ), + height: size.height * 0.33, + width: double.infinity, + child: ListView( + scrollDirection: Axis.horizontal, + children: getTranslations(context, appContext, geoPointDTO), + ), + ), + Container( + height: size.height * 0.33, + decoration: BoxDecoration( + color: kWhite, + shape: BoxShape.rectangle, + border: Border.all(width: 1.5, color: kSecond), + borderRadius: BorderRadius.circular(10.0), + boxShadow: [ + BoxShadow( + color: kSecond, + spreadRadius: 0.5, + blurRadius: 5, + offset: Offset(0, 1.5), // changes position of shadow + ), + ], + ), + child: GeoPointImageList( + images: geoPointDTO.images, + onChanged: (List imagesOutput) { + geoPointDTO.images = imagesOutput; + }, ), ), ], @@ -104,6 +113,9 @@ void showNewOrUpdateGeoPoint(GeoPointDTO inputGeoPointDTO, Function getResult, A icon: Icons.undo, color: kSecond, press: () { + if (inputGeoPointDTO != null) { + geoPointDTO.images = inputGeoPointDTO.images; + } Navigator.of(context).pop(); }, fontSize: 20, diff --git a/lib/Screens/Configurations/Section/SubSection/listView_card_subSection.dart b/lib/Screens/Configurations/Section/SubSection/Menu/listView_card_subSection.dart similarity index 93% rename from lib/Screens/Configurations/Section/SubSection/listView_card_subSection.dart rename to lib/Screens/Configurations/Section/SubSection/Menu/listView_card_subSection.dart index 2757d53..1dc2d91 100644 --- a/lib/Screens/Configurations/Section/SubSection/listView_card_subSection.dart +++ b/lib/Screens/Configurations/Section/SubSection/Menu/listView_card_subSection.dart @@ -1,8 +1,8 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; import 'package:manager_app/Components/fetch_section_icon.dart'; -import 'package:manager_app/Screens/Configurations/Section/SubSection/new_update_image_slider.dart'; -import 'package:manager_app/Screens/Configurations/Section/SubSection/showEditSubSection.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'; diff --git a/lib/Screens/Configurations/Section/SubSection/menu_config.dart b/lib/Screens/Configurations/Section/SubSection/Menu/menu_config.dart similarity index 97% rename from lib/Screens/Configurations/Section/SubSection/menu_config.dart rename to lib/Screens/Configurations/Section/SubSection/Menu/menu_config.dart index c82aad3..803d9b1 100644 --- a/lib/Screens/Configurations/Section/SubSection/menu_config.dart +++ b/lib/Screens/Configurations/Section/SubSection/Menu/menu_config.dart @@ -2,8 +2,7 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:manager_app/Components/fetch_section_icon.dart'; -import 'package:manager_app/Screens/Configurations/Section/SubSection/listView_card_image.dart'; -import 'package:manager_app/Screens/Configurations/Section/SubSection/listView_card_subSection.dart'; +import 'file:///C:/Users/Thomas%20Fransolet/Documents/Documents/Perso/MuseeDeLaFraise/manager-app/lib/Screens/Configurations/Section/SubSection/Menu/listView_card_subSection.dart'; import 'package:manager_app/Screens/Configurations/new_section_popup.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; diff --git a/lib/Screens/Configurations/Section/SubSection/showEditSubSection.dart b/lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart similarity index 95% rename from lib/Screens/Configurations/Section/SubSection/showEditSubSection.dart rename to lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart index 0a8c716..466be4d 100644 --- a/lib/Screens/Configurations/Section/SubSection/showEditSubSection.dart +++ b/lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart @@ -5,13 +5,13 @@ 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/slider_config.dart'; -import 'package:manager_app/Screens/Configurations/Section/SubSection/web_video_config.dart'; +import 'file:///C:/Users/Thomas%20Fransolet/Documents/Documents/Perso/MuseeDeLaFraise/manager-app/lib/Screens/Configurations/Section/SubSection/Slider/slider_config.dart'; +import 'file:///C:/Users/Thomas%20Fransolet/Documents/Documents/Perso/MuseeDeLaFraise/manager-app/lib/Screens/Configurations/Section/SubSection/WebOrVideo/web_video_config.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:managerapi/api.dart'; -import 'map_config.dart'; +import '../Map/map_config.dart'; import 'menu_config.dart'; void showEditSubSection(SectionDTO subSectionDTO, Function getResult, AppContext appContext, BuildContext context) { diff --git a/lib/Screens/Configurations/Section/SubSection/listView_card_image.dart b/lib/Screens/Configurations/Section/SubSection/Slider/listView_card_image.dart similarity index 95% rename from lib/Screens/Configurations/Section/SubSection/listView_card_image.dart rename to lib/Screens/Configurations/Section/SubSection/Slider/listView_card_image.dart index 344de69..41f98a7 100644 --- a/lib/Screens/Configurations/Section/SubSection/listView_card_image.dart +++ b/lib/Screens/Configurations/Section/SubSection/Slider/listView_card_image.dart @@ -1,6 +1,6 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; -import 'package:manager_app/Screens/Configurations/Section/SubSection/new_update_image_slider.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 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:managerapi/api.dart'; diff --git a/lib/Screens/Configurations/Section/SubSection/new_update_image_slider.dart b/lib/Screens/Configurations/Section/SubSection/Slider/new_update_image_slider.dart similarity index 88% rename from lib/Screens/Configurations/Section/SubSection/new_update_image_slider.dart rename to lib/Screens/Configurations/Section/SubSection/Slider/new_update_image_slider.dart index ba30002..2c1829f 100644 --- a/lib/Screens/Configurations/Section/SubSection/new_update_image_slider.dart +++ b/lib/Screens/Configurations/Section/SubSection/Slider/new_update_image_slider.dart @@ -37,18 +37,23 @@ void showNewOrUpdateImageSlider(ImageDTO inputImageDTO, Function getResult, AppC width: size.width *0.5, child: SingleChildScrollView( child: Column( + mainAxisAlignment: MainAxisAlignment.center, children: [ Text("Image/vidéo", style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400)), Column( + mainAxisAlignment: MainAxisAlignment.center, children: [ - ImageInputContainer( - label: "Image :", - initialValue: imageDTO.resourceId, - color: kPrimaryColor, - onChanged: (ResourceDTO resource) { - imageDTO.source_ = resource.type == ResourceType.imageUrl ? resource.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resource.id; - imageDTO.resourceId = resource.id; - }, + Align( + alignment: AlignmentDirectional.center, + child: ImageInputContainer( + label: "Image :", + initialValue: imageDTO.resourceId, + color: kPrimaryColor, + onChanged: (ResourceDTO resource) { + imageDTO.source_ = resource.type == ResourceType.imageUrl ? resource.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resource.id; + imageDTO.resourceId = resource.id; + }, + ), ), Container( child: SingleChildScrollView( diff --git a/lib/Screens/Configurations/Section/SubSection/slider_config.dart b/lib/Screens/Configurations/Section/SubSection/Slider/slider_config.dart similarity index 92% rename from lib/Screens/Configurations/Section/SubSection/slider_config.dart rename to lib/Screens/Configurations/Section/SubSection/Slider/slider_config.dart index cf30a61..aad6eec 100644 --- a/lib/Screens/Configurations/Section/SubSection/slider_config.dart +++ b/lib/Screens/Configurations/Section/SubSection/Slider/slider_config.dart @@ -1,7 +1,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:manager_app/Screens/Configurations/Section/SubSection/listView_card_image.dart'; -import 'package:manager_app/Screens/Configurations/Section/SubSection/new_update_image_slider.dart'; +import 'file:///C:/Users/Thomas%20Fransolet/Documents/Documents/Perso/MuseeDeLaFraise/manager-app/lib/Screens/Configurations/Section/SubSection/Slider/listView_card_image.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 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:managerapi/api.dart'; diff --git a/lib/Screens/Configurations/Section/SubSection/web_video_config.dart b/lib/Screens/Configurations/Section/SubSection/WebOrVideo/web_video_config.dart similarity index 100% rename from lib/Screens/Configurations/Section/SubSection/web_video_config.dart rename to lib/Screens/Configurations/Section/SubSection/WebOrVideo/web_video_config.dart diff --git a/lib/Screens/Configurations/Section/section_detail_screen.dart b/lib/Screens/Configurations/Section/section_detail_screen.dart index 9e9c509..b617fc8 100644 --- a/lib/Screens/Configurations/Section/section_detail_screen.dart +++ b/lib/Screens/Configurations/Section/section_detail_screen.dart @@ -8,8 +8,8 @@ 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/Models/managerContext.dart'; -import 'package:manager_app/Screens/Configurations/Section/SubSection/slider_config.dart'; -import 'package:manager_app/Screens/Configurations/Section/SubSection/web_video_config.dart'; +import 'file:///C:/Users/Thomas%20Fransolet/Documents/Documents/Perso/MuseeDeLaFraise/manager-app/lib/Screens/Configurations/Section/SubSection/Slider/slider_config.dart'; +import 'file:///C:/Users/Thomas%20Fransolet/Documents/Documents/Perso/MuseeDeLaFraise/manager-app/lib/Screens/Configurations/Section/SubSection/WebOrVideo/web_video_config.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/client.dart'; import 'package:manager_app/constants.dart'; @@ -17,8 +17,8 @@ import 'package:managerapi/api.dart'; import 'package:provider/provider.dart'; import 'package:intl/intl.dart'; -import 'SubSection/map_config.dart'; -import 'SubSection/menu_config.dart'; +import 'SubSection/Map/map_config.dart'; +import 'SubSection/Menu/menu_config.dart'; class SectionDetailScreen extends StatefulWidget { final String id; diff --git a/manager_api/.openapi-generator/FILES b/manager_api/.openapi-generator/FILES index da64256..1e85bb0 100644 --- a/manager_api/.openapi-generator/FILES +++ b/manager_api/.openapi-generator/FILES @@ -10,6 +10,7 @@ doc/DeviceDetailDTO.md doc/DeviceDetailDTOAllOf.md doc/GeoPointDTO.md doc/ImageDTO.md +doc/ImageGeoPoint.md doc/LoginDTO.md doc/MapDTO.md doc/MapType.md @@ -51,6 +52,7 @@ lib/model/device_detail_dto_all_of.dart lib/model/device_dto.dart lib/model/geo_point_dto.dart lib/model/image_dto.dart +lib/model/image_geo_point.dart lib/model/login_dto.dart lib/model/map_dto.dart lib/model/map_type.dart diff --git a/manager_api/README.md b/manager_api/README.md index 8ec8564..7be03b3 100644 --- a/manager_api/README.md +++ b/manager_api/README.md @@ -111,6 +111,7 @@ Class | Method | HTTP request | Description - [DeviceDetailDTOAllOf](doc\/DeviceDetailDTOAllOf.md) - [GeoPointDTO](doc\/GeoPointDTO.md) - [ImageDTO](doc\/ImageDTO.md) + - [ImageGeoPoint](doc\/ImageGeoPoint.md) - [LoginDTO](doc\/LoginDTO.md) - [MapDTO](doc\/MapDTO.md) - [MapType](doc\/MapType.md) diff --git a/manager_api/doc/GeoPointDTO.md b/manager_api/doc/GeoPointDTO.md index d20baca..bb5d545 100644 --- a/manager_api/doc/GeoPointDTO.md +++ b/manager_api/doc/GeoPointDTO.md @@ -11,8 +11,7 @@ Name | Type | Description | Notes **id** | **int** | | [optional] **title** | [**List**](TranslationDTO.md) | | [optional] [default to const []] **description** | [**List**](TranslationDTO.md) | | [optional] [default to const []] -**imageResourceId** | **String** | | [optional] -**imageSource** | **String** | | [optional] +**images** | [**List**](ImageGeoPoint.md) | | [optional] [default to const []] **latitude** | **String** | | [optional] **longitude** | **String** | | [optional] diff --git a/manager_api/doc/ImageGeoPoint.md b/manager_api/doc/ImageGeoPoint.md new file mode 100644 index 0000000..5d13253 --- /dev/null +++ b/manager_api/doc/ImageGeoPoint.md @@ -0,0 +1,17 @@ +# managerapi.model.ImageGeoPoint + +## Load the model package +```dart +import 'package:managerapi/api.dart'; +``` + +## Properties +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/lib/api.dart b/manager_api/lib/api.dart index 627f917..a984d28 100644 --- a/manager_api/lib/api.dart +++ b/manager_api/lib/api.dart @@ -40,6 +40,7 @@ part 'model/device_detail_dto.dart'; part 'model/device_detail_dto_all_of.dart'; part 'model/geo_point_dto.dart'; part 'model/image_dto.dart'; +part 'model/image_geo_point.dart'; part 'model/login_dto.dart'; part 'model/map_dto.dart'; part 'model/map_type.dart'; diff --git a/manager_api/lib/api_client.dart b/manager_api/lib/api_client.dart index d0ff727..86c28f2 100644 --- a/manager_api/lib/api_client.dart +++ b/manager_api/lib/api_client.dart @@ -168,6 +168,8 @@ class ApiClient { return GeoPointDTO.fromJson(value); case 'ImageDTO': return ImageDTO.fromJson(value); + case 'ImageGeoPoint': + return ImageGeoPoint.fromJson(value); case 'LoginDTO': return LoginDTO.fromJson(value); case 'MapDTO': diff --git a/manager_api/lib/model/geo_point_dto.dart b/manager_api/lib/model/geo_point_dto.dart index 88f69cf..15363a1 100644 --- a/manager_api/lib/model/geo_point_dto.dart +++ b/manager_api/lib/model/geo_point_dto.dart @@ -15,8 +15,7 @@ class GeoPointDTO { this.id, this.title, this.description, - this.imageResourceId, - this.imageSource, + this.images, this.latitude, this.longitude, }); @@ -27,9 +26,7 @@ class GeoPointDTO { List description; - String imageResourceId; - - String imageSource; + List images; String latitude; @@ -40,8 +37,7 @@ class GeoPointDTO { other.id == id && other.title == title && other.description == description && - other.imageResourceId == imageResourceId && - other.imageSource == imageSource && + other.images == images && other.latitude == latitude && other.longitude == longitude; @@ -50,13 +46,12 @@ class GeoPointDTO { (id == null ? 0 : id.hashCode) + (title == null ? 0 : title.hashCode) + (description == null ? 0 : description.hashCode) + - (imageResourceId == null ? 0 : imageResourceId.hashCode) + - (imageSource == null ? 0 : imageSource.hashCode) + + (images == null ? 0 : images.hashCode) + (latitude == null ? 0 : latitude.hashCode) + (longitude == null ? 0 : longitude.hashCode); @override - String toString() => 'GeoPointDTO[id=$id, title=$title, description=$description, imageResourceId=$imageResourceId, imageSource=$imageSource, latitude=$latitude, longitude=$longitude]'; + String toString() => 'GeoPointDTO[id=$id, title=$title, description=$description, images=$images, latitude=$latitude, longitude=$longitude]'; Map toJson() { final json = {}; @@ -69,11 +64,8 @@ class GeoPointDTO { if (description != null) { json[r'description'] = description; } - if (imageResourceId != null) { - json[r'imageResourceId'] = imageResourceId; - } - if (imageSource != null) { - json[r'imageSource'] = imageSource; + if (images != null) { + json[r'images'] = images; } if (latitude != null) { json[r'latitude'] = latitude; @@ -92,8 +84,7 @@ class GeoPointDTO { id: json[r'id'], title: TranslationDTO.listFromJson(json[r'title']), description: TranslationDTO.listFromJson(json[r'description']), - imageResourceId: json[r'imageResourceId'], - imageSource: json[r'imageSource'], + images: ImageGeoPoint.listFromJson(json[r'images']), latitude: json[r'latitude'], longitude: json[r'longitude'], ); diff --git a/manager_api/lib/model/image_geo_point.dart b/manager_api/lib/model/image_geo_point.dart new file mode 100644 index 0000000..786ecc8 --- /dev/null +++ b/manager_api/lib/model/image_geo_point.dart @@ -0,0 +1,89 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ImageGeoPoint { + /// Returns a new [ImageGeoPoint] instance. + 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; + + @override + int get hashCode => + (imageResourceId == null ? 0 : imageResourceId.hashCode) + + (imageSource == null ? 0 : imageSource.hashCode) + + (order == null ? 0 : order.hashCode); + + @override + String toString() => 'ImageGeoPoint[imageResourceId=$imageResourceId, imageSource=$imageSource, order=$order]'; + + Map toJson() { + final json = {}; + if (imageResourceId != null) { + json[r'imageResourceId'] = imageResourceId; + } + if (imageSource != null) { + json[r'imageSource'] = imageSource; + } + if (order != null) { + json[r'order'] = order; + } + return json; + } + + /// Returns a new [ImageGeoPoint] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static ImageGeoPoint fromJson(Map json) => json == null + ? null + : ImageGeoPoint( + imageResourceId: json[r'imageResourceId'], + imageSource: json[r'imageSource'], + order: json[r'order'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => ImageGeoPoint.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = ImageGeoPoint.fromJson(v)); + } + return map; + } + + // maps a json object with a list of ImageGeoPoint-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = ImageGeoPoint.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/manager_api/swagger.yaml b/manager_api/swagger.yaml index 686a8f4..b8c42ca 100644 --- a/manager_api/swagger.yaml +++ b/manager_api/swagger.yaml @@ -1413,18 +1413,30 @@ components: nullable: true items: $ref: '#/components/schemas/TranslationDTO' - imageResourceId: - type: string - nullable: true - imageSource: - type: string + images: + type: array nullable: true + items: + $ref: '#/components/schemas/ImageGeoPoint' latitude: type: string nullable: true longitude: type: string nullable: true + ImageGeoPoint: + type: object + additionalProperties: false + properties: + imageResourceId: + type: string + nullable: true + imageSource: + type: string + nullable: true + order: + type: integer + format: int32 SliderDTO: type: object additionalProperties: false diff --git a/manager_api/test/image_geo_point_test.dart b/manager_api/test/image_geo_point_test.dart new file mode 100644 index 0000000..59f20bb --- /dev/null +++ b/manager_api/test/image_geo_point_test.dart @@ -0,0 +1,36 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:managerapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ImageGeoPoint +void main() { + final instance = ImageGeoPoint(); + + group('test ImageGeoPoint', () { + // String imageResourceId + test('to test the property `imageResourceId`', () async { + // TODO + }); + + // String imageSource + test('to test the property `imageSource`', () async { + // TODO + }); + + // int order + test('to test the property `order`', () async { + // TODO + }); + + + }); + +}