Udpate layout, remove buttons if not tablet modd

This commit is contained in:
Thomas Fransolet 2024-07-07 21:33:56 +02:00
parent d79c4882fc
commit ccfe283d67
2 changed files with 65 additions and 59 deletions

View File

@ -205,15 +205,16 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
} }
}, },
), ),
CheckInputContainer( if(configurationDTO.isTablet!)
icon: Icons.image, CheckInputContainer(
label: "Fond pour les images des sections :", icon: Icons.image,
fontSize: 20, label: "Fond pour les images des sections :",
isChecked: configurationDTO.isSectionImageBackground, fontSize: 20,
onChanged: (value) { isChecked: configurationDTO.isSectionImageBackground,
configurationDTO.isSectionImageBackground = value; onChanged: (value) {
}, configurationDTO.isSectionImageBackground = value;
), },
),
], ],
), ),
Column( Column(
@ -258,24 +259,26 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
PDFHelper.downloadPDF(managerAppContext, sections!); PDFHelper.downloadPDF(managerAppContext, sections!);
}, },
), ),
CheckInputContainer( if(configurationDTO.isTablet!)
icon: Icons.date_range, CheckInputContainer(
label: "Date :", icon: Icons.date_range,
fontSize: 20, label: "Date :",
isChecked: configurationDTO.isDate, fontSize: 20,
onChanged: (value) { isChecked: configurationDTO.isDate,
configurationDTO.isDate = value; onChanged: (value) {
}, configurationDTO.isDate = value;
), },
CheckInputContainer( ),
icon: Icons.watch_later_outlined, if(configurationDTO.isTablet!)
label: "Heure :", CheckInputContainer(
fontSize: 20, icon: Icons.watch_later_outlined,
isChecked: configurationDTO.isHour, label: "Heure :",
onChanged: (value) { fontSize: 20,
configurationDTO.isHour = value; isChecked: configurationDTO.isHour,
}, onChanged: (value) {
), configurationDTO.isHour = value;
},
),
], ],
), ),
Column( Column(
@ -334,40 +337,42 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
} }
}, },
), ),
Container( if(configurationDTO.isTablet!)
height: 100, Container(
child: NumberInputContainer( height: 100,
label: "Place des sections (%) :", child: NumberInputContainer(
initialValue: configurationDTO.screenPercentageSectionsMainPage ?? 0, label: "Place des sections (%) :",
isSmall: true, initialValue: configurationDTO.screenPercentageSectionsMainPage ?? 0,
maxLength: 3, isSmall: true,
onChanged: (value) { maxLength: 3,
try { onChanged: (value) {
configurationDTO.screenPercentageSectionsMainPage = int.parse(value); try {
} catch (e) { configurationDTO.screenPercentageSectionsMainPage = int.parse(value);
print('Screen percentage value not a number'); } catch (e) {
showNotification(Colors.orange, kWhite, 'Cela doit être un chiffre', context, null); print('Screen percentage value not a number');
} showNotification(Colors.orange, kWhite, 'Cela doit être un chiffre', context, null);
}, }
},
),
), ),
), if(configurationDTO.isTablet!)
Container( Container(
height: 100, height: 100,
child: NumberInputContainer( child: NumberInputContainer(
label: "Pourcentage des arrondis (0-50) :", label: "Pourcentage des arrondis (0-50) :",
initialValue: configurationDTO.roundedValue ?? 0, initialValue: configurationDTO.roundedValue ?? 0,
isSmall: true, isSmall: true,
maxLength: 2, maxLength: 2,
onChanged: (value) { onChanged: (value) {
try { try {
configurationDTO.roundedValue = int.parse(value); configurationDTO.roundedValue = int.parse(value);
} catch (e) { } catch (e) {
print('Rounded value not a number'); print('Rounded value not a number');
showNotification(Colors.orange, kWhite, 'Cela doit être un chiffre', context, null); showNotification(Colors.orange, kWhite, 'Cela doit être un chiffre', context, null);
} }
}, },
),
), ),
),
// It's a section now // It's a section now
/*SizedBox( /*SizedBox(
height: 100, height: 100,

View File

@ -147,6 +147,7 @@ void create(ConfigurationDTO configurationDTO, AppContext appContext, context) a
configurationDTO.isOffline = false; configurationDTO.isOffline = false;
configurationDTO.isDate = false; configurationDTO.isDate = false;
configurationDTO.isHour = false; configurationDTO.isHour = false;
configurationDTO.isSectionImageBackground = false;
configurationDTO.isWeather = false; configurationDTO.isWeather = false;
configurationDTO.instanceId = (appContext.getContext() as ManagerAppContext).instanceId; configurationDTO.instanceId = (appContext.getContext() as ManagerAppContext).instanceId;
await (appContext.getContext() as ManagerAppContext).clientAPI!.configurationApi!.configurationCreate(configurationDTO); await (appContext.getContext() as ManagerAppContext).clientAPI!.configurationApi!.configurationCreate(configurationDTO);