diff --git a/lib/Components/fetch_section_icon.dart b/lib/Components/fetch_section_icon.dart index e5fafad..8eeb996 100644 --- a/lib/Components/fetch_section_icon.dart +++ b/lib/Components/fetch_section_icon.dart @@ -5,25 +5,24 @@ IconData getSectionIcon(elementType) { switch(elementType) { case SectionType.Map: return Icons.location_on; - break; case SectionType.Slider: return Icons.collections; // art_track - break; case SectionType.Video: return Icons.ondemand_video_rounded; - break; case SectionType.Web: return Icons.web; - break; case SectionType.Menu: return Icons.apps_sharp; - break; case SectionType.Quizz: return Icons.question_answer; - break; case SectionType.Article: return Icons.article_outlined; - break; + case SectionType.Pdf: + return Icons.picture_as_pdf_outlined; + case SectionType.Puzzle: + return Icons.extension; + case SectionType.Agenda: + return Icons.calendar_month_outlined; } - return Icons.menu; + return Icons.question_mark; } \ No newline at end of file diff --git a/lib/Components/multi_select_container.dart b/lib/Components/multi_select_container.dart index 2e6a0d3..6097b8b 100644 --- a/lib/Components/multi_select_container.dart +++ b/lib/Components/multi_select_container.dart @@ -35,7 +35,7 @@ class MultiSelectContainer extends StatelessWidget { Padding( padding: const EdgeInsets.all(10.0), child: Container( - width: size.width *0.2, + width: size.width *0.25, child: MultiSelectChip( values, initialValue, diff --git a/lib/Components/multi_string_input_container.dart b/lib/Components/multi_string_input_container.dart index 8c2b9e4..5215c84 100644 --- a/lib/Components/multi_string_input_container.dart +++ b/lib/Components/multi_string_input_container.dart @@ -67,7 +67,7 @@ class MultiStringInputContainer extends StatelessWidget { newValues.add(TranslationDTO.fromJson(jsonDecode(jsonEncode(initials.firstWhere((element) => element.language == value)))!)!); } else { // New language - newValues.add(TranslationDTO(language: value, value: null)); + newValues.add(TranslationDTO(language: value, value: "")); } }); diff --git a/lib/Components/resource_input_container.dart b/lib/Components/resource_input_container.dart index 9446d5c..4774552 100644 --- a/lib/Components/resource_input_container.dart +++ b/lib/Components/resource_input_container.dart @@ -101,8 +101,15 @@ class _ResourceInputContainerState extends State { builder: (context, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.done) { if (snapshot.data != null) { + ResourceDTO resourceDTO = snapshot.data!; return Container( decoration: boxDecoration(snapshot.data, appContext), + child: Center( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text(resourceDTO.type == ResourceType.Image || resourceDTO.type == ResourceType.ImageUrl ? "" : resourceDTO.label!), + ), + ) ); } else { return Center( @@ -110,7 +117,7 @@ class _ResourceInputContainerState extends State { decoration: boxDecoration(null, appContext), child: Padding( padding: const EdgeInsets.all(8.0), - child: Text("Aucune image"), + child: Text("Aucune ressource"), ) ) ); @@ -158,7 +165,7 @@ class _ResourceInputContainerState extends State { shape: BoxShape.rectangle, color: kWhite, borderRadius: BorderRadius.circular(30.0), - image: resourceDTO != null ? resourceDTO.type != null ? new DecorationImage( + image: resourceDTO != null ? resourceDTO.type != null && (resourceDTO.type == ResourceType.Image || resourceDTO.type == ResourceType.ImageUrl)? new DecorationImage( fit: widget.imageFit, image: new NetworkImage( resourceDTO.url!, // TODO handle multiple type of content diff --git a/lib/Components/string_input_container.dart b/lib/Components/string_input_container.dart index 47b8a93..8917adf 100644 --- a/lib/Components/string_input_container.dart +++ b/lib/Components/string_input_container.dart @@ -44,7 +44,7 @@ class StringInputContainer extends StatelessWidget { ), ), Padding( - padding: const EdgeInsets.all(10.0), + padding: const EdgeInsets.all(8.0), child: Container( width: isUrl ? size.width *0.6 : isSmall ? size.width *0.1 : size.width *0.25, child: RoundedInputField( diff --git a/lib/Components/translation_input_container.dart b/lib/Components/translation_input_container.dart index d17ea85..d189f90 100644 --- a/lib/Components/translation_input_container.dart +++ b/lib/Components/translation_input_container.dart @@ -83,7 +83,7 @@ class _TranslationInputContainerState extends State w height: widget.isTitle ? MediaQuery.of(context).size.height *0.13 : MediaQuery.of(context).size.height *0.35, child: QuillHtmlEditor( text: newValues.where((element) => element.language! == currentLanguage.value).first.value!, - //hintText: 'Hint text goes here', + hintText: '', controller: controllerQuill, minHeight: widget.isTitle ? 80 : 240, /*textStyle: _editorTextStyle, diff --git a/lib/Screens/Configurations/Section/SubSection/Agenda/agenda_config.dart b/lib/Screens/Configurations/Section/SubSection/Agenda/agenda_config.dart new file mode 100644 index 0000000..7038277 --- /dev/null +++ b/lib/Screens/Configurations/Section/SubSection/Agenda/agenda_config.dart @@ -0,0 +1,47 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:manager_app/Components/resource_input_container.dart'; +import 'package:manager_api_new/api.dart'; +import 'dart:convert'; + +class AgendaConfig extends StatefulWidget { + final String? color; + final String? label; + final String initialValue; + final ValueChanged onChanged; + const AgendaConfig({ + Key? key, + this.color, + this.label, + required this.initialValue, + required this.onChanged, + }) : super(key: key); + + @override + _AgendaConfigState createState() => _AgendaConfigState(); +} + +class _AgendaConfigState extends State { + late AgendaDTO agendaDTO; + + @override + void initState() { + AgendaDTO test = AgendaDTO.fromJson(json.decode(widget.initialValue))!; + agendaDTO = test; + super.initState(); + } + + @override + Widget build(BuildContext context) { + return ResourceInputContainer( + label: "Fichier JSON :", + initialValue: agendaDTO.resourceId == null ? '': agendaDTO.resourceId, + inResourceTypes: [ResourceType.Json], + onChanged: (ResourceDTO resourceDTO) { + agendaDTO.resourceUrl = resourceDTO.url; + agendaDTO.resourceId = resourceDTO.id; + widget.onChanged(jsonEncode(agendaDTO).toString()); + } + ); + } +} diff --git a/lib/Screens/Configurations/Section/SubSection/Map/map_config.dart b/lib/Screens/Configurations/Section/SubSection/Map/map_config.dart index 073cbbd..20d903f 100644 --- a/lib/Screens/Configurations/Section/SubSection/Map/map_config.dart +++ b/lib/Screens/Configurations/Section/SubSection/Map/map_config.dart @@ -171,7 +171,7 @@ class _MapConfigState extends State { ), ), Positioned( - bottom: 10, + top: 10, right: 10, child: InkWell( onTap: () { diff --git a/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart b/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart index d806bde..e12099a 100644 --- a/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart +++ b/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart @@ -47,19 +47,27 @@ void showNewOrUpdateGeoPoint(GeoPointDTO? inputGeoPointDTO, Function getResult, Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - StringInputContainer( - label: "Latitude (#.#):", - initialValue: geoPointDTO.latitude, - onChanged: (value) { - geoPointDTO.latitude = value; - }, + SizedBox( + height: 100, + child: StringInputContainer( + isSmall: true, + label: "Latitude (#.#):", + initialValue: geoPointDTO.latitude, + onChanged: (value) { + geoPointDTO.latitude = value; + }, + ), ), - StringInputContainer( - label: "Longitude (#.#):", - initialValue: geoPointDTO.longitude, - onChanged: (value) { - geoPointDTO.longitude = value; - }, + SizedBox( + height: 100, + child: StringInputContainer( + isSmall: true, + label: "Longitude (#.#):", + initialValue: geoPointDTO.longitude, + onChanged: (value) { + geoPointDTO.longitude = value; + }, + ), ) ], ), diff --git a/lib/Screens/Configurations/Section/SubSection/Menu/listView_card_subSection.dart b/lib/Screens/Configurations/Section/SubSection/Menu/listView_card_subSection.dart index f0c924e..029e78b 100644 --- a/lib/Screens/Configurations/Section/SubSection/Menu/listView_card_subSection.dart +++ b/lib/Screens/Configurations/Section/SubSection/Menu/listView_card_subSection.dart @@ -38,8 +38,8 @@ class _ListViewCardSubSection extends State { child: Stack( children: [ Container( - width: 200, - height: 250, + width: 150, + height: 200, decoration: BoxDecoration( color: kWhite, border: Border.all(width: 0.5, color: kSecond), @@ -51,7 +51,7 @@ class _ListViewCardSubSection extends State { ), Positioned( right: 0, - bottom: 0, + bottom: 15, child: Row( children: [ InkWell( @@ -70,11 +70,11 @@ class _ListViewCardSubSection extends State { ); }, child: Padding( - padding: const EdgeInsets.all(8.0), + padding: const EdgeInsets.all(6.0), child: Icon( Icons.edit, color: kPrimaryColor, - size: 25.0, + size: 22.0, ), ) ), @@ -84,11 +84,11 @@ class _ListViewCardSubSection extends State { widget.onChanged(widget.listItems); }, child: Padding( - padding: const EdgeInsets.all(8.0), + padding: const EdgeInsets.all(6.0), child: Icon( Icons.delete, color: kError, - size: 25.0, + size: 22.0, ), ) ), diff --git a/lib/Screens/Configurations/Section/SubSection/Menu/menu_config.dart b/lib/Screens/Configurations/Section/SubSection/Menu/menu_config.dart index ea3d893..ad85dc6 100644 --- a/lib/Screens/Configurations/Section/SubSection/Menu/menu_config.dart +++ b/lib/Screens/Configurations/Section/SubSection/Menu/menu_config.dart @@ -74,13 +74,14 @@ class _MenuConfigState extends State { child: Stack( children: [ Container( - height: size.height *0.25, + height: size.height *0.35, + constraints: BoxConstraints(maxHeight: 300, minHeight: 250), child: Padding( padding: const EdgeInsets.all(8.0), child : ReorderableListView( onReorder: _onReorder, scrollDirection: Axis.horizontal, - padding: const EdgeInsets.symmetric(vertical: 20.0), + padding: const EdgeInsets.symmetric(vertical: 15.0), children: List.generate( menuDTO.sections!.length, (index) { @@ -103,7 +104,7 @@ class _MenuConfigState extends State { ), ), Positioned( - bottom: 0, + top: 0, right: 0, child: InkWell( onTap: () { diff --git a/lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart b/lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart index 2a5b160..f07a851 100644 --- a/lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart +++ b/lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart @@ -36,12 +36,15 @@ void showEditSubSection(SectionDTO subSectionDTO, Function getResult, AppContext Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - StringInputContainer( - label: "Nom :", - initialValue: subSectionDTO.label, - onChanged: (String name) { - subSectionDTO.label = name; - }, + SizedBox( + height: 100, + child: StringInputContainer( + label: "Nom :", + initialValue: subSectionDTO.label, + onChanged: (String name) { + subSectionDTO.label = name; + }, + ), ), ResourceInputContainer( label: "Image :", diff --git a/lib/Screens/Configurations/Section/SubSection/PDF/PDF_config.dart b/lib/Screens/Configurations/Section/SubSection/PDF/PDF_config.dart new file mode 100644 index 0000000..07f183f --- /dev/null +++ b/lib/Screens/Configurations/Section/SubSection/PDF/PDF_config.dart @@ -0,0 +1,49 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:manager_app/Components/resource_input_container.dart'; +import 'package:manager_api_new/api.dart'; +import 'dart:convert'; + +class PDFConfig extends StatefulWidget { + final String? color; + final String? label; + final String initialValue; + final ValueChanged onChanged; + const PDFConfig({ + Key? key, + this.color, + this.label, + required this.initialValue, + required this.onChanged, + }) : super(key: key); + + @override + _PDFConfigState createState() => _PDFConfigState(); +} + +class _PDFConfigState extends State { + late PdfDTO pdfDTO; + + @override + void initState() { + PdfDTO test = PdfDTO.fromJson(json.decode(widget.initialValue))!; + pdfDTO = test; + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Center( + child: ResourceInputContainer( + label: "Fichier PDF :", + inResourceTypes: [ResourceType.Pdf], + initialValue: pdfDTO.resourceId == null ? '': pdfDTO.resourceId, + onChanged: (ResourceDTO resourceDTO) { + pdfDTO.resourceUrl = resourceDTO.url; + pdfDTO.resourceId = resourceDTO.id; + widget.onChanged(jsonEncode(pdfDTO).toString()); + } + ), + ); + } +} diff --git a/lib/Screens/Configurations/Section/SubSection/Puzzle/puzzle_config.dart b/lib/Screens/Configurations/Section/SubSection/Puzzle/puzzle_config.dart new file mode 100644 index 0000000..f4e9c25 --- /dev/null +++ b/lib/Screens/Configurations/Section/SubSection/Puzzle/puzzle_config.dart @@ -0,0 +1,105 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:manager_app/Components/multi_string_input_container.dart'; +import 'package:manager_app/Components/resource_input_container.dart'; +import 'package:manager_api_new/api.dart'; +import 'dart:convert'; + +import 'package:manager_app/constants.dart'; + +class PuzzleConfig extends StatefulWidget { + final String? color; + final String? label; + final String initialValue; + final ValueChanged onChanged; + const PuzzleConfig({ + Key? key, + this.color, + this.label, + required this.initialValue, + required this.onChanged, + }) : super(key: key); + + @override + _PuzzleConfigState createState() => _PuzzleConfigState(); +} + +class _PuzzleConfigState extends State { + late PuzzleDTO puzzleDTO; + + @override + void initState() { + PuzzleDTO test = PuzzleDTO.fromJson(json.decode(widget.initialValue))!; + if(test.image == null) { + test.image = PuzzleDTOImage(); + } + puzzleDTO = test; + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + ResourceInputContainer( + label: "Image du puzzle :", + initialValue: puzzleDTO.image!.resourceId == null ? '': puzzleDTO.image!.resourceId, + onChanged: (ResourceDTO resourceDTO) { + setState(() { + puzzleDTO.image!.resourceId = resourceDTO.id; + puzzleDTO.image!.resourceType = resourceDTO.type; + puzzleDTO.image!.resourceUrl = resourceDTO.url; + print(puzzleDTO.image); + widget.onChanged(jsonEncode(puzzleDTO).toString()); + }); + } + ), + Container( + height: 100, + child: MultiStringInputContainer( + label: "Message départ :", + modalLabel: "Message départ", + fontSize: 20, + isHTML: true, + color: kPrimaryColor, + initialValue: puzzleDTO.messageDebut != null ? puzzleDTO.messageDebut! : [], + onGetResult: (value) { + print("Mess depart test"); + print(value); + if (puzzleDTO.messageDebut != value) { + setState(() { + puzzleDTO.messageDebut = value; + widget.onChanged(jsonEncode(puzzleDTO).toString()); + }); + } + }, + maxLines: 1, + isTitle: true + ) + ), + Container( + height: 100, + child: MultiStringInputContainer( + label: "Message fin :", + modalLabel: "Message fin", + fontSize: 20, + isHTML: true, + color: kPrimaryColor, + initialValue: puzzleDTO.messageFin != null ? puzzleDTO.messageFin! : [], + onGetResult: (value) { + if (puzzleDTO.messageFin != value) { + setState(() { + puzzleDTO.messageFin = value; + widget.onChanged(jsonEncode(puzzleDTO).toString()); + }); + } + }, + maxLines: 1, + isTitle: true + ) + ), + ], + ); + } +} diff --git a/lib/Screens/Configurations/Section/SubSection/Slider/slider_config.dart b/lib/Screens/Configurations/Section/SubSection/Slider/slider_config.dart index 5bd5f00..848e527 100644 --- a/lib/Screens/Configurations/Section/SubSection/Slider/slider_config.dart +++ b/lib/Screens/Configurations/Section/SubSection/Slider/slider_config.dart @@ -98,8 +98,8 @@ class _SliderConfigState extends State { ), ), Positioned( - bottom: 0, - right: 0, + top: 10, + right: 10, child: InkWell( onTap: () async { var result = await showNewOrUpdateContentSlider(null, appContext, context, true, true); diff --git a/lib/Screens/Configurations/Section/section_detail_screen.dart b/lib/Screens/Configurations/Section/section_detail_screen.dart index 58e2e84..f5a5afe 100644 --- a/lib/Screens/Configurations/Section/section_detail_screen.dart +++ b/lib/Screens/Configurations/Section/section_detail_screen.dart @@ -25,10 +25,13 @@ import 'package:manager_api_new/api.dart'; import 'package:provider/provider.dart'; import 'package:intl/intl.dart'; +import 'SubSection/Agenda/agenda_config.dart'; import 'SubSection/Article/article_config.dart'; import 'SubSection/Article/download_pdf.dart'; import 'SubSection/Map/map_config.dart'; import 'SubSection/Menu/menu_config.dart'; +import 'SubSection/PDF/PDF_config.dart'; +import 'SubSection/Puzzle/puzzle_config.dart'; import 'SubSection/Quizz/quizz_config.dart'; import 'SubSection/Slider/slider_config.dart'; import 'package:qr_flutter/qr_flutter.dart'; @@ -223,12 +226,15 @@ class _SectionDetailScreenState extends State { mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [ - StringInputContainer( - label: "Identifiant :", - initialValue: sectionDTO != null ? sectionDTO.label : "", - onChanged: (String value) { - sectionDTO!.label = value; - }, + SizedBox( + height: 100, + child: StringInputContainer( + label: "Identifiant :", + initialValue: sectionDTO != null ? sectionDTO.label : "", + onChanged: (String value) { + sectionDTO!.label = value; + }, + ), ), MultiStringInputContainer( label: "Titre affiché:", @@ -426,8 +432,6 @@ class _SectionDetailScreenState extends State { return MenuConfig( initialValue: sectionDTO.data!, onChanged: (String data) { - //print("Received info in parent"); - //print(data); sectionDTO.data = data; }, ); @@ -435,8 +439,6 @@ class _SectionDetailScreenState extends State { return QuizzConfig( initialValue: sectionDTO.data!, onChanged: (String data) { - //print("Received info in parent - quizz"); - //print(data); sectionDTO.data = data; }, ); @@ -444,8 +446,29 @@ class _SectionDetailScreenState extends State { return ArticleConfig( initialValue: sectionDTO.data!, onChanged: (String data) { - //print("Received info in parent - article"); - //print(data); + sectionDTO.data = data; + save(false, sectionDTO, appContext); + }, + ); + case SectionType.Pdf: + return PDFConfig( + initialValue: sectionDTO.data!, + onChanged: (String data) { + sectionDTO.data = data; + save(false, sectionDTO, appContext); + }, + ); + case SectionType.Puzzle: + return PuzzleConfig( + initialValue: sectionDTO.data!, + onChanged: (String data) { + sectionDTO.data = data; + }, + ); + case SectionType.Agenda: + return AgendaConfig( + initialValue: sectionDTO.data!, + onChanged: (String data) { sectionDTO.data = data; save(false, sectionDTO, appContext); }, diff --git a/lib/Screens/Configurations/configuration_detail_screen.dart b/lib/Screens/Configurations/configuration_detail_screen.dart index 62f784b..69dbb1d 100644 --- a/lib/Screens/Configurations/configuration_detail_screen.dart +++ b/lib/Screens/Configurations/configuration_detail_screen.dart @@ -163,13 +163,17 @@ class _ConfigurationDetailScreenState extends State { mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [ - StringInputContainer( - label: "Identifiant :", - fontSize: 20, - initialValue: configurationDTO.label, - onChanged: (value) { - configurationDTO.label = value; - }, + SizedBox( + height: 100, + child: StringInputContainer( + label: "Identifiant :", + fontSize: 20, + fontSizeText: 20, + initialValue: configurationDTO.label, + onChanged: (value) { + configurationDTO.label = value; + }, + ), ), MultiSelectDropdownContainer( label: "Langues :", @@ -249,7 +253,25 @@ class _ConfigurationDetailScreenState extends State { press: () { PDFHelper.downloadPDF(sections!); }, - ) + ), + CheckInputContainer( + icon: Icons.date_range, + label: "Date :", + fontSize: 20, + isChecked: configurationDTO.isDate, + onChanged: (value) { + configurationDTO.isDate = value; + }, + ), + CheckInputContainer( + icon: Icons.watch_later_outlined, + label: "Heure :", + fontSize: 20, + isChecked: configurationDTO.isHour, + onChanged: (value) { + configurationDTO.isHour = value; + }, + ), ], ), Column( @@ -299,13 +321,16 @@ class _ConfigurationDetailScreenState extends State { } }, ), - StringInputContainer( - label: "Ville météo :", - fontSize: 20, - initialValue: configurationDTO.weatherCity, - onChanged: (value) { - configurationDTO.weatherCity = value; - }, + SizedBox( + height: 100, + child: StringInputContainer( + label: "Ville météo :", + fontSize: 20, + initialValue: configurationDTO.weatherCity, + onChanged: (value) { + configurationDTO.weatherCity = value; + }, + ), ), ]) ], diff --git a/lib/Screens/Configurations/new_configuration_popup.dart b/lib/Screens/Configurations/new_configuration_popup.dart index 3fa14da..70d0d0b 100644 --- a/lib/Screens/Configurations/new_configuration_popup.dart +++ b/lib/Screens/Configurations/new_configuration_popup.dart @@ -30,12 +30,15 @@ void showNewConfiguration(AppContext appContext, ValueChanged isImport, Bu children: [ Center(child: Text("Nouvelle configuration", style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400))), Center( - child: StringInputContainer( - label: "Nom :", - initialValue: configurationDTO.label, - onChanged: (value) { - configurationDTO.label = value; - }, + child: SizedBox( + height: 100, + child: StringInputContainer( + label: "Nom :", + initialValue: configurationDTO.label, + onChanged: (value) { + configurationDTO.label = value; + }, + ), ), ), Text("ou"), diff --git a/lib/Screens/Configurations/new_section_popup.dart b/lib/Screens/Configurations/new_section_popup.dart index 3a4c38f..e664617 100644 --- a/lib/Screens/Configurations/new_section_popup.dart +++ b/lib/Screens/Configurations/new_section_popup.dart @@ -24,33 +24,39 @@ void showNewSection(String configurationId, AppContext appContext, BuildContext ), content: SingleChildScrollView( child: SizedBox( - width: size.width*0.3, - height: size.height*0.3, - child: Column( - children: [ - Text(isSubSection? "Nouvelle sous section": "Nouvelle section", style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400)), - Column( - children: [ - StringInputContainer( - label: "Nom :", - initialValue: sectionDTO.label, - onChanged: (value) { - sectionDTO.label = value; - }, - ), - MultiSelectContainer( - label: "Type:", - initialValue: isMobile ? ["Article"] : ["Map"], - isMultiple: false, - values: isMobile ? section_types.where((sectionType) => sectionType == "Article" || sectionType == "Quizz").toList(): isSubSection ? section_types.where((sectionType) => sectionType != "Menu" && sectionType != "Article").toList(): section_types.where((sectionType) => sectionType != "Article").toList(), // Todo get menu by enum type - onChanged: (value) { - var tempOutput = new List.from(value); - sectionDTO.type = SectionType.fromJson(tempOutput[0]); - }, - ), - ], - ), - ], + width: size.width*0.4, + height: size.height*0.4, + child: Container( + constraints: BoxConstraints(minHeight: 300, minWidth: 300), + child: Column( + children: [ + Text(isSubSection? "Nouvelle sous section": "Nouvelle section", style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400)), + Column( + children: [ + SizedBox( + height: 100, + child: StringInputContainer( + label: "Nom :", + initialValue: sectionDTO.label, + onChanged: (value) { + sectionDTO.label = value; + }, + ), + ), + MultiSelectContainer( + label: "Type:", + initialValue: isMobile ? ["Article"] : ["Map"], + isMultiple: false, + values: isMobile ? section_types.where((sectionType) => sectionType == "Article" || sectionType == "Quizz").toList(): isSubSection ? section_types.where((sectionType) => sectionType != "Menu" && sectionType != "Article").toList(): section_types.where((sectionType) => sectionType != "Article").toList(), // Todo get menu by enum type + onChanged: (value) { + var tempOutput = new List.from(value); + sectionDTO.type = SectionType.fromJson(tempOutput[0]); + }, + ), + ], + ), + ], + ), ), ), ), diff --git a/lib/Screens/Configurations/section_reorderList.dart b/lib/Screens/Configurations/section_reorderList.dart index 2b63fbe..92ba524 100644 --- a/lib/Screens/Configurations/section_reorderList.dart +++ b/lib/Screens/Configurations/section_reorderList.dart @@ -124,6 +124,7 @@ class _SectionReorderListState extends State { left: 10, child: Container( height: size.height*0.1, + constraints: BoxConstraints(minHeight: 85), child: StringInputContainer( label: "Recherche:", isSmall: true, @@ -139,7 +140,7 @@ class _SectionReorderListState extends State { ), ), Positioned( - bottom: 10, + top: 10, right: 10, child: InkWell( onTap: () { diff --git a/lib/Screens/Resources/resource_body_grid.dart b/lib/Screens/Resources/resource_body_grid.dart index b46d18a..0d461b6 100644 --- a/lib/Screens/Resources/resource_body_grid.dart +++ b/lib/Screens/Resources/resource_body_grid.dart @@ -169,7 +169,7 @@ class _ResourceBodyGridState extends State { child: Icon( getResourceIcon(resource.type), color: kPrimaryColor, - size: 25, + size: 15, ), ), ], @@ -178,7 +178,7 @@ class _ResourceBodyGridState extends State { return Icon( Icons.close, color: kTextLightColor, - size: 80.0, + size: 50.0, ); } } diff --git a/lib/api/swagger.yaml b/lib/api/swagger.yaml index 003cd03..e873dc2 100644 --- a/lib/api/swagger.yaml +++ b/lib/api/swagger.yaml @@ -1814,6 +1814,10 @@ components: weatherCity: type: string nullable: true + isDate: + type: boolean + isHour: + type: boolean TranslationDTO: type: object additionalProperties: false @@ -2303,6 +2307,14 @@ components: $ref: '#/components/schemas/TranslationDTO' isGood: type: boolean + resourceId: + type: string + nullable: true + resourceType: + $ref: '#/components/schemas/ResourceType' + resourceUrl: + type: string + nullable: true order: type: integer format: int32 diff --git a/manager_api_new/doc/ConfigurationDTO.md b/manager_api_new/doc/ConfigurationDTO.md index ef72403..1399473 100644 --- a/manager_api_new/doc/ConfigurationDTO.md +++ b/manager_api_new/doc/ConfigurationDTO.md @@ -25,6 +25,8 @@ Name | Type | Description | Notes **loaderImageId** | **String** | | [optional] **loaderImageUrl** | **String** | | [optional] **weatherCity** | **String** | | [optional] +**isDate** | **bool** | | [optional] +**isHour** | **bool** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/manager_api_new/doc/ExportConfigurationDTO.md b/manager_api_new/doc/ExportConfigurationDTO.md index 41beb8d..ecfd8cf 100644 --- a/manager_api_new/doc/ExportConfigurationDTO.md +++ b/manager_api_new/doc/ExportConfigurationDTO.md @@ -25,6 +25,8 @@ Name | Type | Description | Notes **loaderImageId** | **String** | | [optional] **loaderImageUrl** | **String** | | [optional] **weatherCity** | **String** | | [optional] +**isDate** | **bool** | | [optional] +**isHour** | **bool** | | [optional] **sections** | [**List**](SectionDTO.md) | | [optional] [default to const []] **resources** | [**List**](ResourceDTO.md) | | [optional] [default to const []] diff --git a/manager_api_new/doc/ResponseDTO.md b/manager_api_new/doc/ResponseDTO.md index 6e4f0a1..54c80e2 100644 --- a/manager_api_new/doc/ResponseDTO.md +++ b/manager_api_new/doc/ResponseDTO.md @@ -10,6 +10,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **label** | [**List**](TranslationDTO.md) | | [optional] [default to const []] **isGood** | **bool** | | [optional] +**resourceId** | **String** | | [optional] +**resourceType** | [**ResourceType**](ResourceType.md) | | [optional] +**resourceUrl** | **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_new/lib/model/configuration_dto.dart b/manager_api_new/lib/model/configuration_dto.dart index a7196bd..074ab24 100644 --- a/manager_api_new/lib/model/configuration_dto.dart +++ b/manager_api_new/lib/model/configuration_dto.dart @@ -30,6 +30,8 @@ class ConfigurationDTO { this.loaderImageId, this.loaderImageUrl, this.weatherCity, + this.isDate, + this.isHour, }); String? id; @@ -90,6 +92,22 @@ class ConfigurationDTO { String? weatherCity; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isDate; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isHour; + @override bool operator ==(Object other) => identical(this, other) || other is ConfigurationDTO && other.id == id && @@ -108,7 +126,9 @@ class ConfigurationDTO { other.sectionIds == sectionIds && other.loaderImageId == loaderImageId && other.loaderImageUrl == loaderImageUrl && - other.weatherCity == weatherCity; + other.weatherCity == weatherCity && + other.isDate == isDate && + other.isHour == isHour; @override int get hashCode => @@ -129,10 +149,12 @@ class ConfigurationDTO { (sectionIds == null ? 0 : sectionIds!.hashCode) + (loaderImageId == null ? 0 : loaderImageId!.hashCode) + (loaderImageUrl == null ? 0 : loaderImageUrl!.hashCode) + - (weatherCity == null ? 0 : weatherCity!.hashCode); + (weatherCity == null ? 0 : weatherCity!.hashCode) + + (isDate == null ? 0 : isDate!.hashCode) + + (isHour == null ? 0 : isHour!.hashCode); @override - String toString() => 'ConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity]'; + String toString() => 'ConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity, isDate=$isDate, isHour=$isHour]'; Map toJson() { final json = {}; @@ -221,6 +243,16 @@ class ConfigurationDTO { } else { json[r'weatherCity'] = null; } + if (this.isDate != null) { + json[r'isDate'] = this.isDate; + } else { + json[r'isDate'] = null; + } + if (this.isHour != null) { + json[r'isHour'] = this.isHour; + } else { + json[r'isHour'] = null; + } return json; } @@ -264,6 +296,8 @@ class ConfigurationDTO { loaderImageId: mapValueOfType(json, r'loaderImageId'), loaderImageUrl: mapValueOfType(json, r'loaderImageUrl'), weatherCity: mapValueOfType(json, r'weatherCity'), + isDate: mapValueOfType(json, r'isDate'), + isHour: mapValueOfType(json, r'isHour'), ); } return null; diff --git a/manager_api_new/lib/model/export_configuration_dto.dart b/manager_api_new/lib/model/export_configuration_dto.dart index dd16d90..4efa6a3 100644 --- a/manager_api_new/lib/model/export_configuration_dto.dart +++ b/manager_api_new/lib/model/export_configuration_dto.dart @@ -30,6 +30,8 @@ class ExportConfigurationDTO { this.loaderImageId, this.loaderImageUrl, this.weatherCity, + this.isDate, + this.isHour, this.sections = const [], this.resources = const [], }); @@ -92,6 +94,22 @@ class ExportConfigurationDTO { String? weatherCity; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isDate; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isHour; + List? sections; List? resources; @@ -115,6 +133,8 @@ class ExportConfigurationDTO { other.loaderImageId == loaderImageId && other.loaderImageUrl == loaderImageUrl && other.weatherCity == weatherCity && + other.isDate == isDate && + other.isHour == isHour && other.sections == sections && other.resources == resources; @@ -138,11 +158,13 @@ class ExportConfigurationDTO { (loaderImageId == null ? 0 : loaderImageId!.hashCode) + (loaderImageUrl == null ? 0 : loaderImageUrl!.hashCode) + (weatherCity == null ? 0 : weatherCity!.hashCode) + + (isDate == null ? 0 : isDate!.hashCode) + + (isHour == null ? 0 : isHour!.hashCode) + (sections == null ? 0 : sections!.hashCode) + (resources == null ? 0 : resources!.hashCode); @override - String toString() => 'ExportConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity, sections=$sections, resources=$resources]'; + String toString() => 'ExportConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity, isDate=$isDate, isHour=$isHour, sections=$sections, resources=$resources]'; Map toJson() { final json = {}; @@ -231,6 +253,16 @@ class ExportConfigurationDTO { } else { json[r'weatherCity'] = null; } + if (this.isDate != null) { + json[r'isDate'] = this.isDate; + } else { + json[r'isDate'] = null; + } + if (this.isHour != null) { + json[r'isHour'] = this.isHour; + } else { + json[r'isHour'] = null; + } if (this.sections != null) { json[r'sections'] = this.sections; } else { @@ -284,6 +316,8 @@ class ExportConfigurationDTO { loaderImageId: mapValueOfType(json, r'loaderImageId'), loaderImageUrl: mapValueOfType(json, r'loaderImageUrl'), weatherCity: mapValueOfType(json, r'weatherCity'), + isDate: mapValueOfType(json, r'isDate'), + isHour: mapValueOfType(json, r'isHour'), sections: SectionDTO.listFromJson(json[r'sections']), resources: ResourceDTO.listFromJson(json[r'resources']), ); diff --git a/manager_api_new/lib/model/resource_type.dart b/manager_api_new/lib/model/resource_type.dart index 5f9b5cd..8cc1f79 100644 --- a/manager_api_new/lib/model/resource_type.dart +++ b/manager_api_new/lib/model/resource_type.dart @@ -10,7 +10,7 @@ part of openapi.api; -/// 0 = Image 1 = Video 2 = ImageUrl 3 = VideoUrl +/// 0 = Image 1 = Video 2 = ImageUrl 3 = VideoUrl 4 = Audio 5 = PDF 6 = JSON class ResourceType { /// Instantiate a new enum with the provided [value]. const ResourceType._(this.value); diff --git a/manager_api_new/lib/model/response_dto.dart b/manager_api_new/lib/model/response_dto.dart index df2f4cd..d72237a 100644 --- a/manager_api_new/lib/model/response_dto.dart +++ b/manager_api_new/lib/model/response_dto.dart @@ -15,6 +15,9 @@ class ResponseDTO { ResponseDTO({ this.label = const [], this.isGood, + this.resourceId, + this.resourceType, + this.resourceUrl, this.order, }); @@ -28,6 +31,18 @@ class ResponseDTO { /// bool? isGood; + String? resourceId; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + ResourceType? resourceType; + + String? resourceUrl; + /// /// Please note: This property should have been non-nullable! Since the specification file /// does not include a default value (using the "default:" property), however, the generated @@ -40,6 +55,9 @@ class ResponseDTO { bool operator ==(Object other) => identical(this, other) || other is ResponseDTO && other.label == label && other.isGood == isGood && + other.resourceId == resourceId && + other.resourceType == resourceType && + other.resourceUrl == resourceUrl && other.order == order; @override @@ -47,10 +65,13 @@ class ResponseDTO { // ignore: unnecessary_parenthesis (label == null ? 0 : label!.hashCode) + (isGood == null ? 0 : isGood!.hashCode) + + (resourceId == null ? 0 : resourceId!.hashCode) + + (resourceType == null ? 0 : resourceType!.hashCode) + + (resourceUrl == null ? 0 : resourceUrl!.hashCode) + (order == null ? 0 : order!.hashCode); @override - String toString() => 'ResponseDTO[label=$label, isGood=$isGood, order=$order]'; + String toString() => 'ResponseDTO[label=$label, isGood=$isGood, resourceId=$resourceId, resourceType=$resourceType, resourceUrl=$resourceUrl, order=$order]'; Map toJson() { final json = {}; @@ -64,6 +85,21 @@ class ResponseDTO { } else { json[r'isGood'] = null; } + if (this.resourceId != null) { + json[r'resourceId'] = this.resourceId; + } else { + json[r'resourceId'] = null; + } + if (this.resourceType != null) { + json[r'resourceType'] = this.resourceType; + } else { + json[r'resourceType'] = null; + } + if (this.resourceUrl != null) { + json[r'resourceUrl'] = this.resourceUrl; + } else { + json[r'resourceUrl'] = null; + } if (this.order != null) { json[r'order'] = this.order; } else { @@ -93,6 +129,9 @@ class ResponseDTO { return ResponseDTO( label: TranslationDTO.listFromJson(json[r'label']), isGood: mapValueOfType(json, r'isGood'), + resourceId: mapValueOfType(json, r'resourceId'), + resourceType: ResourceType.fromJson(json[r'resourceType']), + resourceUrl: mapValueOfType(json, r'resourceUrl'), order: mapValueOfType(json, r'order'), ); } diff --git a/manager_api_new/lib/model/section_dto.dart b/manager_api_new/lib/model/section_dto.dart index 977995c..b3c097e 100644 --- a/manager_api_new/lib/model/section_dto.dart +++ b/manager_api_new/lib/model/section_dto.dart @@ -76,12 +76,6 @@ class SectionDTO { /// DateTime? dateCreation; - /// - /// Please note: This property should have been non-nullable! Since the specification file - /// does not include a default value (using the "default:" property), however, the generated - /// source code must fall back to having a nullable type. - /// Consider adding a "default:" property in the specification file to hide this note. - /// int? order; String? instanceId;