From 163ce71e388d7558febf502cd75480c9b326cb4d Mon Sep 17 00:00:00 2001 From: Fransolet Thomas Date: Thu, 23 Feb 2023 17:22:48 +0100 Subject: [PATCH] Enable quizz section type for mobile and don't show other when MyVisit is true + update readme --- README.md | 2 ++ .../Configurations/configuration_detail_screen.dart | 13 ++++++++++--- lib/Screens/Configurations/new_section_popup.dart | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 91b8bc7..a18b3af 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,8 @@ Le fichier est dans le projet. # Publication sur docker +Avant de build en docker, il faut build en web => flutter build web + docker build -t flutter-web . Pour tester en local : diff --git a/lib/Screens/Configurations/configuration_detail_screen.dart b/lib/Screens/Configurations/configuration_detail_screen.dart index dea9d81..131f957 100644 --- a/lib/Screens/Configurations/configuration_detail_screen.dart +++ b/lib/Screens/Configurations/configuration_detail_screen.dart @@ -305,10 +305,17 @@ class _ConfigurationDetailScreenState extends State { child: FutureBuilder( future: getSections(configurationDTO, appContext.getContext().clientAPI), builder: (context, AsyncSnapshot snapshot) { - if (snapshot.connectionState == ConnectionState.done) { - sections = new List.from(snapshot.data).where((section) => !section.isSubSection).toList(); + if (snapshot.connectionState == ConnectionState.done) + { + if(configurationDTO.isMobile) { + // Only see Article and Quizz type + sections = new List.from(snapshot.data).where((section) => !section.isSubSection && (section.type == SectionType.Article || section.type == SectionType.Quizz)).toList(); + } else { + sections = new List.from(snapshot.data).where((section) => !section.isSubSection).toList(); + } return bodyGrid(configurationDTO, size, appContext); - } else if (snapshot.connectionState == ConnectionState.none) { + } + else if (snapshot.connectionState == ConnectionState.none) { return Text("No data"); } else { return Center( diff --git a/lib/Screens/Configurations/new_section_popup.dart b/lib/Screens/Configurations/new_section_popup.dart index 49a7f7c..9f4396e 100644 --- a/lib/Screens/Configurations/new_section_popup.dart +++ b/lib/Screens/Configurations/new_section_popup.dart @@ -41,7 +41,7 @@ void showNewSection(String configurationId, AppContext appContext, BuildContext label: "Type :", initialValue: isMobile ? ["Article"] : ["Map"], isMultiple: false, - values: isMobile ? section_types.where((sectionType) => sectionType == "Article").toList(): isSubSection ? section_types.where((sectionType) => sectionType != "Menu" && sectionType != "Article").toList(): section_types.where((sectionType) => sectionType != "Article").toList(), // Todo get menu by enum type + 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]);