From 45ce7a345e10e2600620ea512623cb1b9539312b Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Thu, 13 May 2021 22:03:00 +0200 Subject: [PATCH] Service generation + data for webDTO and videoDTO + wip slider (reordable list) --- lib/Components/image_input_container.dart | 58 +++- lib/Components/multi_input_modal.dart | 4 +- .../multi_string_input_container.dart | 1 + lib/Components/string_input_container.dart | 4 +- lib/Components/translation_tab.dart | 2 + .../Section/SubSection/listViewcard.dart | 126 +++++++++ .../Section/SubSection/map_config.dart | 0 .../Section/SubSection/menu_config.dart | 0 .../SubSection/new_update_image_slider.dart | 138 ++++++++++ .../Section/SubSection/slider_config.dart | 133 +++++++++ .../Section/SubSection/web_video_config.dart | 45 +++ .../Section/section_detail_screen.dart | 36 ++- .../Resources/fetch_image_for_resource.dart | 4 +- lib/Screens/Resources/resources_screen.dart | 35 ++- .../Resources/select_resource_modal.dart | 24 +- manager_api/.openapi-generator/FILES | 24 ++ manager_api/README.md | 13 + manager_api/doc/GeoPointDTO.md | 22 ++ manager_api/doc/ImageDTO.md | 17 ++ manager_api/doc/MapDTO.md | 18 ++ manager_api/doc/MapType.md | 14 + manager_api/doc/MenuDTO.md | 15 + manager_api/doc/SectionApi.md | 200 ++++++++++++++ manager_api/doc/SliderDTO.md | 15 + manager_api/doc/VideoDTO.md | 15 + manager_api/doc/WebDTO.md | 15 + manager_api/lib/api.dart | 8 + manager_api/lib/api/section_api.dart | 260 ++++++++++++++++++ manager_api/lib/api_client.dart | 17 ++ manager_api/lib/api_helper.dart | 3 + manager_api/lib/model/geo_point_dto.dart | 134 +++++++++ manager_api/lib/model/image_dto.dart | 89 ++++++ manager_api/lib/model/map_dto.dart | 98 +++++++ manager_api/lib/model/map_type.dart | 85 ++++++ manager_api/lib/model/menu_dto.dart | 71 +++++ manager_api/lib/model/slider_dto.dart | 71 +++++ manager_api/lib/model/video_dto.dart | 71 +++++ manager_api/lib/model/web_dto.dart | 71 +++++ manager_api/swagger.yaml | 185 +++++++++++++ manager_api/test/geo_point_dto_test.dart | 61 ++++ manager_api/test/image_dto_test.dart | 36 +++ manager_api/test/map_dto_test.dart | 41 +++ manager_api/test/map_type_test.dart | 20 ++ manager_api/test/menu_dto_test.dart | 26 ++ manager_api/test/slider_dto_test.dart | 26 ++ manager_api/test/video_dto_test.dart | 26 ++ manager_api/test/web_dto_test.dart | 26 ++ pubspec.lock | 7 + pubspec.yaml | 1 + 49 files changed, 2357 insertions(+), 54 deletions(-) create mode 100644 lib/Screens/Configurations/Section/SubSection/listViewcard.dart create mode 100644 lib/Screens/Configurations/Section/SubSection/map_config.dart create mode 100644 lib/Screens/Configurations/Section/SubSection/menu_config.dart create mode 100644 lib/Screens/Configurations/Section/SubSection/new_update_image_slider.dart create mode 100644 lib/Screens/Configurations/Section/SubSection/slider_config.dart create mode 100644 lib/Screens/Configurations/Section/SubSection/web_video_config.dart create mode 100644 manager_api/doc/GeoPointDTO.md create mode 100644 manager_api/doc/ImageDTO.md create mode 100644 manager_api/doc/MapDTO.md create mode 100644 manager_api/doc/MapType.md create mode 100644 manager_api/doc/MenuDTO.md create mode 100644 manager_api/doc/SliderDTO.md create mode 100644 manager_api/doc/VideoDTO.md create mode 100644 manager_api/doc/WebDTO.md create mode 100644 manager_api/lib/model/geo_point_dto.dart create mode 100644 manager_api/lib/model/image_dto.dart create mode 100644 manager_api/lib/model/map_dto.dart create mode 100644 manager_api/lib/model/map_type.dart create mode 100644 manager_api/lib/model/menu_dto.dart create mode 100644 manager_api/lib/model/slider_dto.dart create mode 100644 manager_api/lib/model/video_dto.dart create mode 100644 manager_api/lib/model/web_dto.dart create mode 100644 manager_api/test/geo_point_dto_test.dart create mode 100644 manager_api/test/image_dto_test.dart create mode 100644 manager_api/test/map_dto_test.dart create mode 100644 manager_api/test/map_type_test.dart create mode 100644 manager_api/test/menu_dto_test.dart create mode 100644 manager_api/test/slider_dto_test.dart create mode 100644 manager_api/test/video_dto_test.dart create mode 100644 manager_api/test/web_dto_test.dart diff --git a/lib/Components/image_input_container.dart b/lib/Components/image_input_container.dart index f0ea5a9..db1fc7c 100644 --- a/lib/Components/image_input_container.dart +++ b/lib/Components/image_input_container.dart @@ -1,7 +1,11 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; +import 'package:manager_app/Screens/Resources/fetch_image_for_resource.dart'; +import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:manager_app/Screens/Resources/select_resource_modal.dart'; +import 'package:managerapi/api.dart'; +import 'package:provider/provider.dart'; class ImageInputContainer extends StatefulWidget { final Color color; @@ -48,15 +52,13 @@ class _ImageInputContainerState extends State { showSelectResourceModal( "Sélectionner une ressource", (String resourceId) { - print('ON GET RESULT PARENT INPUT '); widget.onChanged(resourceId); setState(() { - print(resourceId); resourceIdToShow = resourceId; - print('Set State'); }); }, 1, + true, context ); }, @@ -70,10 +72,29 @@ class _ImageInputContainerState extends State { } getElement(String initialValue, BuildContext context) { - print("getElement"); - print(resourceIdToShow); if (resourceIdToShow != null) { - return Text("Show image todo"); + Size size = MediaQuery.of(context).size; + final appContext = Provider.of(context); + return FutureBuilder( + future: getResource(resourceIdToShow, appContext), + builder: (context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.done) { + return Transform.scale( + scale: size.aspectRatio * 0.3, + child: AspectRatio( + aspectRatio: 4/4, + child: Container( + decoration: boxDecoration(snapshot.data, appContext), + ), + ), + ); + } else if (snapshot.connectionState == ConnectionState.none) { + return Text("No data"); + } else { + return Center(child: Container(height: size.height * 0.2, child: Text('LOADING TODO FRAISE'))); + } + } + ); } else { return Container( decoration: BoxDecoration( @@ -93,4 +114,29 @@ class _ImageInputContainerState extends State { ); } } + + Future getResource(String resourceIdToShow, dynamic appContext) async { + ResourceDetailDTO resource = await appContext.getContext().clientAPI.resourceApi.resourceGetDetail(resourceIdToShow); + return resource; + } + + boxDecoration(ResourceDetailDTO resourceDetailDTO, appContext) { + return BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(30.0), + image: new DecorationImage( + fit: BoxFit.cover, + image: new NetworkImage( + resourceDetailDTO.type == ResourceType.image ? appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resourceDetailDTO.id : resourceDetailDTO.data, + ), + ), + boxShadow: [ + BoxShadow( + spreadRadius: 0.5, + blurRadius: 1, + offset: Offset(0, 1.5), // changes position of shadow + ), + ], + ); + } } \ No newline at end of file diff --git a/lib/Components/multi_input_modal.dart b/lib/Components/multi_input_modal.dart index bf46e95..051d6e8 100644 --- a/lib/Components/multi_input_modal.dart +++ b/lib/Components/multi_input_modal.dart @@ -72,7 +72,7 @@ showMultiStringInput (String text, List values, List newValues) { List valuesToShow = new List(); newValues.forEach((newValue) { @@ -87,6 +87,6 @@ showValues(List newValues) { )); }); return valuesToShow; -} +}*/ diff --git a/lib/Components/multi_string_input_container.dart b/lib/Components/multi_string_input_container.dart index 88a1b3e..53a1a1e 100644 --- a/lib/Components/multi_string_input_container.dart +++ b/lib/Components/multi_string_input_container.dart @@ -23,6 +23,7 @@ class MultiStringContainer extends StatelessWidget { @override Widget build(BuildContext context) { + Size size = MediaQuery.of(context).size; return Container( child: Row( diff --git a/lib/Components/string_input_container.dart b/lib/Components/string_input_container.dart index 71aa5d0..775261c 100644 --- a/lib/Components/string_input_container.dart +++ b/lib/Components/string_input_container.dart @@ -7,12 +7,14 @@ class StringInputContainer extends StatelessWidget { final String label; final String initialValue; final ValueChanged onChanged; + final bool isUrl; const StringInputContainer({ Key key, this.color = kSecond, this.label, this.initialValue, this.onChanged, + this.isUrl = false, }) : super(key: key); @override @@ -28,7 +30,7 @@ class StringInputContainer extends StatelessWidget { Padding( padding: const EdgeInsets.all(10.0), child: Container( - width: size.width *0.2, + width: isUrl ? size.width *0.6 : size.width *0.2, child: RoundedInputField( color: kSecond, textColor: kBlack, diff --git a/lib/Components/translation_tab.dart b/lib/Components/translation_tab.dart index 78707c5..36eb37f 100644 --- a/lib/Components/translation_tab.dart +++ b/lib/Components/translation_tab.dart @@ -64,6 +64,8 @@ getContent(List translations, int maxLines) { maxLines: maxLines, initialValue: translation.value, onChanged: (String value) { + print("onChanged value in tranbslationTAB"); + print(value); translation.value = value; }, cursorColor: kPrimaryColor, diff --git a/lib/Screens/Configurations/Section/SubSection/listViewcard.dart b/lib/Screens/Configurations/Section/SubSection/listViewcard.dart new file mode 100644 index 0000000..1d82c2b --- /dev/null +++ b/lib/Screens/Configurations/Section/SubSection/listViewcard.dart @@ -0,0 +1,126 @@ +import 'dart:convert'; + +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 'package:manager_app/app_context.dart'; +import 'package:manager_app/constants.dart'; +import 'package:managerapi/api.dart'; + +class ListViewCard extends StatefulWidget { + final int index; + final Key key; + final List listItems; + final AppContext appContext; + final ValueChanged> onChanged; + + ListViewCard( + this.listItems, + this.index, + this.key, + this.appContext, + this.onChanged + ); + + @override + _ListViewCard createState() => _ListViewCard(); +} + +class _ListViewCard extends State { + @override + Widget build(BuildContext context) { + Size size = MediaQuery.of(context).size; + + return Card( + margin: EdgeInsets.all(4), + color: Colors.white, + child: Container( + width: 200, + height: 200, + child: InkWell( + splashColor: kPrimaryColor, + onTap: () { + print("Item ${widget.listItems[widget.index]} selected."); + showNewOrUpdateImageSlider( + widget.listItems[widget.index], + (value) { + print("get result bébé"); + setState(() { + //List test = new List.from(sliderDTO.images); + + widget.listItems.add(value); + widget.onChanged(widget.listItems); + }); + }, + widget.appContext, + context); + }, + child: Container( + decoration: boxDecoration(widget.listItems[widget.index], widget.appContext), + padding: const EdgeInsets.all(15), + margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15), + child: Align( + alignment: Alignment.center, + child: getElement(widget.listItems[widget.index], size, widget.appContext) + ), + ), + ), + ), + ); + } +} + +getElement(ImageDTO imageDTO, Size size, AppContext appContext) { + if (imageDTO.title != null) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SizedBox( + height: size.width *0.01, + ), + Align( + alignment: Alignment.center, + child: AutoSizeText( + imageDTO.title == null ? "" : imageDTO.title[0].value, + style: new TextStyle(fontSize: 20), + maxLines: 1, + ), + ), + Align( + alignment: Alignment.bottomRight, + child: Text("TODO") + ), + ], + ); + } else { + return Icon( + Icons.add, + color: kTextLightColor, + size: 80.0, + ); + } +} + +boxDecoration(ImageDTO imageDTO, appContext) { + return BoxDecoration( + color: imageDTO.title == null ? Colors.lightGreen : kBackgroundColor, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(30.0), + image: imageDTO.title != null ? new DecorationImage( + fit: BoxFit.cover, + colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.3), BlendMode.dstATop), + image: new NetworkImage( + imageDTO.source_, + ), + ) : 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_config.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/Screens/Configurations/Section/SubSection/menu_config.dart b/lib/Screens/Configurations/Section/SubSection/menu_config.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/Screens/Configurations/Section/SubSection/new_update_image_slider.dart b/lib/Screens/Configurations/Section/SubSection/new_update_image_slider.dart new file mode 100644 index 0000000..ff6fd9f --- /dev/null +++ b/lib/Screens/Configurations/Section/SubSection/new_update_image_slider.dart @@ -0,0 +1,138 @@ +import 'package:manager_app/Components/image_input_container.dart'; +import 'package:manager_app/Components/multi_string_input_container.dart'; +import 'package:flutter/material.dart'; +import 'package:manager_app/Components/rounded_button.dart'; +import 'package:manager_app/Models/managerContext.dart'; +import 'package:manager_app/app_context.dart'; +import 'package:manager_app/constants.dart'; +import 'package:managerapi/api.dart'; + +void showNewOrUpdateImageSlider(ImageDTO inputImageDTO, Function getResult, AppContext appContext, BuildContext context) { + ImageDTO imageDTO = new ImageDTO(); + + if (inputImageDTO.source_ != null) { + print("inputImageDTO.source_ != null NOT NULLLLL"); + imageDTO = inputImageDTO; + } else { + imageDTO.title = new List(); + imageDTO.description = new List(); + + ManagerAppContext managerAppContext = appContext.getContext(); + managerAppContext.selectedConfiguration.languages.forEach((element) { + var translationDTO = new TranslationDTO(); + translationDTO.language = element; + translationDTO.value = ""; + imageDTO.title.add(translationDTO); + imageDTO.description.add(translationDTO); + }); + + } + + print(imageDTO); + + Size size = MediaQuery.of(context).size; + showDialog( + builder: (BuildContext context) => AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(20.0)) + ), + content: Container( + width: size.width *0.5, + child: SingleChildScrollView( + child: Column( + children: [ + Text("Nouvelle image/vidéo", style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400)), + Column( + children: [ + ImageInputContainer( + label: "Image :", + initialValue: imageDTO.source_, + color: kPrimaryColor, + onChanged: (value) { + print("received value in grant older"); + imageDTO.source_ = value; + }, + ), + MultiStringContainer( + label: "Titre :", + color: kPrimaryColor, + initialValue: imageDTO.title, + onGetResult: (value) { + print("Received titres"); + + if (imageDTO.title != value) { + imageDTO.title = value; + } + print(imageDTO.title); + }, + maxLines: 1, + ), + MultiStringContainer( + label: "Description :", + color: kPrimaryColor, + initialValue: imageDTO.description, + onGetResult: (value) { + print("Received descriptions"); + print(value); + if (imageDTO.description != value) { + imageDTO.description = value; + } + print(imageDTO.description); + + }, + maxLines: 1, + ), + ], + ), + ], + ), + ), + ), + actions: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Align( + alignment: AlignmentDirectional.bottomEnd, + child: Container( + width: 175, + height: 70, + child: RoundedButton( + text: "Annuler", + icon: Icons.undo, + color: kSecond, + press: () { + Navigator.of(context).pop(); + }, + fontSize: 20, + ), + ), + ), + Align( + alignment: AlignmentDirectional.bottomEnd, + child: Container( + width: inputImageDTO.source_ != null ? 200: 150, + height: 70, + child: RoundedButton( + text: inputImageDTO.source_ != null ? "Sauvegarder" : "Créer", + icon: Icons.check, + color: kPrimaryColor, + textColor: kWhite, + press: () { + print("TODO create or update"); + print(imageDTO); + getResult(imageDTO); + print("result sent"); + Navigator.of(context).pop(); + }, + fontSize: 20, + ), + ), + ), + ], + ), + ], + ), context: context + ); +} + diff --git a/lib/Screens/Configurations/Section/SubSection/slider_config.dart b/lib/Screens/Configurations/Section/SubSection/slider_config.dart new file mode 100644 index 0000000..735315c --- /dev/null +++ b/lib/Screens/Configurations/Section/SubSection/slider_config.dart @@ -0,0 +1,133 @@ +import 'package:auto_size_text/auto_size_text.dart'; +import 'package:drag_and_drop_lists/drag_and_drop_item.dart'; +import 'package:drag_and_drop_lists/drag_and_drop_list.dart'; +import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:manager_app/Screens/Configurations/Section/SubSection/listViewcard.dart'; +import 'package:manager_app/Screens/Configurations/Section/SubSection/new_update_image_slider.dart'; +import 'package:manager_app/app_context.dart'; +import 'package:manager_app/constants.dart'; +import 'package:managerapi/api.dart'; +import 'dart:convert'; + +import 'package:provider/provider.dart'; + +class SliderConfig extends StatefulWidget { + final String color; + final String label; + final String initialValue; + final ValueChanged onChanged; + const SliderConfig({ + Key key, + this.color, + this.label, + this.initialValue, + this.onChanged, + }) : super(key: key); + + @override + _SliderConfigState createState() => _SliderConfigState(); +} + +class _SliderConfigState extends State { + SliderDTO sliderDTO; + + @override + void initState() { + + + super.initState(); + + sliderDTO = SliderDTO.fromJson(json.decode(widget.initialValue)); + + List test = new List.from(sliderDTO.images); + test.add(ImageDTO(title: null)); + + sliderDTO.images = test; + print(sliderDTO); + } + + @override + Widget build(BuildContext context) { + final appContext = Provider.of(context); + Size size = MediaQuery.of(context).size; + + void _onReorder(int oldIndex, int newIndex) { + setState( + () { + if (newIndex > oldIndex) { + newIndex -= 1; + } + final ImageDTO item = sliderDTO.images.removeAt(oldIndex); + sliderDTO.images.insert(newIndex, item); + }, + ); + } + + return ReorderableListView( + onReorder: _onReorder, + scrollDirection: Axis.horizontal, + padding: const EdgeInsets.symmetric(vertical: 25.0), + children: List.generate( + sliderDTO.images.length, + (index) { + return ListViewCard( + sliderDTO.images, + index, + Key('$index'), + appContext, + (images) { + print(images); + print("ONCHANEGDE"); + + setState(() { + List test = new List.from(images); + sliderDTO.images = test; + List testToSend = new List.from(images); + testToSend = testToSend.where((element) => element.source_ != null).toList(); + var sliderToSend = new SliderDTO(); + sliderToSend.images = testToSend; + widget.onChanged(jsonEncode(sliderToSend).toString()); + }); + } + ); + }, + ), + ); + + return GridView.builder( + shrinkWrap: true, + gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 8), + itemCount: sliderDTO.images.length, + itemBuilder: (BuildContext context, int index) { + return + InkWell( + onTap: () { + // Main screen + showNewOrUpdateImageSlider( + sliderDTO.images[index], + (value) { + print("get result bébé"); + setState(() { + sliderDTO.images.add(value); + widget.onChanged(jsonEncode(sliderDTO).toString()); + }); + }, + appContext, + context); + }, + child: Container( + decoration: boxDecoration(sliderDTO.images[index], appContext), + padding: const EdgeInsets.all(15), + margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15), + child: Align( + alignment: Alignment.center, + child: getElement(sliderDTO.images[index], size, appContext) + ), + ), + ); + } + ); + } +} \ No newline at end of file diff --git a/lib/Screens/Configurations/Section/SubSection/web_video_config.dart b/lib/Screens/Configurations/Section/SubSection/web_video_config.dart new file mode 100644 index 0000000..a7c05cd --- /dev/null +++ b/lib/Screens/Configurations/Section/SubSection/web_video_config.dart @@ -0,0 +1,45 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:manager_app/Components/string_input_container.dart'; +import 'package:managerapi/api.dart'; +import 'dart:convert'; + +class WebOrVideoConfig extends StatefulWidget { + final String color; + final String label; + final String initialValue; + final ValueChanged onChanged; // To return video or web url + const WebOrVideoConfig({ + Key key, + this.color, + this.label, + this.initialValue, + this.onChanged, + }) : super(key: key); + + @override + _WebOrVideoConfigState createState() => _WebOrVideoConfigState(); +} + +class _WebOrVideoConfigState extends State { + WebDTO resourceSource; // WebDTO == VideoDTO + @override + void initState() { + WebDTO test = WebDTO.fromJson(json.decode(widget.initialValue)); + resourceSource = test; + super.initState(); + } + + @override + Widget build(BuildContext context) { + return StringInputContainer( + label: widget.label, + initialValue: resourceSource.source_ == null ? '': resourceSource.source_, + onChanged: (String url) { + resourceSource.source_ = url; + widget.onChanged(jsonEncode(resourceSource).toString()); + }, + isUrl: true, + ); + } +} diff --git a/lib/Screens/Configurations/Section/section_detail_screen.dart b/lib/Screens/Configurations/Section/section_detail_screen.dart index 8354829..6f359af 100644 --- a/lib/Screens/Configurations/Section/section_detail_screen.dart +++ b/lib/Screens/Configurations/Section/section_detail_screen.dart @@ -8,6 +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 'package:manager_app/app_context.dart'; import 'package:manager_app/client.dart'; import 'package:manager_app/constants.dart'; @@ -31,7 +33,7 @@ class _SectionDetailScreenState extends State { final appContext = Provider.of(context); Size size = MediaQuery.of(context).size; - return Container( + return SingleChildScrollView( child: FutureBuilder( future: getSection(widget.id, appContext.getContext().clientAPI), builder: (context, AsyncSnapshot snapshot) { @@ -190,7 +192,18 @@ class _SectionDetailScreenState extends State { ), ), ),// FIELDS SECTION - getSpecificData(sectionDTO, appContext), + Container( + height: size.height * 0.4, + width: size.width * 0.8, + child: Padding( + padding: const EdgeInsets.all(10.0), + child: getSpecificData(sectionDTO, appContext), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(30), + border: Border.all(width: 1.5, color: kSecond) + ), + ), getButtons(sectionDTO, appContext), ], ); @@ -287,11 +300,23 @@ class _SectionDetailScreenState extends State { case SectionType.map: return Text("map"); case SectionType.slider: - return Text("slider"); + return SliderConfig( + initialValue: sectionDTO.data, + onChanged: (String data) { + print("Received info in parent"); + print(data); + sectionDTO.data = data; + }, + ); case SectionType.video: - return Text("video"); case SectionType.web: - return Text("web"); + return WebOrVideoConfig( + label: sectionDTO.type == SectionType.video ? "Url de la vidéo:": "Url du site web:", + initialValue: sectionDTO.data, + onChanged: (String data) { + sectionDTO.data = data; + }, + ); case SectionType.menu: return Text("menu"); } @@ -300,7 +325,6 @@ class _SectionDetailScreenState extends State { Future getSection(String sectionId, Client client) async { SectionDTO section = await client.sectionApi.sectionGetDetail(sectionId); - print("received section"); print(section); return section; } diff --git a/lib/Screens/Resources/fetch_image_for_resource.dart b/lib/Screens/Resources/fetch_image_for_resource.dart index 3e0620b..b869ba5 100644 --- a/lib/Screens/Resources/fetch_image_for_resource.dart +++ b/lib/Screens/Resources/fetch_image_for_resource.dart @@ -2,7 +2,7 @@ import 'package:manager_app/app_context.dart'; import 'package:managerapi/api.dart'; import 'package:flutter/material.dart'; -getImageForResource(ResourceDTO resourceDTO, AppContext appContext) { +getImageForResource(dynamic resourceDTO, AppContext appContext) { switch(resourceDTO.type) { case ResourceType.image: return Image.network( @@ -23,4 +23,4 @@ getImageForResource(ResourceDTO resourceDTO, AppContext appContext) { return Text(resourceDTO.data); break; } -} \ No newline at end of file +} diff --git a/lib/Screens/Resources/resources_screen.dart b/lib/Screens/Resources/resources_screen.dart index 1491748..9604826 100644 --- a/lib/Screens/Resources/resources_screen.dart +++ b/lib/Screens/Resources/resources_screen.dart @@ -8,8 +8,6 @@ import 'package:manager_app/constants.dart'; import 'package:managerapi/api.dart'; import 'package:provider/provider.dart'; -import 'fetch_image_for_resource.dart'; - class ResourcesScreen extends StatefulWidget { final Function onGetResult; final bool isImage; @@ -34,7 +32,7 @@ class _ResourcesScreenState extends State { child: Column( children: [ FutureBuilder( - future: getResources(appContext), + future: getResources(widget.onGetResult, widget.isImage, appContext), builder: (context, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.done) { var tempOutput = new List.from(snapshot.data); @@ -79,7 +77,7 @@ class _ResourcesScreenState extends State { }, child: Container( - decoration: boxDecoration(data[index]), + decoration: boxDecoration(data[index], appContext), padding: const EdgeInsets.all(15), margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15), child: Align( @@ -98,6 +96,9 @@ class _ResourcesScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + SizedBox( + height: size.width *0.01, + ), Align( alignment: Alignment.center, child: AutoSizeText( @@ -106,12 +107,6 @@ class _ResourcesScreenState extends State { maxLines: 1, ), ), - Container( - height: size.height *0.08, - child: Center( - child: getImageForResource(resource, appContext), - ) - ), Align( alignment: Alignment.bottomRight, child: Icon( @@ -132,11 +127,18 @@ class _ResourcesScreenState extends State { } } -boxDecoration(ResourceDTO resourceDTO) { +boxDecoration(dynamic resourceDetailDTO, appContext) { return BoxDecoration( - color: resourceDTO.id == null ? Colors.lightGreen : kTextLightColor, + color: resourceDetailDTO.id == null ? Colors.lightGreen : kBackgroundColor, shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(25.0), + borderRadius: BorderRadius.circular(30.0), + image: resourceDetailDTO.id != null && resourceDetailDTO.type != ResourceType.videoUrl ? new DecorationImage( + fit: BoxFit.cover, + colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.3), BlendMode.dstATop), + image: new NetworkImage( + resourceDetailDTO.type == ResourceType.image ? appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resourceDetailDTO.id : resourceDetailDTO.data, + ), + ) : null, boxShadow: [ BoxShadow( color: kSecond, @@ -148,8 +150,11 @@ boxDecoration(ResourceDTO resourceDTO) { ); } -Future> getResources(dynamic appContext) async { + +Future> getResources(Function onGetResult, bool isImage, dynamic appContext) async { List resources = await appContext.getContext().clientAPI.resourceApi.resourceGet(); - print(resources); + if (onGetResult != null && isImage) { + resources = resources.where((element) => element.type == ResourceType.image || element.type == ResourceType.imageUrl).toList(); + } return resources; } diff --git a/lib/Screens/Resources/select_resource_modal.dart b/lib/Screens/Resources/select_resource_modal.dart index 6f0f3c7..defd645 100644 --- a/lib/Screens/Resources/select_resource_modal.dart +++ b/lib/Screens/Resources/select_resource_modal.dart @@ -5,7 +5,7 @@ import 'package:manager_app/Screens/Resources/resources_screen.dart'; import 'package:manager_app/constants.dart'; import 'package:managerapi/api.dart'; -showSelectResourceModal (String text, Function onGetResult, int maxLines, BuildContext mainContext) { /*Function onSelect,*/ +showSelectResourceModal (String text, Function onGetResult, int maxLines, bool onlyImage, BuildContext mainContext) { /*Function onSelect,*/ Size size = MediaQuery.of(mainContext).size; showDialog( @@ -27,12 +27,9 @@ showSelectResourceModal (String text, Function onGetResult, int maxLines, BuildC Navigator.of(mainContext).pop(); } }, - isImage: true, + isImage: onlyImage, ), ), - /*Column( - children: showValues(newValues), - ),*/ ], ) ), @@ -48,28 +45,11 @@ showSelectResourceModal (String text, Function onGetResult, int maxLines, BuildC icon: Icons.undo, color: kSecond, press: () { - //onGetResult(values); - print("TODO onGetResult"); Navigator.of(context).pop(); }, fontSize: 20, ), ), - /*Container( - width: 180, - height: 70, - child: RoundedButton( - text: "Valider", - icon: Icons.check, - color: kPrimaryColor, - textColor: kWhite, - press: () { - print("TODO Valider resource selected"); - Navigator.of(context).pop(); - }, - fontSize: 20, - ), - ),*/ ], ), ], diff --git a/manager_api/.openapi-generator/FILES b/manager_api/.openapi-generator/FILES index ad09734..3bf1b25 100644 --- a/manager_api/.openapi-generator/FILES +++ b/manager_api/.openapi-generator/FILES @@ -8,7 +8,12 @@ doc/DeviceApi.md doc/DeviceDTO.md doc/DeviceDetailDTO.md doc/DeviceDetailDTOAllOf.md +doc/GeoPointDTO.md +doc/ImageDTO.md doc/LoginDTO.md +doc/MapDTO.md +doc/MapType.md +doc/MenuDTO.md doc/ResourceApi.md doc/ResourceDTO.md doc/ResourceDetailDTO.md @@ -16,11 +21,14 @@ doc/ResourceType.md doc/SectionApi.md doc/SectionDTO.md doc/SectionType.md +doc/SliderDTO.md doc/TokenDTO.md doc/TranslationDTO.md doc/User.md doc/UserApi.md doc/UserDetailDTO.md +doc/VideoDTO.md +doc/WebDTO.md git_push.sh lib/api.dart lib/api/authentication_api.dart @@ -41,14 +49,30 @@ lib/model/configuration_dto.dart lib/model/device_detail_dto.dart 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/login_dto.dart +lib/model/map_dto.dart +lib/model/map_type.dart +lib/model/menu_dto.dart lib/model/resource_detail_dto.dart lib/model/resource_dto.dart lib/model/resource_type.dart lib/model/section_dto.dart lib/model/section_type.dart +lib/model/slider_dto.dart lib/model/token_dto.dart lib/model/translation_dto.dart lib/model/user.dart lib/model/user_detail_dto.dart +lib/model/video_dto.dart +lib/model/web_dto.dart pubspec.yaml +test/geo_point_dto_test.dart +test/image_dto_test.dart +test/map_dto_test.dart +test/map_type_test.dart +test/menu_dto_test.dart +test/slider_dto_test.dart +test/video_dto_test.dart +test/web_dto_test.dart diff --git a/manager_api/README.md b/manager_api/README.md index 177d9d0..8ec8564 100644 --- a/manager_api/README.md +++ b/manager_api/README.md @@ -90,6 +90,11 @@ Class | Method | HTTP request | Description *SectionApi* | [**sectionGetAllSectionSubSections**](doc\/SectionApi.md#sectiongetallsectionsubsections) | **GET** /api/Section/{id}/subsections | *SectionApi* | [**sectionGetDetail**](doc\/SectionApi.md#sectiongetdetail) | **GET** /api/Section/{id} | *SectionApi* | [**sectionGetFromConfiguration**](doc\/SectionApi.md#sectiongetfromconfiguration) | **GET** /api/Section/configuration/{id} | +*SectionApi* | [**sectionGetMapDTO**](doc\/SectionApi.md#sectiongetmapdto) | **GET** /api/Section/MapDTO | +*SectionApi* | [**sectionGetMenuDTO**](doc\/SectionApi.md#sectiongetmenudto) | **GET** /api/Section/MenuDTO | +*SectionApi* | [**sectionGetSliderDTO**](doc\/SectionApi.md#sectiongetsliderdto) | **GET** /api/Section/SliderDTO | +*SectionApi* | [**sectionGetVideoDTO**](doc\/SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO | +*SectionApi* | [**sectionGetWebDTO**](doc\/SectionApi.md#sectiongetwebdto) | **GET** /api/Section/WebDTO | *SectionApi* | [**sectionUpdate**](doc\/SectionApi.md#sectionupdate) | **PUT** /api/Section | *UserApi* | [**userCreateUser**](doc\/UserApi.md#usercreateuser) | **POST** /api/User | *UserApi* | [**userDeleteUser**](doc\/UserApi.md#userdeleteuser) | **DELETE** /api/User/{id} | @@ -104,16 +109,24 @@ Class | Method | HTTP request | Description - [DeviceDTO](doc\/DeviceDTO.md) - [DeviceDetailDTO](doc\/DeviceDetailDTO.md) - [DeviceDetailDTOAllOf](doc\/DeviceDetailDTOAllOf.md) + - [GeoPointDTO](doc\/GeoPointDTO.md) + - [ImageDTO](doc\/ImageDTO.md) - [LoginDTO](doc\/LoginDTO.md) + - [MapDTO](doc\/MapDTO.md) + - [MapType](doc\/MapType.md) + - [MenuDTO](doc\/MenuDTO.md) - [ResourceDTO](doc\/ResourceDTO.md) - [ResourceDetailDTO](doc\/ResourceDetailDTO.md) - [ResourceType](doc\/ResourceType.md) - [SectionDTO](doc\/SectionDTO.md) - [SectionType](doc\/SectionType.md) + - [SliderDTO](doc\/SliderDTO.md) - [TokenDTO](doc\/TokenDTO.md) - [TranslationDTO](doc\/TranslationDTO.md) - [User](doc\/User.md) - [UserDetailDTO](doc\/UserDetailDTO.md) + - [VideoDTO](doc\/VideoDTO.md) + - [WebDTO](doc\/WebDTO.md) ## Documentation For Authorization diff --git a/manager_api/doc/GeoPointDTO.md b/manager_api/doc/GeoPointDTO.md new file mode 100644 index 0000000..115600a --- /dev/null +++ b/manager_api/doc/GeoPointDTO.md @@ -0,0 +1,22 @@ +# managerapi.model.GeoPointDTO + +## Load the model package +```dart +import 'package:managerapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**title** | [**List**](TranslationDTO.md) | | [optional] [default to const []] +**description** | [**List**](TranslationDTO.md) | | [optional] [default to const []] +**image** | **String** | | [optional] +**imageType** | **String** | | [optional] +**text** | [**List**](TranslationDTO.md) | | [optional] [default to const []] +**latitude** | **String** | | [optional] +**longitude** | **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/doc/ImageDTO.md b/manager_api/doc/ImageDTO.md new file mode 100644 index 0000000..9da8ff7 --- /dev/null +++ b/manager_api/doc/ImageDTO.md @@ -0,0 +1,17 @@ +# managerapi.model.ImageDTO + +## Load the model package +```dart +import 'package:managerapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | [**List**](TranslationDTO.md) | | [optional] [default to const []] +**description** | [**List**](TranslationDTO.md) | | [optional] [default to const []] +**source_** | **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/doc/MapDTO.md b/manager_api/doc/MapDTO.md new file mode 100644 index 0000000..6a09f34 --- /dev/null +++ b/manager_api/doc/MapDTO.md @@ -0,0 +1,18 @@ +# managerapi.model.MapDTO + +## Load the model package +```dart +import 'package:managerapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**zoom** | **int** | | [optional] +**mapType** | [**MapType**](MapType.md) | | [optional] +**points** | [**List**](GeoPointDTO.md) | | [optional] [default to const []] +**icon** | **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/doc/MapType.md b/manager_api/doc/MapType.md new file mode 100644 index 0000000..31651b0 --- /dev/null +++ b/manager_api/doc/MapType.md @@ -0,0 +1,14 @@ +# managerapi.model.MapType + +## Load the model package +```dart +import 'package:managerapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/MenuDTO.md b/manager_api/doc/MenuDTO.md new file mode 100644 index 0000000..960de2c --- /dev/null +++ b/manager_api/doc/MenuDTO.md @@ -0,0 +1,15 @@ +# managerapi.model.MenuDTO + +## Load the model package +```dart +import 'package:managerapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sections** | [**List**](SectionDTO.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/doc/SectionApi.md b/manager_api/doc/SectionApi.md index 708bd5a..92c7e9b 100644 --- a/manager_api/doc/SectionApi.md +++ b/manager_api/doc/SectionApi.md @@ -16,6 +16,11 @@ Method | HTTP request | Description [**sectionGetAllSectionSubSections**](SectionApi.md#sectiongetallsectionsubsections) | **GET** /api/Section/{id}/subsections | [**sectionGetDetail**](SectionApi.md#sectiongetdetail) | **GET** /api/Section/{id} | [**sectionGetFromConfiguration**](SectionApi.md#sectiongetfromconfiguration) | **GET** /api/Section/configuration/{id} | +[**sectionGetMapDTO**](SectionApi.md#sectiongetmapdto) | **GET** /api/Section/MapDTO | +[**sectionGetMenuDTO**](SectionApi.md#sectiongetmenudto) | **GET** /api/Section/MenuDTO | +[**sectionGetSliderDTO**](SectionApi.md#sectiongetsliderdto) | **GET** /api/Section/SliderDTO | +[**sectionGetVideoDTO**](SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO | +[**sectionGetWebDTO**](SectionApi.md#sectiongetwebdto) | **GET** /api/Section/WebDTO | [**sectionUpdate**](SectionApi.md#sectionupdate) | **PUT** /api/Section | @@ -316,6 +321,201 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **sectionGetMapDTO** +> MapDTO sectionGetMapDTO() + + + +### Example +```dart +import 'package:managerapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = SectionApi(); + +try { + final result = api_instance.sectionGetMapDTO(); + print(result); +} catch (e) { + print('Exception when calling SectionApi->sectionGetMapDTO: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**MapDTO**](MapDTO.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **sectionGetMenuDTO** +> MenuDTO sectionGetMenuDTO() + + + +### Example +```dart +import 'package:managerapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = SectionApi(); + +try { + final result = api_instance.sectionGetMenuDTO(); + print(result); +} catch (e) { + print('Exception when calling SectionApi->sectionGetMenuDTO: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**MenuDTO**](MenuDTO.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **sectionGetSliderDTO** +> SliderDTO sectionGetSliderDTO() + + + +### Example +```dart +import 'package:managerapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = SectionApi(); + +try { + final result = api_instance.sectionGetSliderDTO(); + print(result); +} catch (e) { + print('Exception when calling SectionApi->sectionGetSliderDTO: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**SliderDTO**](SliderDTO.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **sectionGetVideoDTO** +> VideoDTO sectionGetVideoDTO() + + + +### Example +```dart +import 'package:managerapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = SectionApi(); + +try { + final result = api_instance.sectionGetVideoDTO(); + print(result); +} catch (e) { + print('Exception when calling SectionApi->sectionGetVideoDTO: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**VideoDTO**](VideoDTO.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **sectionGetWebDTO** +> WebDTO sectionGetWebDTO() + + + +### Example +```dart +import 'package:managerapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = SectionApi(); + +try { + final result = api_instance.sectionGetWebDTO(); + print(result); +} catch (e) { + print('Exception when calling SectionApi->sectionGetWebDTO: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**WebDTO**](WebDTO.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **sectionUpdate** > SectionDTO sectionUpdate(sectionDTO) diff --git a/manager_api/doc/SliderDTO.md b/manager_api/doc/SliderDTO.md new file mode 100644 index 0000000..a5df1e8 --- /dev/null +++ b/manager_api/doc/SliderDTO.md @@ -0,0 +1,15 @@ +# managerapi.model.SliderDTO + +## Load the model package +```dart +import 'package:managerapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**images** | [**List**](ImageDTO.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/doc/VideoDTO.md b/manager_api/doc/VideoDTO.md new file mode 100644 index 0000000..08c8315 --- /dev/null +++ b/manager_api/doc/VideoDTO.md @@ -0,0 +1,15 @@ +# managerapi.model.VideoDTO + +## Load the model package +```dart +import 'package:managerapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**source_** | **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/doc/WebDTO.md b/manager_api/doc/WebDTO.md new file mode 100644 index 0000000..3b26ea1 --- /dev/null +++ b/manager_api/doc/WebDTO.md @@ -0,0 +1,15 @@ +# managerapi.model.WebDTO + +## Load the model package +```dart +import 'package:managerapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**source_** | **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/lib/api.dart b/manager_api/lib/api.dart index 6e419e0..627f917 100644 --- a/manager_api/lib/api.dart +++ b/manager_api/lib/api.dart @@ -38,16 +38,24 @@ part 'model/configuration_dto.dart'; part 'model/device_dto.dart'; 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/login_dto.dart'; +part 'model/map_dto.dart'; +part 'model/map_type.dart'; +part 'model/menu_dto.dart'; part 'model/resource_dto.dart'; part 'model/resource_detail_dto.dart'; part 'model/resource_type.dart'; part 'model/section_dto.dart'; part 'model/section_type.dart'; +part 'model/slider_dto.dart'; part 'model/token_dto.dart'; part 'model/translation_dto.dart'; part 'model/user.dart'; part 'model/user_detail_dto.dart'; +part 'model/video_dto.dart'; +part 'model/web_dto.dart'; const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; diff --git a/manager_api/lib/api/section_api.dart b/manager_api/lib/api/section_api.dart index b074edd..4bfe7e8 100644 --- a/manager_api/lib/api/section_api.dart +++ b/manager_api/lib/api/section_api.dart @@ -456,6 +456,266 @@ class SectionApi { return Future>.value(null); } + /// Performs an HTTP 'GET /api/Section/MapDTO' operation and returns the [Response]. + Future sectionGetMapDTOWithHttpInfo() async { + final path = r'/api/Section/MapDTO'; + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + Future sectionGetMapDTO() async { + final response = await sectionGetMapDTOWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'MapDTO') as MapDTO; + } + return Future.value(null); + } + + /// Performs an HTTP 'GET /api/Section/MenuDTO' operation and returns the [Response]. + Future sectionGetMenuDTOWithHttpInfo() async { + final path = r'/api/Section/MenuDTO'; + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + Future sectionGetMenuDTO() async { + final response = await sectionGetMenuDTOWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'MenuDTO') as MenuDTO; + } + return Future.value(null); + } + + /// Performs an HTTP 'GET /api/Section/SliderDTO' operation and returns the [Response]. + Future sectionGetSliderDTOWithHttpInfo() async { + final path = r'/api/Section/SliderDTO'; + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + Future sectionGetSliderDTO() async { + final response = await sectionGetSliderDTOWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'SliderDTO') as SliderDTO; + } + return Future.value(null); + } + + /// Performs an HTTP 'GET /api/Section/VideoDTO' operation and returns the [Response]. + Future sectionGetVideoDTOWithHttpInfo() async { + final path = r'/api/Section/VideoDTO'; + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + Future sectionGetVideoDTO() async { + final response = await sectionGetVideoDTOWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'VideoDTO') as VideoDTO; + } + return Future.value(null); + } + + /// Performs an HTTP 'GET /api/Section/WebDTO' operation and returns the [Response]. + Future sectionGetWebDTOWithHttpInfo() async { + final path = r'/api/Section/WebDTO'; + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + Future sectionGetWebDTO() async { + final response = await sectionGetWebDTOWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'WebDTO') as WebDTO; + } + return Future.value(null); + } + /// Performs an HTTP 'PUT /api/Section' operation and returns the [Response]. /// Parameters: /// diff --git a/manager_api/lib/api_client.dart b/manager_api/lib/api_client.dart index 82cea5c..d0ff727 100644 --- a/manager_api/lib/api_client.dart +++ b/manager_api/lib/api_client.dart @@ -164,8 +164,19 @@ class ApiClient { return DeviceDetailDTO.fromJson(value); case 'DeviceDetailDTOAllOf': return DeviceDetailDTOAllOf.fromJson(value); + case 'GeoPointDTO': + return GeoPointDTO.fromJson(value); + case 'ImageDTO': + return ImageDTO.fromJson(value); case 'LoginDTO': return LoginDTO.fromJson(value); + case 'MapDTO': + return MapDTO.fromJson(value); + case 'MapType': + return MapTypeTypeTransformer().decode(value); + + case 'MenuDTO': + return MenuDTO.fromJson(value); case 'ResourceDTO': return ResourceDTO.fromJson(value); case 'ResourceDetailDTO': @@ -178,6 +189,8 @@ class ApiClient { case 'SectionType': return SectionTypeTypeTransformer().decode(value); + case 'SliderDTO': + return SliderDTO.fromJson(value); case 'TokenDTO': return TokenDTO.fromJson(value); case 'TranslationDTO': @@ -186,6 +199,10 @@ class ApiClient { return User.fromJson(value); case 'UserDetailDTO': return UserDetailDTO.fromJson(value); + case 'VideoDTO': + return VideoDTO.fromJson(value); + case 'WebDTO': + return WebDTO.fromJson(value); default: Match match; if (value is List && (match = _regList.firstMatch(targetType)) != null) { diff --git a/manager_api/lib/api_helper.dart b/manager_api/lib/api_helper.dart index c443313..563f194 100644 --- a/manager_api/lib/api_helper.dart +++ b/manager_api/lib/api_helper.dart @@ -58,6 +58,9 @@ String parameterToString(dynamic value) { if (value is DateTime) { return value.toUtc().toIso8601String(); } + if (value is MapType) { + return MapTypeTypeTransformer().encode(value).toString(); + } if (value is ResourceType) { return ResourceTypeTypeTransformer().encode(value).toString(); } diff --git a/manager_api/lib/model/geo_point_dto.dart b/manager_api/lib/model/geo_point_dto.dart new file mode 100644 index 0000000..985e070 --- /dev/null +++ b/manager_api/lib/model/geo_point_dto.dart @@ -0,0 +1,134 @@ +// +// 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 GeoPointDTO { + /// Returns a new [GeoPointDTO] instance. + GeoPointDTO({ + this.id, + this.title, + this.description, + this.image, + this.imageType, + this.text, + this.latitude, + this.longitude, + }); + + int id; + + List title; + + List description; + + String image; + + String imageType; + + List text; + + String latitude; + + String longitude; + + @override + bool operator ==(Object other) => identical(this, other) || other is GeoPointDTO && + other.id == id && + other.title == title && + other.description == description && + other.image == image && + other.imageType == imageType && + other.text == text && + other.latitude == latitude && + other.longitude == longitude; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (title == null ? 0 : title.hashCode) + + (description == null ? 0 : description.hashCode) + + (image == null ? 0 : image.hashCode) + + (imageType == null ? 0 : imageType.hashCode) + + (text == null ? 0 : text.hashCode) + + (latitude == null ? 0 : latitude.hashCode) + + (longitude == null ? 0 : longitude.hashCode); + + @override + String toString() => 'GeoPointDTO[id=$id, title=$title, description=$description, image=$image, imageType=$imageType, text=$text, latitude=$latitude, longitude=$longitude]'; + + Map toJson() { + final json = {}; + if (id != null) { + json[r'id'] = id; + } + if (title != null) { + json[r'title'] = title; + } + if (description != null) { + json[r'description'] = description; + } + if (image != null) { + json[r'image'] = image; + } + if (imageType != null) { + json[r'imageType'] = imageType; + } + if (text != null) { + json[r'text'] = text; + } + if (latitude != null) { + json[r'latitude'] = latitude; + } + if (longitude != null) { + json[r'longitude'] = longitude; + } + return json; + } + + /// Returns a new [GeoPointDTO] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static GeoPointDTO fromJson(Map json) => json == null + ? null + : GeoPointDTO( + id: json[r'id'], + title: TranslationDTO.listFromJson(json[r'title']), + description: TranslationDTO.listFromJson(json[r'description']), + image: json[r'image'], + imageType: json[r'imageType'], + text: TranslationDTO.listFromJson(json[r'text']), + latitude: json[r'latitude'], + longitude: json[r'longitude'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => GeoPointDTO.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] = GeoPointDTO.fromJson(v)); + } + return map; + } + + // maps a json object with a list of GeoPointDTO-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] = GeoPointDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/manager_api/lib/model/image_dto.dart b/manager_api/lib/model/image_dto.dart new file mode 100644 index 0000000..1949a98 --- /dev/null +++ b/manager_api/lib/model/image_dto.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 ImageDTO { + /// Returns a new [ImageDTO] instance. + ImageDTO({ + this.title, + this.description, + this.source_, + }); + + List title; + + List description; + + String source_; + + @override + bool operator ==(Object other) => identical(this, other) || other is ImageDTO && + other.title == title && + other.description == description && + other.source_ == source_; + + @override + int get hashCode => + (title == null ? 0 : title.hashCode) + + (description == null ? 0 : description.hashCode) + + (source_ == null ? 0 : source_.hashCode); + + @override + String toString() => 'ImageDTO[title=$title, description=$description, source_=$source_]'; + + Map toJson() { + final json = {}; + if (title != null) { + json[r'title'] = title; + } + if (description != null) { + json[r'description'] = description; + } + if (source_ != null) { + json[r'source'] = source_; + } + return json; + } + + /// Returns a new [ImageDTO] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static ImageDTO fromJson(Map json) => json == null + ? null + : ImageDTO( + title: TranslationDTO.listFromJson(json[r'title']), + description: TranslationDTO.listFromJson(json[r'description']), + source_: json[r'source'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => ImageDTO.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] = ImageDTO.fromJson(v)); + } + return map; + } + + // maps a json object with a list of ImageDTO-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] = ImageDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/manager_api/lib/model/map_dto.dart b/manager_api/lib/model/map_dto.dart new file mode 100644 index 0000000..ed2c20e --- /dev/null +++ b/manager_api/lib/model/map_dto.dart @@ -0,0 +1,98 @@ +// +// 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 MapDTO { + /// Returns a new [MapDTO] instance. + MapDTO({ + this.zoom, + this.mapType, + this.points, + this.icon, + }); + + int zoom; + + MapType mapType; + + List points; + + String icon; + + @override + bool operator ==(Object other) => identical(this, other) || other is MapDTO && + other.zoom == zoom && + other.mapType == mapType && + other.points == points && + other.icon == icon; + + @override + int get hashCode => + (zoom == null ? 0 : zoom.hashCode) + + (mapType == null ? 0 : mapType.hashCode) + + (points == null ? 0 : points.hashCode) + + (icon == null ? 0 : icon.hashCode); + + @override + String toString() => 'MapDTO[zoom=$zoom, mapType=$mapType, points=$points, icon=$icon]'; + + Map toJson() { + final json = {}; + if (zoom != null) { + json[r'zoom'] = zoom; + } + if (mapType != null) { + json[r'mapType'] = mapType; + } + if (points != null) { + json[r'points'] = points; + } + if (icon != null) { + json[r'icon'] = icon; + } + return json; + } + + /// Returns a new [MapDTO] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static MapDTO fromJson(Map json) => json == null + ? null + : MapDTO( + zoom: json[r'zoom'], + mapType: MapType.fromJson(json[r'mapType']), + points: GeoPointDTO.listFromJson(json[r'points']), + icon: json[r'icon'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => MapDTO.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] = MapDTO.fromJson(v)); + } + return map; + } + + // maps a json object with a list of MapDTO-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] = MapDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/manager_api/lib/model/map_type.dart b/manager_api/lib/model/map_type.dart new file mode 100644 index 0000000..e59e94b --- /dev/null +++ b/manager_api/lib/model/map_type.dart @@ -0,0 +1,85 @@ +// +// 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 MapType { + /// Instantiate a new enum with the provided [value]. + const MapType._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const none = MapType._(r'none'); + static const normal = MapType._(r'normal'); + static const satellite = MapType._(r'satellite'); + static const terrain = MapType._(r'terrain'); + static const hybrid = MapType._(r'hybrid'); + + /// List of all possible values in this [enum][MapType]. + static const values = [ + none, + normal, + satellite, + terrain, + hybrid, + ]; + + static MapType fromJson(dynamic value) => + MapTypeTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => MapType.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [MapType] to String, +/// and [decode] dynamic data back to [MapType]. +class MapTypeTypeTransformer { + const MapTypeTypeTransformer._(); + + factory MapTypeTypeTransformer() => _instance ??= MapTypeTypeTransformer._(); + + String encode(MapType data) => data.value; + + /// Decodes a [dynamic value][data] to a MapType. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// 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. + MapType decode(dynamic data, {bool allowNull}) { + switch (data) { + case r'none': return MapType.none; + case r'normal': return MapType.normal; + case r'satellite': return MapType.satellite; + case r'terrain': return MapType.terrain; + case r'hybrid': return MapType.hybrid; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [MapTypeTypeTransformer] instance. + static MapTypeTypeTransformer _instance; +} diff --git a/manager_api/lib/model/menu_dto.dart b/manager_api/lib/model/menu_dto.dart new file mode 100644 index 0000000..bcde011 --- /dev/null +++ b/manager_api/lib/model/menu_dto.dart @@ -0,0 +1,71 @@ +// +// 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 MenuDTO { + /// Returns a new [MenuDTO] instance. + MenuDTO({ + this.sections, + }); + + List sections; + + @override + bool operator ==(Object other) => identical(this, other) || other is MenuDTO && + other.sections == sections; + + @override + int get hashCode => + (sections == null ? 0 : sections.hashCode); + + @override + String toString() => 'MenuDTO[sections=$sections]'; + + Map toJson() { + final json = {}; + if (sections != null) { + json[r'sections'] = sections; + } + return json; + } + + /// Returns a new [MenuDTO] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static MenuDTO fromJson(Map json) => json == null + ? null + : MenuDTO( + sections: SectionDTO.listFromJson(json[r'sections']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => MenuDTO.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] = MenuDTO.fromJson(v)); + } + return map; + } + + // maps a json object with a list of MenuDTO-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] = MenuDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/manager_api/lib/model/slider_dto.dart b/manager_api/lib/model/slider_dto.dart new file mode 100644 index 0000000..fd714c7 --- /dev/null +++ b/manager_api/lib/model/slider_dto.dart @@ -0,0 +1,71 @@ +// +// 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 SliderDTO { + /// Returns a new [SliderDTO] instance. + SliderDTO({ + this.images, + }); + + List images; + + @override + bool operator ==(Object other) => identical(this, other) || other is SliderDTO && + other.images == images; + + @override + int get hashCode => + (images == null ? 0 : images.hashCode); + + @override + String toString() => 'SliderDTO[images=$images]'; + + Map toJson() { + final json = {}; + if (images != null) { + json[r'images'] = images; + } + return json; + } + + /// Returns a new [SliderDTO] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static SliderDTO fromJson(Map json) => json == null + ? null + : SliderDTO( + images: ImageDTO.listFromJson(json[r'images']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => SliderDTO.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] = SliderDTO.fromJson(v)); + } + return map; + } + + // maps a json object with a list of SliderDTO-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] = SliderDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/manager_api/lib/model/video_dto.dart b/manager_api/lib/model/video_dto.dart new file mode 100644 index 0000000..339d04b --- /dev/null +++ b/manager_api/lib/model/video_dto.dart @@ -0,0 +1,71 @@ +// +// 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 VideoDTO { + /// Returns a new [VideoDTO] instance. + VideoDTO({ + this.source_, + }); + + String source_; + + @override + bool operator ==(Object other) => identical(this, other) || other is VideoDTO && + other.source_ == source_; + + @override + int get hashCode => + (source_ == null ? 0 : source_.hashCode); + + @override + String toString() => 'VideoDTO[source_=$source_]'; + + Map toJson() { + final json = {}; + if (source_ != null) { + json[r'source'] = source_; + } + return json; + } + + /// Returns a new [VideoDTO] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static VideoDTO fromJson(Map json) => json == null + ? null + : VideoDTO( + source_: json[r'source'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => VideoDTO.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] = VideoDTO.fromJson(v)); + } + return map; + } + + // maps a json object with a list of VideoDTO-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] = VideoDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/manager_api/lib/model/web_dto.dart b/manager_api/lib/model/web_dto.dart new file mode 100644 index 0000000..5dc905b --- /dev/null +++ b/manager_api/lib/model/web_dto.dart @@ -0,0 +1,71 @@ +// +// 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 WebDTO { + /// Returns a new [WebDTO] instance. + WebDTO({ + this.source_, + }); + + String source_; + + @override + bool operator ==(Object other) => identical(this, other) || other is WebDTO && + other.source_ == source_; + + @override + int get hashCode => + (source_ == null ? 0 : source_.hashCode); + + @override + String toString() => 'WebDTO[source_=$source_]'; + + Map toJson() { + final json = {}; + if (source_ != null) { + json[r'source'] = source_; + } + return json; + } + + /// Returns a new [WebDTO] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static WebDTO fromJson(Map json) => json == null + ? null + : WebDTO( + source_: json[r'source'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => WebDTO.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] = WebDTO.fromJson(v)); + } + return map; + } + + // maps a json object with a list of WebDTO-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] = WebDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/manager_api/swagger.yaml b/manager_api/swagger.yaml index 52b1742..a7f5910 100644 --- a/manager_api/swagger.yaml +++ b/manager_api/swagger.yaml @@ -864,6 +864,76 @@ paths: type: string security: - bearer: [] + /api/Section/MapDTO: + get: + tags: + - Section + operationId: Section_GetMapDTO + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/MapDTO' + security: + - bearer: [] + /api/Section/SliderDTO: + get: + tags: + - Section + operationId: Section_GetSliderDTO + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/SliderDTO' + security: + - bearer: [] + /api/Section/VideoDTO: + get: + tags: + - Section + operationId: Section_GetVideoDTO + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/VideoDTO' + security: + - bearer: [] + /api/Section/WebDTO: + get: + tags: + - Section + operationId: Section_GetWebDTO + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/WebDTO' + security: + - bearer: [] + /api/Section/MenuDTO: + get: + tags: + - Section + operationId: Section_GetMenuDTO + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/MenuDTO' + security: + - bearer: [] /api/User: get: tags: @@ -1291,6 +1361,121 @@ components: - Video - Web - Menu + MapDTO: + type: object + additionalProperties: false + properties: + zoom: + type: integer + format: int32 + mapType: + $ref: '#/components/schemas/MapType' + points: + type: array + nullable: true + items: + $ref: '#/components/schemas/GeoPointDTO' + icon: + type: string + nullable: true + MapType: + type: string + description: '' + x-enumNames: + - none + - normal + - satellite + - terrain + - hybrid + enum: + - none + - normal + - satellite + - terrain + - hybrid + GeoPointDTO: + type: object + additionalProperties: false + properties: + id: + type: integer + format: int32 + title: + type: array + nullable: true + items: + $ref: '#/components/schemas/TranslationDTO' + description: + type: array + nullable: true + items: + $ref: '#/components/schemas/TranslationDTO' + image: + type: string + nullable: true + imageType: + type: string + nullable: true + text: + type: array + nullable: true + items: + $ref: '#/components/schemas/TranslationDTO' + latitude: + type: string + nullable: true + longitude: + type: string + nullable: true + SliderDTO: + type: object + additionalProperties: false + properties: + images: + type: array + nullable: true + items: + $ref: '#/components/schemas/ImageDTO' + ImageDTO: + type: object + additionalProperties: false + properties: + title: + type: array + nullable: true + items: + $ref: '#/components/schemas/TranslationDTO' + description: + type: array + nullable: true + items: + $ref: '#/components/schemas/TranslationDTO' + source: + type: string + nullable: true + VideoDTO: + type: object + additionalProperties: false + properties: + source: + type: string + nullable: true + WebDTO: + type: object + additionalProperties: false + properties: + source: + type: string + nullable: true + MenuDTO: + type: object + additionalProperties: false + properties: + sections: + type: array + nullable: true + items: + $ref: '#/components/schemas/SectionDTO' User: type: object additionalProperties: false diff --git a/manager_api/test/geo_point_dto_test.dart b/manager_api/test/geo_point_dto_test.dart new file mode 100644 index 0000000..68ccd1d --- /dev/null +++ b/manager_api/test/geo_point_dto_test.dart @@ -0,0 +1,61 @@ +// +// 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 GeoPointDTO +void main() { + final instance = GeoPointDTO(); + + group('test GeoPointDTO', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // List title (default value: const []) + test('to test the property `title`', () async { + // TODO + }); + + // List description (default value: const []) + test('to test the property `description`', () async { + // TODO + }); + + // String image + test('to test the property `image`', () async { + // TODO + }); + + // String imageType + test('to test the property `imageType`', () async { + // TODO + }); + + // List text (default value: const []) + test('to test the property `text`', () async { + // TODO + }); + + // String latitude + test('to test the property `latitude`', () async { + // TODO + }); + + // String longitude + test('to test the property `longitude`', () async { + // TODO + }); + + + }); + +} diff --git a/manager_api/test/image_dto_test.dart b/manager_api/test/image_dto_test.dart new file mode 100644 index 0000000..5972183 --- /dev/null +++ b/manager_api/test/image_dto_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 ImageDTO +void main() { + final instance = ImageDTO(); + + group('test ImageDTO', () { + // List title (default value: const []) + test('to test the property `title`', () async { + // TODO + }); + + // List description (default value: const []) + test('to test the property `description`', () async { + // TODO + }); + + // String source_ + test('to test the property `source_`', () async { + // TODO + }); + + + }); + +} diff --git a/manager_api/test/map_dto_test.dart b/manager_api/test/map_dto_test.dart new file mode 100644 index 0000000..ffd4b49 --- /dev/null +++ b/manager_api/test/map_dto_test.dart @@ -0,0 +1,41 @@ +// +// 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 MapDTO +void main() { + final instance = MapDTO(); + + group('test MapDTO', () { + // int zoom + test('to test the property `zoom`', () async { + // TODO + }); + + // MapType mapType + test('to test the property `mapType`', () async { + // TODO + }); + + // List points (default value: const []) + test('to test the property `points`', () async { + // TODO + }); + + // String icon + test('to test the property `icon`', () async { + // TODO + }); + + + }); + +} diff --git a/manager_api/test/map_type_test.dart b/manager_api/test/map_type_test.dart new file mode 100644 index 0000000..45cc587 --- /dev/null +++ b/manager_api/test/map_type_test.dart @@ -0,0 +1,20 @@ +// +// 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 MapType +void main() { + + group('test MapType', () { + + }); + +} diff --git a/manager_api/test/menu_dto_test.dart b/manager_api/test/menu_dto_test.dart new file mode 100644 index 0000000..9414c07 --- /dev/null +++ b/manager_api/test/menu_dto_test.dart @@ -0,0 +1,26 @@ +// +// 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 MenuDTO +void main() { + final instance = MenuDTO(); + + group('test MenuDTO', () { + // List sections (default value: const []) + test('to test the property `sections`', () async { + // TODO + }); + + + }); + +} diff --git a/manager_api/test/slider_dto_test.dart b/manager_api/test/slider_dto_test.dart new file mode 100644 index 0000000..19da350 --- /dev/null +++ b/manager_api/test/slider_dto_test.dart @@ -0,0 +1,26 @@ +// +// 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 SliderDTO +void main() { + final instance = SliderDTO(); + + group('test SliderDTO', () { + // List images (default value: const []) + test('to test the property `images`', () async { + // TODO + }); + + + }); + +} diff --git a/manager_api/test/video_dto_test.dart b/manager_api/test/video_dto_test.dart new file mode 100644 index 0000000..ac0e810 --- /dev/null +++ b/manager_api/test/video_dto_test.dart @@ -0,0 +1,26 @@ +// +// 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 VideoDTO +void main() { + final instance = VideoDTO(); + + group('test VideoDTO', () { + // String source_ + test('to test the property `source_`', () async { + // TODO + }); + + + }); + +} diff --git a/manager_api/test/web_dto_test.dart b/manager_api/test/web_dto_test.dart new file mode 100644 index 0000000..cdbc614 --- /dev/null +++ b/manager_api/test/web_dto_test.dart @@ -0,0 +1,26 @@ +// +// 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 WebDTO +void main() { + final instance = WebDTO(); + + group('test WebDTO', () { + // String source_ + test('to test the property `source_`', () async { + // TODO + }); + + + }); + +} diff --git a/pubspec.lock b/pubspec.lock index a410f63..2bbd576 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -78,6 +78,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.0.6" + drag_and_drop_lists: + dependency: "direct main" + description: + name: drag_and_drop_lists + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.2" fake_async: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 497f46d..41c0da2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -35,6 +35,7 @@ dependencies: filepicker_windows: ^2.0.0 dart_vlc: ^0.0.6 video_player: ^2.1.1 + drag_and_drop_lists: ^0.3.2 managerapi: path: manager_api