diff --git a/lib/Screens/Configurations/Section/SubSection/Menu/menu_config.dart b/lib/Screens/Configurations/Section/SubSection/Menu/menu_config.dart index a30a6a9..c6132b0 100644 --- a/lib/Screens/Configurations/Section/SubSection/Menu/menu_config.dart +++ b/lib/Screens/Configurations/Section/SubSection/Menu/menu_config.dart @@ -118,7 +118,9 @@ class _MenuConfigState extends State { menuDTO.sections.add(newSubsection); widget.onChanged(jsonEncode(menuDTO).toString()); }); - }); + }, + false + ); }, child: Container( height: MediaQuery.of(context).size.width * 0.04, diff --git a/lib/Screens/Configurations/new_section_popup.dart b/lib/Screens/Configurations/new_section_popup.dart index bba81c1..f9b0f14 100644 --- a/lib/Screens/Configurations/new_section_popup.dart +++ b/lib/Screens/Configurations/new_section_popup.dart @@ -8,11 +8,12 @@ import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:managerapi/api.dart'; -void showNewSection(String configurationId, AppContext appContext, BuildContext context, bool isSubSection, Function sendSubSection) { +void showNewSection(String configurationId, AppContext appContext, BuildContext contextBuild, bool isSubSection, Function sendSubSection, bool isMobile) { SectionDTO sectionDTO = new SectionDTO(); sectionDTO.configurationId = configurationId; sectionDTO.isSubSection = isSubSection; sectionDTO.parentId = isSubSection ? appContext.getContext().selectedSection.id : null; + Size size = MediaQuery.of(contextBuild).size; showDialog( builder: (BuildContext context) => AlertDialog( @@ -20,31 +21,35 @@ void showNewSection(String configurationId, AppContext appContext, BuildContext borderRadius: BorderRadius.all(Radius.circular(20.0)) ), content: SingleChildScrollView( - 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: ["Map"], - isMultiple: false, - values: isSubSection ? section_types.where((sectionType) => sectionType != "Menu").toList(): section_types, // Todo get menu by enum type - onChanged: (value) { - var tempOutput = new List.from(value); - sectionDTO.type = SectionType.fromJson(tempOutput[0]); - }, - ), - ], - ), - ], + 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").toList(): isSubSection ? section_types.where((sectionType) => sectionType != "Menu").toList(): section_types, // Todo get menu by enum type + onChanged: (value) { + var tempOutput = new List.from(value); + sectionDTO.type = SectionType.fromJson(tempOutput[0]); + }, + ), + ], + ), + ], + ), ), ), actions: [ @@ -88,7 +93,7 @@ void showNewSection(String configurationId, AppContext appContext, BuildContext ], ), ], - ), context: context + ), context: contextBuild ); } diff --git a/lib/Screens/Configurations/section_reorderList.dart b/lib/Screens/Configurations/section_reorderList.dart index 3d7dbbe..185d6ef 100644 --- a/lib/Screens/Configurations/section_reorderList.dart +++ b/lib/Screens/Configurations/section_reorderList.dart @@ -58,6 +58,9 @@ class _SectionReorderListState extends State { final appContext = Provider.of(context); Size size = MediaQuery.of(context).size; + ManagerAppContext managerAppContext = appContext.getContext(); + ConfigurationDTO currentConfiguration = managerAppContext.selectedConfiguration; + return Stack( children: [ Padding( @@ -138,7 +141,7 @@ class _SectionReorderListState extends State { right: 10, child: InkWell( onTap: () { - showNewSection(widget.configurationId, appContext, context, false, null); + showNewSection(widget.configurationId, appContext, context, false, null, currentConfiguration.isMobile); }, child: Container( height: MediaQuery.of(context).size.width * 0.04,