From ccfe283d6728924aad8c24e7be4215a08e3bacd0 Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Sun, 7 Jul 2024 21:33:56 +0200 Subject: [PATCH] Udpate layout, remove buttons if not tablet modd --- .../configuration_detail_screen.dart | 123 +++++++++--------- .../new_configuration_popup.dart | 1 + 2 files changed, 65 insertions(+), 59 deletions(-) diff --git a/lib/Screens/Configurations/configuration_detail_screen.dart b/lib/Screens/Configurations/configuration_detail_screen.dart index f8c1281..5819264 100644 --- a/lib/Screens/Configurations/configuration_detail_screen.dart +++ b/lib/Screens/Configurations/configuration_detail_screen.dart @@ -205,15 +205,16 @@ class _ConfigurationDetailScreenState extends State { } }, ), - CheckInputContainer( - icon: Icons.image, - label: "Fond pour les images des sections :", - fontSize: 20, - isChecked: configurationDTO.isSectionImageBackground, - onChanged: (value) { - configurationDTO.isSectionImageBackground = value; - }, - ), + if(configurationDTO.isTablet!) + CheckInputContainer( + icon: Icons.image, + label: "Fond pour les images des sections :", + fontSize: 20, + isChecked: configurationDTO.isSectionImageBackground, + onChanged: (value) { + configurationDTO.isSectionImageBackground = value; + }, + ), ], ), Column( @@ -258,24 +259,26 @@ class _ConfigurationDetailScreenState extends State { PDFHelper.downloadPDF(managerAppContext, 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; - }, - ), + if(configurationDTO.isTablet!) + CheckInputContainer( + icon: Icons.date_range, + label: "Date :", + fontSize: 20, + isChecked: configurationDTO.isDate, + onChanged: (value) { + configurationDTO.isDate = value; + }, + ), + if(configurationDTO.isTablet!) + CheckInputContainer( + icon: Icons.watch_later_outlined, + label: "Heure :", + fontSize: 20, + isChecked: configurationDTO.isHour, + onChanged: (value) { + configurationDTO.isHour = value; + }, + ), ], ), Column( @@ -334,40 +337,42 @@ class _ConfigurationDetailScreenState extends State { } }, ), - Container( - height: 100, - child: NumberInputContainer( - label: "Place des sections (%) :", - initialValue: configurationDTO.screenPercentageSectionsMainPage ?? 0, - isSmall: true, - maxLength: 3, - onChanged: (value) { - try { - configurationDTO.screenPercentageSectionsMainPage = int.parse(value); - } catch (e) { - print('Screen percentage value not a number'); - showNotification(Colors.orange, kWhite, 'Cela doit être un chiffre', context, null); - } - }, + if(configurationDTO.isTablet!) + Container( + height: 100, + child: NumberInputContainer( + label: "Place des sections (%) :", + initialValue: configurationDTO.screenPercentageSectionsMainPage ?? 0, + isSmall: true, + maxLength: 3, + onChanged: (value) { + try { + configurationDTO.screenPercentageSectionsMainPage = int.parse(value); + } catch (e) { + print('Screen percentage value not a number'); + showNotification(Colors.orange, kWhite, 'Cela doit être un chiffre', context, null); + } + }, + ), ), - ), - Container( - height: 100, - child: NumberInputContainer( - label: "Pourcentage des arrondis (0-50) :", - initialValue: configurationDTO.roundedValue ?? 0, - isSmall: true, - maxLength: 2, - onChanged: (value) { - try { - configurationDTO.roundedValue = int.parse(value); - } catch (e) { - print('Rounded value not a number'); - showNotification(Colors.orange, kWhite, 'Cela doit être un chiffre', context, null); - } - }, + if(configurationDTO.isTablet!) + Container( + height: 100, + child: NumberInputContainer( + label: "Pourcentage des arrondis (0-50) :", + initialValue: configurationDTO.roundedValue ?? 0, + isSmall: true, + maxLength: 2, + onChanged: (value) { + try { + configurationDTO.roundedValue = int.parse(value); + } catch (e) { + print('Rounded value not a number'); + showNotification(Colors.orange, kWhite, 'Cela doit être un chiffre', context, null); + } + }, + ), ), - ), // It's a section now /*SizedBox( height: 100, diff --git a/lib/Screens/Configurations/new_configuration_popup.dart b/lib/Screens/Configurations/new_configuration_popup.dart index 90b3e94..8aaebdd 100644 --- a/lib/Screens/Configurations/new_configuration_popup.dart +++ b/lib/Screens/Configurations/new_configuration_popup.dart @@ -147,6 +147,7 @@ void create(ConfigurationDTO configurationDTO, AppContext appContext, context) a configurationDTO.isOffline = false; configurationDTO.isDate = false; configurationDTO.isHour = false; + configurationDTO.isSectionImageBackground = false; configurationDTO.isWeather = false; configurationDTO.instanceId = (appContext.getContext() as ManagerAppContext).instanceId; await (appContext.getContext() as ManagerAppContext).clientAPI!.configurationApi!.configurationCreate(configurationDTO);