diff --git a/lib/Components/category_input_container.dart b/lib/Components/category_input_container.dart index 5ae87ac..426ec95 100644 --- a/lib/Components/category_input_container.dart +++ b/lib/Components/category_input_container.dart @@ -1,11 +1,8 @@ import 'package:auto_size_text/auto_size_text.dart'; -import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; import 'package:manager_api_new/api.dart'; import 'package:manager_app/Components/rounded_button.dart'; import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/category_list.dart'; -import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; class CategoryInputContainer extends StatefulWidget { diff --git a/lib/Components/check_input_container.dart b/lib/Components/check_input_container.dart index 812adee..771d96a 100644 --- a/lib/Components/check_input_container.dart +++ b/lib/Components/check_input_container.dart @@ -51,14 +51,13 @@ class _CheckInputContainerState extends State { size: 25.0, ), ), - if(widget.label != null) - AutoSizeText( - widget.label, - style: new TextStyle(fontSize: widget.fontSize, fontWeight: FontWeight.w300), - maxLines: 2, - maxFontSize: widget.fontSize, - textAlign: TextAlign.center, - ), + AutoSizeText( + widget.label, + style: new TextStyle(fontSize: widget.fontSize, fontWeight: FontWeight.w300), + maxLines: 2, + maxFontSize: widget.fontSize, + textAlign: TextAlign.center, + ), ], ) ), diff --git a/lib/Components/flag_decoration.dart b/lib/Components/flag_decoration.dart index f8fbff6..447fce3 100644 --- a/lib/Components/flag_decoration.dart +++ b/lib/Components/flag_decoration.dart @@ -1,4 +1,3 @@ -import 'package:flare_flutter/flare_actor.dart'; import 'package:flutter/material.dart'; import 'package:manager_app/constants.dart'; diff --git a/lib/Components/multi_input_modal.dart b/lib/Components/multi_input_modal.dart index 3f4bcb7..f026acc 100644 --- a/lib/Components/multi_input_modal.dart +++ b/lib/Components/multi_input_modal.dart @@ -1,11 +1,8 @@ -import 'dart:ui'; -import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; import 'package:manager_app/Components/rounded_button.dart'; import 'package:manager_app/Components/text_form_input_container.dart'; import 'package:manager_app/Models/managerContext.dart'; -import 'package:manager_app/Screens/Resources/select_resource_modal.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:manager_api_new/api.dart'; diff --git a/lib/Components/multi_select_dropdown_container.dart b/lib/Components/multi_select_dropdown_container.dart index 232a201..bf2919b 100644 --- a/lib/Components/multi_select_dropdown_container.dart +++ b/lib/Components/multi_select_dropdown_container.dart @@ -6,7 +6,6 @@ import 'package:multi_select_flutter/dialog/multi_select_dialog_field.dart'; import 'package:multi_select_flutter/util/multi_select_item.dart'; import 'package:multi_select_flutter/util/multi_select_list_type.dart'; -import 'flag_decoration.dart'; class MultiSelectDropdownContainer extends StatelessWidget { final Color color; diff --git a/lib/Components/multi_string_input_and_resource_container.dart b/lib/Components/multi_string_input_and_resource_container.dart index 2491ceb..c55fec2 100644 --- a/lib/Components/multi_string_input_and_resource_container.dart +++ b/lib/Components/multi_string_input_and_resource_container.dart @@ -2,7 +2,6 @@ import 'dart:convert'; import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; -import 'package:manager_app/Components/multi_input_modal.dart'; import 'package:manager_app/Components/multi_string_input_html_modal.dart'; import 'package:manager_app/constants.dart'; import 'package:manager_api_new/api.dart'; @@ -56,9 +55,6 @@ class MultiStringInputAndResourceContainer extends StatelessWidget { List newValues = []; List initials = initialValue; - if(initials == null) { - initials = []; - } languages.forEach((value) { if(initials.map((iv) => iv.language).contains(value)) { diff --git a/lib/Components/multi_string_input_container.dart b/lib/Components/multi_string_input_container.dart index 5215c84..a0bd57e 100644 --- a/lib/Components/multi_string_input_container.dart +++ b/lib/Components/multi_string_input_container.dart @@ -18,6 +18,7 @@ class MultiStringInputContainer extends StatelessWidget { final bool isAudio; final bool isHTML; final double fontSize; + final bool isMandatory; const MultiStringInputContainer({ Key? key, this.color = kSecond, @@ -30,6 +31,7 @@ class MultiStringInputContainer extends StatelessWidget { this.isAudio = false, this.isHTML = false, this.fontSize = 25, + this.isMandatory = true, }) : super(key: key); @override @@ -58,9 +60,6 @@ class MultiStringInputContainer extends StatelessWidget { List newValues = []; List initials = initialValue; - if(initials == null) { - initials = []; - } languages.forEach((value) { if(initials.map((iv) => iv.language).contains(value)) { @@ -72,7 +71,7 @@ class MultiStringInputContainer extends StatelessWidget { }); if(isHTML) { - showMultiStringInputHTML(label, modalLabel, isTitle, initials, newValues, onGetResult, maxLines, isAudio, context); + showMultiStringInputHTML(label, modalLabel, isTitle, initials, newValues, onGetResult, maxLines, isAudio, context, isMandatory); } else { showMultiStringInput(label, modalLabel, isTitle, initials, newValues, onGetResult, maxLines, isAudio, context); } diff --git a/lib/Components/multi_string_input_html_modal.dart b/lib/Components/multi_string_input_html_modal.dart index 9c8226c..c320890 100644 --- a/lib/Components/multi_string_input_html_modal.dart +++ b/lib/Components/multi_string_input_html_modal.dart @@ -1,4 +1,3 @@ -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:manager_app/Components/message_notification.dart'; import 'package:manager_app/Components/rounded_button.dart'; @@ -8,7 +7,7 @@ import 'package:manager_app/constants.dart'; import 'package:manager_api_new/api.dart'; import 'package:collection/collection.dart'; -showMultiStringInputHTML (String label, String modalLabel, bool isTitle, List values, List newValues, Function onGetResult, int maxLines, bool isAudio, BuildContext context) { +showMultiStringInputHTML (String label, String modalLabel, bool isTitle, List values, List newValues, Function onGetResult, int maxLines, bool isAudio, BuildContext context, bool isMandatory) { showDialog( builder: (BuildContext context) { return AlertDialog( @@ -48,7 +47,7 @@ showMultiStringInputHTML (String label, String modalLabel, bool isTitle, List label.value == null || label.value!.trim() == "")) { + if(isMandatory && newValues.any((label) => label.value == null || label.value!.trim() == "")) { showNotification(kPrimaryColor, kWhite, "La traduction n'est pas complète", context, null); } else { onGetResult(newValues); diff --git a/lib/Components/resource_tab.dart b/lib/Components/resource_tab.dart index a809b42..86cf8ae 100644 --- a/lib/Components/resource_tab.dart +++ b/lib/Components/resource_tab.dart @@ -2,7 +2,6 @@ import 'dart:io'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; -import 'package:manager_app/Components/upload_audio_container.dart'; import 'package:manager_app/Components/upload_image_container.dart'; import 'package:manager_app/Components/upload_online_resources_container.dart'; import 'package:manager_app/constants.dart'; diff --git a/lib/Components/video_viewer_youtube.dart b/lib/Components/video_viewer_youtube.dart index f39e1ca..1bdb58e 100644 --- a/lib/Components/video_viewer_youtube.dart +++ b/lib/Components/video_viewer_youtube.dart @@ -1,4 +1,3 @@ -import 'dart:convert'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; diff --git a/lib/Helpers/PDFHelper.dart b/lib/Helpers/PDFHelper.dart index 65c8201..09df479 100644 --- a/lib/Helpers/PDFHelper.dart +++ b/lib/Helpers/PDFHelper.dart @@ -1,4 +1,3 @@ -import 'package:flutter/services.dart'; import 'package:manager_api_new/api.dart'; import 'dart:convert'; import 'package:pdf/pdf.dart'; diff --git a/lib/Screens/Configurations/Section/SubSection/Article/article_config.dart b/lib/Screens/Configurations/Section/SubSection/Article/article_config.dart index 1c0e0fd..fd738f6 100644 --- a/lib/Screens/Configurations/Section/SubSection/Article/article_config.dart +++ b/lib/Screens/Configurations/Section/SubSection/Article/article_config.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:manager_app/Components/audio_input_container.dart'; import 'package:manager_app/Components/check_input_container.dart'; import 'package:manager_app/Components/multi_string_input_container.dart'; import 'package:manager_app/Screens/Configurations/Section/SubSection/Slider/listView_card_image.dart'; @@ -210,15 +209,12 @@ class _ArticleConfigState extends State { child: InkWell( onTap: () async { var result = await showNewOrUpdateContentSlider(null, appContext, context, true, false); - if (result != null) - { - setState(() { - result.order = articleDTO.contents!.length; - articleDTO.contents!.add(result); - widget.onChanged(jsonEncode(articleDTO).toString()); - }); - } - }, + setState(() { + result.order = articleDTO.contents!.length; + articleDTO.contents!.add(result); + widget.onChanged(jsonEncode(articleDTO).toString()); + }); + }, child: Container( height: MediaQuery.of(context).size.width * 0.04, width: MediaQuery.of(context).size.width * 0.04, diff --git a/lib/Screens/Configurations/Section/SubSection/Map/category_list.dart b/lib/Screens/Configurations/Section/SubSection/Map/category_list.dart index ecfc8d9..cb1d46a 100644 --- a/lib/Screens/Configurations/Section/SubSection/Map/category_list.dart +++ b/lib/Screens/Configurations/Section/SubSection/Map/category_list.dart @@ -1,9 +1,6 @@ -import 'dart:convert'; -import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; -import 'package:manager_app/Components/multi_string_input_html_modal.dart'; import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/new_update_categorie.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; diff --git a/lib/Screens/Configurations/Section/SubSection/Map/geopoint_image_list.dart b/lib/Screens/Configurations/Section/SubSection/Map/geopoint_image_list.dart index 711edc7..7513293 100644 --- a/lib/Screens/Configurations/Section/SubSection/Map/geopoint_image_list.dart +++ b/lib/Screens/Configurations/Section/SubSection/Map/geopoint_image_list.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:manager_app/Models/managerContext.dart'; import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/listView_card_geoPoint_images.dart'; import 'package:manager_app/Screens/Resources/select_resource_modal.dart'; import 'package:manager_app/app_context.dart'; diff --git a/lib/Screens/Configurations/Section/SubSection/Map/map_config.dart b/lib/Screens/Configurations/Section/SubSection/Map/map_config.dart index 1fa6c9d..6495d27 100644 --- a/lib/Screens/Configurations/Section/SubSection/Map/map_config.dart +++ b/lib/Screens/Configurations/Section/SubSection/Map/map_config.dart @@ -1,4 +1,3 @@ -import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; import 'package:manager_app/Components/category_input_container.dart'; @@ -6,7 +5,6 @@ import 'package:manager_app/Components/fetch_section_icon.dart'; import 'package:manager_app/Components/resource_input_container.dart'; import 'package:manager_app/Components/multi_select_container.dart'; import 'package:manager_app/Components/slider_input_container.dart'; -import 'package:manager_app/Models/managerContext.dart'; import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; diff --git a/lib/Screens/Configurations/Section/SubSection/Map/new_update_categorie.dart b/lib/Screens/Configurations/Section/SubSection/Map/new_update_categorie.dart index 7eae586..2442189 100644 --- a/lib/Screens/Configurations/Section/SubSection/Map/new_update_categorie.dart +++ b/lib/Screens/Configurations/Section/SubSection/Map/new_update_categorie.dart @@ -1,13 +1,9 @@ import 'dart:convert'; -import 'package:auto_size_text/auto_size_text.dart'; -import 'package:manager_app/Components/multi_string_input_and_resource_container.dart'; -import 'package:manager_app/Components/multi_string_input_html_modal.dart'; import 'package:manager_app/Components/resource_input_container.dart'; import 'package:flutter/material.dart'; import 'package:manager_app/Components/multi_string_input_container.dart'; import 'package:manager_app/Components/rounded_button.dart'; -import 'package:manager_app/Components/text_form_input_container.dart'; import 'package:manager_app/Models/managerContext.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; diff --git a/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart b/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart index 094a39e..273eb4f 100644 --- a/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart +++ b/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart @@ -1,10 +1,8 @@ -import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; import 'package:manager_app/Components/dropDown_input_container.dart'; 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/Components/text_form_input_container.dart'; import 'package:manager_app/Models/managerContext.dart'; import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/geopoint_image_list.dart'; import 'package:manager_app/app_context.dart'; @@ -105,6 +103,7 @@ void showNewOrUpdateGeoPoint(MapDTO mapDTO, GeoPointDTO? inputGeoPointDTO, Funct isHTML: true, color: kPrimaryColor, initialValue: geoPointDTO.description != null ? geoPointDTO.description! : [], + isMandatory: false, onGetResult: (value) { if (geoPointDTO.description != value) { geoPointDTO.description = value; diff --git a/lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart b/lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart index f07a851..e93c632 100644 --- a/lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart +++ b/lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart @@ -1,11 +1,8 @@ -import 'package:auto_size_text/auto_size_text.dart'; import 'package:manager_app/Components/resource_input_container.dart'; import 'package:flutter/material.dart'; 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/Components/text_form_input_container.dart'; -import 'package:manager_app/Models/managerContext.dart'; import 'package:manager_app/Screens/Configurations/Section/SubSection/Quizz/quizz_config.dart'; import 'package:manager_app/Screens/Configurations/Section/SubSection/Slider/slider_config.dart'; import 'package:manager_app/Screens/Configurations/Section/SubSection/WebOrVideo/web_video_config.dart'; @@ -97,6 +94,7 @@ void showEditSubSection(SectionDTO subSectionDTO, Function getResult, AppContext isHTML: true, color: kPrimaryColor, initialValue: subSectionDTO.description != null ? subSectionDTO.description! : [], + isMandatory: false, onGetResult: (value) { if (subSectionDTO.description != value) { subSectionDTO.description = value; diff --git a/lib/Screens/Configurations/Section/SubSection/Puzzle/puzzle_config.dart b/lib/Screens/Configurations/Section/SubSection/Puzzle/puzzle_config.dart index 9caeb1b..0229160 100644 --- a/lib/Screens/Configurations/Section/SubSection/Puzzle/puzzle_config.dart +++ b/lib/Screens/Configurations/Section/SubSection/Puzzle/puzzle_config.dart @@ -1,8 +1,6 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:manager_app/Components/message_notification.dart'; import 'package:manager_app/Components/multi_string_input_and_resource_container.dart'; -import 'package:manager_app/Components/multi_string_input_container.dart'; import 'package:manager_app/Components/number_input_container.dart'; import 'package:manager_app/Components/resource_input_container.dart'; import 'package:manager_api_new/api.dart'; diff --git a/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_question_quizz.dart b/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_question_quizz.dart index 936c0e4..51f6c02 100644 --- a/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_question_quizz.dart +++ b/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_question_quizz.dart @@ -1,11 +1,8 @@ -import 'package:auto_size_text/auto_size_text.dart'; import 'package:manager_app/Components/multi_string_input_and_resource_container.dart'; import 'package:manager_app/Components/resource_input_container.dart'; import 'package:flutter/material.dart'; import 'package:manager_app/Components/message_notification.dart'; -import 'package:manager_app/Components/multi_string_input_container.dart'; import 'package:manager_app/Components/rounded_button.dart'; -import 'package:manager_app/Components/text_form_input_container.dart'; import 'package:manager_app/Models/managerContext.dart'; import 'package:manager_app/Screens/Configurations/Section/SubSection/Quizz/quizz_answer_list.dart'; import 'package:manager_app/app_context.dart'; diff --git a/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_response_quizz - deprecated.dart b/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_response_quizz - deprecated.dart index cfa9f91..84720c4 100644 --- a/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_response_quizz - deprecated.dart +++ b/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_response_quizz - deprecated.dart @@ -1,10 +1,7 @@ -import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; import 'package:manager_app/Components/message_notification.dart'; import 'package:manager_app/Components/multi_string_input_and_resource_container.dart'; -import 'package:manager_app/Components/multi_string_input_container.dart'; import 'package:manager_app/Components/rounded_button.dart'; -import 'package:manager_app/Components/text_form_input_container.dart'; import 'package:manager_app/Models/managerContext.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; diff --git a/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_score_quizz - deprecated.dart b/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_score_quizz - deprecated.dart index 63ac66c..ff119a1 100644 --- a/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_score_quizz - deprecated.dart +++ b/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_score_quizz - deprecated.dart @@ -1,13 +1,9 @@ import 'dart:convert'; -import 'package:auto_size_text/auto_size_text.dart'; import 'package:manager_app/Components/multi_string_input_and_resource_container.dart'; import 'package:manager_app/Components/multi_string_input_html_modal.dart'; -import 'package:manager_app/Components/resource_input_container.dart'; import 'package:flutter/material.dart'; -import 'package:manager_app/Components/multi_string_input_container.dart'; import 'package:manager_app/Components/rounded_button.dart'; -import 'package:manager_app/Components/text_form_input_container.dart'; import 'package:manager_app/Models/managerContext.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; diff --git a/lib/Screens/Configurations/Section/SubSection/Quizz/quizz_answer_list.dart b/lib/Screens/Configurations/Section/SubSection/Quizz/quizz_answer_list.dart index c55b06c..87fd514 100644 --- a/lib/Screens/Configurations/Section/SubSection/Quizz/quizz_answer_list.dart +++ b/lib/Screens/Configurations/Section/SubSection/Quizz/quizz_answer_list.dart @@ -1,6 +1,5 @@ import 'dart:convert'; -import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; import 'package:manager_app/Components/multi_string_input_html_modal.dart'; @@ -9,7 +8,6 @@ import 'package:manager_app/constants.dart'; import 'package:manager_api_new/api.dart'; import 'package:provider/provider.dart'; -import 'new_update_response_quizz - deprecated.dart'; class QuizzResponseList extends StatefulWidget { final List responses; @@ -209,9 +207,6 @@ class _QuizzResponseListState extends State { List newValues = []; List initials = response.label!; - if(initials == null) { - initials = []; - } languages.forEach((value) { if(initials.map((iv) => iv.language).contains(value)) { diff --git a/lib/Screens/Configurations/Section/SubSection/Quizz/quizz_config.dart b/lib/Screens/Configurations/Section/SubSection/Quizz/quizz_config.dart index a0efaf6..f503388 100644 --- a/lib/Screens/Configurations/Section/SubSection/Quizz/quizz_config.dart +++ b/lib/Screens/Configurations/Section/SubSection/Quizz/quizz_config.dart @@ -1,4 +1,3 @@ -import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; import 'package:manager_app/Components/multi_string_input_html_modal.dart'; @@ -12,7 +11,6 @@ import 'dart:convert'; import 'package:provider/provider.dart'; import 'new_update_question_quizz.dart'; -import 'new_update_score_quizz - deprecated.dart'; class QuizzConfig extends StatefulWidget { final String? color; @@ -189,15 +187,12 @@ class _QuizzConfigState extends State { child: InkWell( onTap: () async { QuestionDTO? result = await showNewOrUpdateQuestionQuizz(null, appContext, context, "Question"); - if (result != null) - { - setState(() { - result.order = quizzDTO.questions!.length; - quizzDTO.questions!.add(result); - widget.onChanged(jsonEncode(quizzDTO).toString()); - }); - } - }, + setState(() { + result.order = quizzDTO.questions!.length; + quizzDTO.questions!.add(result); + widget.onChanged(jsonEncode(quizzDTO).toString()); + }); + }, child: Container( height: MediaQuery.of(context).size.width * 0.04, width: MediaQuery.of(context).size.width * 0.04, @@ -272,13 +267,11 @@ class _QuizzConfigState extends State { "Modifier la question" ); - if (result != null) { - setState(() { - quizzDTO.questions![question.order!] = result; - widget.onChanged(jsonEncode(quizzDTO).toString()); - }); - } - }, + setState(() { + quizzDTO.questions![question.order!] = result; + widget.onChanged(jsonEncode(quizzDTO).toString()); + }); + }, child: Padding( padding: const EdgeInsets.all(8.0), child: Icon( diff --git a/lib/Screens/Configurations/Section/SubSection/Slider/listView_card_image.dart b/lib/Screens/Configurations/Section/SubSection/Slider/listView_card_image.dart index 92c209b..208fb14 100644 --- a/lib/Screens/Configurations/Section/SubSection/Slider/listView_card_image.dart +++ b/lib/Screens/Configurations/Section/SubSection/Slider/listView_card_image.dart @@ -1,4 +1,3 @@ -import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; import 'package:manager_app/Screens/Configurations/Section/SubSection/Slider/new_update_image_slider.dart'; import 'package:manager_app/app_context.dart'; @@ -95,13 +94,11 @@ class _ListViewCard extends State { widget.showDescriptionTranslations ); - if (result != null) { - setState(() { - widget.listItems[widget.index] = result; - widget.onChanged(widget.listItems); - }); - } - }, + setState(() { + widget.listItems[widget.index] = result; + widget.onChanged(widget.listItems); + }); + }, child: Padding( padding: const EdgeInsets.all(8.0), child: Icon( @@ -140,7 +137,7 @@ boxDecoration(ContentDTO contentDTO, appContext) { shape: BoxShape.rectangle, border: Border.all(width: 1.5, color: kSecond), borderRadius: BorderRadius.circular(10.0), - image: contentDTO.title != null && contentDTO.resourceUrl != null ? new DecorationImage( + image: contentDTO.title != null && contentDTO.resourceUrl != null && (contentDTO.resourceType == ResourceType.ImageUrl || contentDTO.resourceType == ResourceType.Image) ? new DecorationImage( fit: BoxFit.scaleDown, image: new NetworkImage( contentDTO.resourceUrl!, diff --git a/lib/Screens/Configurations/Section/SubSection/Slider/new_update_image_slider.dart b/lib/Screens/Configurations/Section/SubSection/Slider/new_update_image_slider.dart index a228710..c362d0f 100644 --- a/lib/Screens/Configurations/Section/SubSection/Slider/new_update_image_slider.dart +++ b/lib/Screens/Configurations/Section/SubSection/Slider/new_update_image_slider.dart @@ -1,9 +1,7 @@ -import 'package:auto_size_text/auto_size_text.dart'; import 'package:manager_app/Components/resource_input_container.dart'; import 'package:flutter/material.dart'; import 'package:manager_app/Components/multi_string_input_container.dart'; import 'package:manager_app/Components/rounded_button.dart'; -import 'package:manager_app/Components/text_form_input_container.dart'; import 'package:manager_app/Models/managerContext.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; @@ -100,6 +98,7 @@ Future showNewOrUpdateContentSlider(ContentDTO? inputContentDTO, App isHTML: true, color: kPrimaryColor, initialValue: contentDTO.description != null ? contentDTO.description! : [], + isMandatory: false, onGetResult: (value) { if (contentDTO.description != value) { contentDTO.description = value; diff --git a/lib/Screens/Configurations/Section/SubSection/Slider/slider_config.dart b/lib/Screens/Configurations/Section/SubSection/Slider/slider_config.dart index 848e527..c5abbdd 100644 --- a/lib/Screens/Configurations/Section/SubSection/Slider/slider_config.dart +++ b/lib/Screens/Configurations/Section/SubSection/Slider/slider_config.dart @@ -103,15 +103,12 @@ class _SliderConfigState extends State { child: InkWell( onTap: () async { var result = await showNewOrUpdateContentSlider(null, appContext, context, true, true); - if (result != null) - { - setState(() { - result.order = sliderDTO.contents!.length; - sliderDTO.contents!.add(result); - widget.onChanged(jsonEncode(sliderDTO).toString()); - }); - } - }, + setState(() { + result.order = sliderDTO.contents!.length; + sliderDTO.contents!.add(result); + widget.onChanged(jsonEncode(sliderDTO).toString()); + }); + }, child: Container( height: MediaQuery.of(context).size.width * 0.04, width: MediaQuery.of(context).size.width * 0.04, diff --git a/lib/Screens/Configurations/Section/section_detail_screen.dart b/lib/Screens/Configurations/Section/section_detail_screen.dart index 0525ad8..e16998b 100644 --- a/lib/Screens/Configurations/Section/section_detail_screen.dart +++ b/lib/Screens/Configurations/Section/section_detail_screen.dart @@ -1,6 +1,4 @@ import 'dart:convert'; -import 'dart:io'; -import 'dart:typed_data'; import 'dart:ui'; import 'package:flutter/material.dart'; @@ -174,7 +172,7 @@ class _SectionDetailScreenState extends State { children: [ InkWell( onTap: () async { - var image = await _captureAndSharePng(globalKey, sectionDTO!.id!); + var image = await _captureAndSharePng(globalKey, sectionDTO.id!); await readAndWriteFiles(image); showNotification(kSuccess, kWhite, 'Ce QR code a été copié dans le presse papier', context, null); }, @@ -192,7 +190,7 @@ class _SectionDetailScreenState extends State { ), ), ), - SelectableText(sectionDTO!.id!, style: new TextStyle(fontSize: 15)) + SelectableText(sectionDTO.id!, style: new TextStyle(fontSize: 15)) ], ), CheckInputContainer( @@ -258,6 +256,7 @@ class _SectionDetailScreenState extends State { color: kPrimaryColor, isHTML: true, initialValue: sectionDTO != null ? sectionDTO.description! : [], + isMandatory: false, onGetResult: (value) { if (sectionDTO!.description != value) { sectionDTO.description = value!; @@ -387,19 +386,17 @@ class _SectionDetailScreenState extends State { } Future save(bool isTraduction, SectionDTO sectionDTO, AppContext appContext) async { - if (sectionDTO != null) { - SectionDTO? section = await (appContext.getContext() as ManagerAppContext).clientAPI!.sectionApi!.sectionUpdate(sectionDTO); - ManagerAppContext managerAppContext = appContext.getContext(); - managerAppContext.selectedSection = section; - appContext.setContext(managerAppContext); + SectionDTO? section = await (appContext.getContext() as ManagerAppContext).clientAPI!.sectionApi!.sectionUpdate(sectionDTO); + ManagerAppContext managerAppContext = appContext.getContext(); + managerAppContext.selectedSection = section; + appContext.setContext(managerAppContext); - if (isTraduction) { - showNotification(Colors.green, kWhite, 'Les traductions de la section ont été sauvegardées avec succès', context, null); - } else { - showNotification(Colors.green, kWhite, 'La section a été sauvegardée avec succès', context, null); - } + if (isTraduction) { + showNotification(Colors.green, kWhite, 'Les traductions de la section ont été sauvegardées avec succès', context, null); + } else { + showNotification(Colors.green, kWhite, 'La section a été sauvegardée avec succès', context, null); + } } - } getSpecificData(SectionDTO sectionDTO, AppContext appContext) { switch(sectionDTO.type) { diff --git a/lib/Screens/Devices/dropDown_configuration.dart b/lib/Screens/Devices/dropDown_configuration.dart index ba9d355..5b48ac2 100644 --- a/lib/Screens/Devices/dropDown_configuration.dart +++ b/lib/Screens/Devices/dropDown_configuration.dart @@ -22,8 +22,7 @@ class _DropDownConfigState extends State { @override void initState() { - if (widget.selectedConfigurationId != null) - configurationDTO = widget.configurations.firstWhere((config) => config.id == widget.selectedConfigurationId); + configurationDTO = widget.configurations.firstWhere((config) => config.id == widget.selectedConfigurationId); super.initState(); } diff --git a/lib/Screens/Policy/policy_screen.dart b/lib/Screens/Policy/policy_screen.dart index 315259c..0ffa6b0 100644 --- a/lib/Screens/Policy/policy_screen.dart +++ b/lib/Screens/Policy/policy_screen.dart @@ -1,12 +1,8 @@ -import 'dart:ui' as ui; import 'dart:html'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:manager_app/Components/loading.dart'; import 'package:manager_app/Components/loading_common.dart'; -import 'package:manager_app/Screens/Policy/web_view.dart'; import 'package:manager_app/app_context.dart'; import 'package:provider/provider.dart'; diff --git a/lib/Screens/Policy/web_view.dart b/lib/Screens/Policy/web_view.dart index f7e8c15..bb34ef6 100644 --- a/lib/Screens/Policy/web_view.dart +++ b/lib/Screens/Policy/web_view.dart @@ -55,7 +55,7 @@ class _WebViewWidget extends State { @override - Widget build(BuildContext context) => widget.htmlText != null && widget.htmlText.length > 0 ? + Widget build(BuildContext context) => widget.htmlText.length > 0 ? kIsWeb ? HtmlElementView( key: UniqueKey(), diff --git a/lib/Screens/Resources/get_element_for_resource.dart b/lib/Screens/Resources/get_element_for_resource.dart index e9ef3e0..a8fff6b 100644 --- a/lib/Screens/Resources/get_element_for_resource.dart +++ b/lib/Screens/Resources/get_element_for_resource.dart @@ -1,16 +1,10 @@ -import 'dart:convert'; -import 'dart:typed_data'; import 'package:manager_app/Components/audio_player.dart'; -import 'package:manager_app/Components/loading_common.dart'; import 'package:manager_app/Components/video_viewer.dart'; -import 'package:manager_app/Components/video_viewer_youtube.dart'; -import 'package:manager_app/Models/managerContext.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:manager_api_new/api.dart'; import 'package:flutter/material.dart'; -import 'package:http/http.dart' as http; getElementForResource(dynamic resourceDTO, AppContext appContext) { switch(resourceDTO.type) { diff --git a/lib/Screens/Resources/new_resource_popup.dart b/lib/Screens/Resources/new_resource_popup.dart index 0f44257..2565347 100644 --- a/lib/Screens/Resources/new_resource_popup.dart +++ b/lib/Screens/Resources/new_resource_popup.dart @@ -6,7 +6,6 @@ import 'package:manager_app/Components/message_notification.dart'; import 'package:manager_app/Components/resource_tab.dart'; import 'package:flutter/material.dart'; import 'package:manager_app/Components/rounded_button.dart'; -import 'package:manager_app/Components/string_input_container.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:manager_api_new/api.dart'; diff --git a/lib/Screens/Resources/resource_body_grid.dart b/lib/Screens/Resources/resource_body_grid.dart index 0d461b6..ab3f5b6 100644 --- a/lib/Screens/Resources/resource_body_grid.dart +++ b/lib/Screens/Resources/resource_body_grid.dart @@ -3,7 +3,6 @@ import 'package:flutter/material.dart'; import 'package:manager_app/Components/fetch_resource_icon.dart'; import 'package:manager_app/Components/multi_select_container.dart'; import 'package:manager_app/Components/string_input_container.dart'; -import 'package:manager_app/Models/managerContext.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:manager_api_new/api.dart'; diff --git a/lib/Screens/Resources/resources_screen.dart b/lib/Screens/Resources/resources_screen.dart index 1a723f4..e686567 100644 --- a/lib/Screens/Resources/resources_screen.dart +++ b/lib/Screens/Resources/resources_screen.dart @@ -13,10 +13,7 @@ import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:manager_api_new/api.dart'; import 'package:provider/provider.dart'; -import 'package:http/http.dart' as http; -import 'package:flutter/foundation.dart' show kIsWeb; import 'package:path/path.dart' as Path; -import 'dart:html' as html; class ResourcesScreen extends StatefulWidget { final Function? onGetResult; //return ResourceDTO diff --git a/lib/Screens/login_screen.dart b/lib/Screens/login_screen.dart index 9e43028..1d91baf 100644 --- a/lib/Screens/login_screen.dart +++ b/lib/Screens/login_screen.dart @@ -8,7 +8,6 @@ import 'package:manager_app/Components/message_notification.dart'; import 'package:manager_app/Components/rounded_button.dart'; import 'package:manager_app/Components/rounded_input_field.dart'; import 'package:manager_app/Components/rounded_password_field.dart'; -import 'package:manager_app/Helpers/FileHelper.dart'; import 'package:manager_app/Models/managerContext.dart'; import 'package:manager_app/Models/session.dart'; import 'package:manager_app/Screens/Main/main_screen.dart'; @@ -50,7 +49,7 @@ class _LoginScreenState extends State { clientAPI = Client(this.host!); - if (this.email != null && this.password != null || this.token != null) { + if (this.password != null || this.token != null) { // if () {} // Add if token exist and not null + not expired try { diff --git a/pubspec.lock b/pubspec.lock index f846d3c..038c84a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -632,30 +632,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.8" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: f38a2c91c12f31726ca13015fbab3d2e9440edcb7c17b8b36ed9b85ed6eee6a2 - url: "https://pub.dev" - source: hosted - version: "9.0.11" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: "23770c69594f5260a79fe9d84e29f8b175d1b05d128e751c904b3cdf910e5dfc" - url: "https://pub.dev" - source: hosted - version: "1.0.9" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: b06739349ec2477e943055aea30172c5c7000225f79dad4702e2ec0eda79a6ff - url: "https://pub.dev" - source: hosted - version: "1.0.5" logging: dependency: transitive description: @@ -683,10 +659,10 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.5.0" material_segmented_control: dependency: "direct main" description: @@ -699,10 +675,10 @@ packages: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.10.0" mime: dependency: transitive description: @@ -1276,14 +1252,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: a13d5503b4facefc515c8c587ce3cf69577a7b064a9f1220e005449cf1f64aad - url: "https://pub.dev" - source: hosted - version: "12.0.0" wakelock_plus: dependency: transitive description: