try fix menu title size + quizz + other layout

This commit is contained in:
Thomas Fransolet 2024-04-24 11:47:19 +02:00
parent 3e3b8a3239
commit b7c4032a17
10 changed files with 62 additions and 44 deletions

View File

@ -139,7 +139,7 @@ class EventListItem extends StatelessWidget {
HtmlWidget( HtmlWidget(
eventAgenda.name!.length > 75 ? eventAgenda.name!.substring(0, 75) + " ..." : eventAgenda.name!, eventAgenda.name!.length > 75 ? eventAgenda.name!.substring(0, 75) + " ..." : eventAgenda.name!,
customStylesBuilder: (element) { customStylesBuilder: (element) {
return {'text-align': 'center'}; return {'text-align': 'center', 'font-family': "Roboto"};
}, },
textStyle: TextStyle(fontSize: 14.0), textStyle: TextStyle(fontSize: 14.0),
), ),

View File

@ -245,7 +245,7 @@ class _EventPopupState extends State<EventPopup> {
HtmlWidget( HtmlWidget(
widget.eventAgenda.description!, widget.eventAgenda.description!,
customStylesBuilder: (element) { customStylesBuilder: (element) {
return {'text-align': 'left'}; return {'text-align': 'left', 'font-family': "Roboto"};
}, },
textStyle: TextStyle(fontSize: kDescriptionSize), textStyle: TextStyle(fontSize: kDescriptionSize),
), ),

View File

@ -216,7 +216,7 @@ class _MainViewWidget extends State<MainViewWidget> {
Future<ConfigurationDTO?> getCurrentConfiguration(dynamic appContext) async { Future<ConfigurationDTO?> getCurrentConfiguration(dynamic appContext) async {
TabletAppContext tabletAppContext = await appContext.getContext(); TabletAppContext tabletAppContext = await appContext.getContext();
try { try {
ConfigurationDTO? configurationDTO = await tabletAppContext.clientAPI!.configurationApi!.configurationGetDetail(tabletAppContext.configuration!.id!); ConfigurationDTO? configurationDTO = await tabletAppContext.clientAPI!.configurationApi!.configurationGetDetail(tabletAppContext.configuration!.id!); // tabletAppContext.configuration!.id! // 65c5f0ee4c030e63ce16bff5 TODO Remove
tabletAppContext.configuration = configurationDTO; tabletAppContext.configuration = configurationDTO;
backgroundColor = tabletAppContext.configuration != null ? new Color(int.parse(appContext.getContext().configuration.secondaryColor.split('(0x')[1].split(')')[0], radix: 16)) : Colors.white; backgroundColor = tabletAppContext.configuration != null ? new Color(int.parse(appContext.getContext().configuration.secondaryColor.split('(0x')[1].split(')')[0], radix: 16)) : Colors.white;
@ -348,7 +348,7 @@ class _MainViewWidget extends State<MainViewWidget> {
child: HtmlWidget( child: HtmlWidget(
sectionsLocal![index].title!.firstWhere((translation) => translation.language == appContext.getContext().language).value ?? "", sectionsLocal![index].title!.firstWhere((translation) => translation.language == appContext.getContext().language).value ?? "",
customStylesBuilder: (element) { customStylesBuilder: (element) {
return {'text-align': 'right'}; return {'text-align': 'right', 'font-family': "Roboto"};
}, },
textStyle: TextStyle(fontSize: isPortrait ? 10 : 25),//calculateFontSize(constraints.maxWidth, constraints.maxHeight, kIsWeb ? kWebMenuTitleDetailSize : kMenuTitleDetailSize)), textStyle: TextStyle(fontSize: isPortrait ? 10 : 25),//calculateFontSize(constraints.maxWidth, constraints.maxHeight, kIsWeb ? kWebMenuTitleDetailSize : kMenuTitleDetailSize)),
), ),

View File

@ -186,7 +186,7 @@ class _MarkerInfoWidget extends State<MarkerViewWidget> {
HtmlWidget( HtmlWidget(
selectedPoint.description!.firstWhere((d) => d.language == language).value!, selectedPoint.description!.firstWhere((d) => d.language == language).value!,
customStylesBuilder: (element) { customStylesBuilder: (element) {
return {'text-align': 'left'}; return {'text-align': 'left', 'font-family': "Roboto"};
}, },
textStyle: TextStyle(fontSize: kDescriptionSize), textStyle: TextStyle(fontSize: kDescriptionSize),
), ),

View File

@ -66,7 +66,7 @@ class _MenuView extends State<MenuView> {
return Center( return Center(
child: GridView.builder( child: GridView.builder(
shrinkWrap: true, shrinkWrap: true,
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: kIsWeb ? 1.7 : 1.4), gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: kIsWeb ? 1.7 : 1.2),
itemCount: menuDTO.sections!.length, itemCount: menuDTO.sections!.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return InkWell( return InkWell(
@ -87,8 +87,8 @@ class _MenuView extends State<MenuView> {
}, },
child: Container( child: Container(
decoration: isImageBackground ? boxDecoration(appContext, menuDTO.sections![index], false) : null, decoration: isImageBackground ? boxDecoration(appContext, menuDTO.sections![index], false) : null,
padding: const EdgeInsets.all(25), padding: const EdgeInsets.all(12),
margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15), margin: EdgeInsets.symmetric(vertical: 8, horizontal: 8),
child: isImageBackground ? Align( child: isImageBackground ? Align(
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,
child: FractionallySizedBox( child: FractionallySizedBox(
@ -100,9 +100,9 @@ class _MenuView extends State<MenuView> {
child: HtmlWidget( child: HtmlWidget(
menuDTO.sections![index].title!.firstWhere((translation) => translation.language == appContext.getContext().language).value!, menuDTO.sections![index].title!.firstWhere((translation) => translation.language == appContext.getContext().language).value!,
customStylesBuilder: (element) { customStylesBuilder: (element) {
return {'text-align': 'right'}; return {'text-align': 'right', 'font-family': "Roboto"};
}, },
textStyle: new TextStyle(fontSize: kIsWeb? kWebMenuTitleDetailSize : kMenuTitleDetailSize), textStyle: new TextStyle(fontSize: kMenuTitleDetailSize),
), ),
), ),
/*Align( /*Align(
@ -121,7 +121,7 @@ class _MenuView extends State<MenuView> {
) : Column( ) : Column(
children: [ children: [
Expanded( Expanded(
flex: 8, flex: 7,
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: menuDTO.sections![index].imageSource == null ? kBackgroundColor : null, // default color if no image color: menuDTO.sections![index].imageSource == null ? kBackgroundColor : null, // default color if no image
@ -134,14 +134,20 @@ class _MenuView extends State<MenuView> {
) )
), ),
Expanded( Expanded(
flex: 2, flex: 3,
child: Center( child: Container(
child: HtmlWidget( //color: Colors.yellow,
menuDTO.sections![index].title!.firstWhere((translation) => translation.language == appContext.getContext().language).value ?? "", constraints: BoxConstraints(
customStylesBuilder: (element) { maxWidth: size.width * 0.3,
return {'text-align': 'center', 'font-family': "Roboto"}; ),
}, child: Center(
textStyle: TextStyle(fontSize: 25),//calculateFontSize(constraints.maxWidth, constraints.maxHeight, kIsWeb ? kWebMenuTitleDetailSize : kMenuTitleDetailSize)), child: HtmlWidget(
menuDTO.sections![index].title!.firstWhere((translation) => translation.language == appContext.getContext().language).value ?? "",
customStylesBuilder: (element) {
return {'text-align': 'center', 'font-family': "Roboto"};
},
textStyle: TextStyle(fontSize: 20),//calculateFontSize(constraints.maxWidth, constraints.maxHeight, kIsWeb ? kWebMenuTitleDetailSize : kMenuTitleDetailSize)),
),
), ),
) )
) )

View File

@ -49,7 +49,7 @@ void showMessage(TranslationAndResourceDTO translationAndResourceDTO, AppContext
child: HtmlWidget( child: HtmlWidget(
translationAndResourceDTO.value!, translationAndResourceDTO.value!,
customStylesBuilder: (element) { customStylesBuilder: (element) {
return {'text-align': 'center'}; return {'text-align': 'center', 'font-family': "Roboto"};
}, },
textStyle: TextStyle(fontSize: kDescriptionSize), textStyle: TextStyle(fontSize: kDescriptionSize),
),/*Text( ),/*Text(

View File

@ -3,9 +3,11 @@ import 'dart:developer';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:carousel_slider/carousel_slider.dart'; import 'package:carousel_slider/carousel_slider.dart';
import 'package:confetti/confetti.dart'; import 'package:confetti/confetti.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
import 'package:manager_api/api.dart'; import 'package:manager_api/api.dart';
import 'package:photo_view/photo_view.dart'; import 'package:photo_view/photo_view.dart';
@ -169,7 +171,7 @@ class _QuizzView extends State<QuizzView> {
levelToShow.label!.firstWhere((translation) => translation.language == appContext.getContext().language).value != null ? levelToShow.label!.firstWhere((translation) => translation.language == appContext.getContext().language).value! : "", levelToShow.label!.firstWhere((translation) => translation.language == appContext.getContext().language).value != null ? levelToShow.label!.firstWhere((translation) => translation.language == appContext.getContext().language).value! : "",
textStyle: TextStyle(fontSize: kIsWeb ? kWebDescriptionSize : kDescriptionSize), textStyle: TextStyle(fontSize: kIsWeb ? kWebDescriptionSize : kDescriptionSize),
customStylesBuilder: (element) { customStylesBuilder: (element) {
return {'text-align': 'center'}; return {'text-align': 'center', 'font-family': "Roboto"};
}, },
) )
: Text("No data"), : Text("No data"),
@ -331,7 +333,9 @@ class _QuizzView extends State<QuizzView> {
), ),
width: MediaQuery.of(context).size.width *0.70, width: MediaQuery.of(context).size.width *0.70,
child: Center( child: Center(
child: SingleChildScrollView( child: Container(
//color: Colors.yellow,
//height: size.height * 0.2,
child: Row( child: Row(
children: [ children: [
if(i.label!.firstWhere((translation) => translation.language == appContext.getContext().language).resourceId != null) if(i.label!.firstWhere((translation) => translation.language == appContext.getContext().language).resourceId != null)
@ -348,14 +352,20 @@ class _QuizzView extends State<QuizzView> {
child: getElementForResource(context, appContext, i.label!.firstWhere((translation) => translation.language == appContext.getContext().language), true), child: getElementForResource(context, appContext, i.label!.firstWhere((translation) => translation.language == appContext.getContext().language), true),
) )
), ),
Padding( SingleChildScrollView(
padding: const EdgeInsets.all(10.0), child: Container(
child: HtmlWidget( //color: Colors.green,
i.label!.firstWhere((translation) => translation.language == appContext.getContext().language).value != null ? i.label!.firstWhere((translation) => translation.language == appContext.getContext().language).value! : "", width: i.label!.firstWhere((translation) => translation.language == appContext.getContext().language).resourceId == null ? size.width * 0.65 : size.width * 0.5,
textStyle: TextStyle(fontSize: kIsWeb ? kWebDescriptionSize : kDescriptionSize), child: Padding(
customStylesBuilder: (element) { padding: const EdgeInsets.all(10.0),
return {'text-align': 'center'}; child: HtmlWidget(
}, i.label!.firstWhere((translation) => translation.language == appContext.getContext().language).value != null ? i.label!.firstWhere((translation) => translation.language == appContext.getContext().language).value! : "",
textStyle: TextStyle(fontSize: kIsWeb ? kWebDescriptionSize : kDescriptionSize),
customStylesBuilder: (element) {
return {'text-align': 'center', 'font-family': "Roboto"};
},
),
),
), ),
), ),
], ],
@ -422,15 +432,17 @@ class _QuizzView extends State<QuizzView> {
child: getElementForResource(context, appContext, i.responsesSubDTO![index].label!.firstWhere((translation) => translation.language == appContext.getContext().language), true), child: getElementForResource(context, appContext, i.responsesSubDTO![index].label!.firstWhere((translation) => translation.language == appContext.getContext().language), true),
) )
), ),
Container( SingleChildScrollView(
width: size.width * 0.1, child: Container(
//color: Colors.yellow, width: i.responsesSubDTO![index].label!.firstWhere((translation) => translation.language == appContext.getContext().language).resourceId == null ? size.width * 0.3 : size.width * 0.13,
child: HtmlWidget( //color: Colors.yellow,
i.responsesSubDTO![index].label!.firstWhere((translation) => translation.language == appContext.getContext().language).value != null ? i.responsesSubDTO![index].label!.firstWhere((translation) => translation.language == appContext.getContext().language).value! : "", child: HtmlWidget(
textStyle: TextStyle(fontSize: kIsWeb ? kWebDescriptionSize : kDescriptionSize, color: i.chosen == index ? Colors.white : Colors.black), i.responsesSubDTO![index].label!.firstWhere((translation) => translation.language == appContext.getContext().language).value != null ? i.responsesSubDTO![index].label!.firstWhere((translation) => translation.language == appContext.getContext().language).value! : "",
customStylesBuilder: (element) { textStyle: TextStyle(fontSize: kIsWeb ? kWebDescriptionSize : kDescriptionSize, color: i.chosen == index ? Colors.white : Colors.black),
return {'text-align': 'center'}; customStylesBuilder: (element) {
}, return {'text-align': 'center', 'font-family': "Roboto"};
},
),
), ),
), ),
], ],
@ -582,7 +594,7 @@ getElementForResource(BuildContext context, AppContext appContext, TranslationAn
//color: kBackgroundLight, //color: kBackgroundLight,
image: DecorationImage( image: DecorationImage(
image: ImageCustomProvider.getImageProvider(appContext, i.resourceId!, i.resourceUrl!), image: ImageCustomProvider.getImageProvider(appContext, i.resourceId!, i.resourceUrl!),
fit: BoxFit.cover, fit: BoxFit.contain,
), ),
borderRadius: BorderRadius.all(Radius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 15.0)), borderRadius: BorderRadius.all(Radius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 15.0)),
/*border: Border.all( /*border: Border.all(

View File

@ -133,7 +133,7 @@ class _ShowReponsesWidget extends State<ShowReponsesWidget> {
i.label!.firstWhere((translation) => translation.language == appContext.getContext().language).value != null ? i.label!.firstWhere((translation) => translation.language == appContext.getContext().language).value! : "", i.label!.firstWhere((translation) => translation.language == appContext.getContext().language).value != null ? i.label!.firstWhere((translation) => translation.language == appContext.getContext().language).value! : "",
textStyle: TextStyle(fontSize: kIsWeb ? kWebDescriptionSize : kDescriptionSize), textStyle: TextStyle(fontSize: kIsWeb ? kWebDescriptionSize : kDescriptionSize),
customStylesBuilder: (element) { customStylesBuilder: (element) {
return {'text-align': 'center'}; return {'text-align': 'center', 'font-family': "Roboto"};
}, },
), ),
), ),
@ -171,7 +171,7 @@ class _ShowReponsesWidget extends State<ShowReponsesWidget> {
i.responsesSubDTO![index].label!.firstWhere((translation) => translation.language == appContext.getContext().language).value != null ? i.responsesSubDTO![index].label!.firstWhere((translation) => translation.language == appContext.getContext().language).value! : "", i.responsesSubDTO![index].label!.firstWhere((translation) => translation.language == appContext.getContext().language).value != null ? i.responsesSubDTO![index].label!.firstWhere((translation) => translation.language == appContext.getContext().language).value! : "",
textStyle: TextStyle(fontSize: kIsWeb ? kWebDescriptionSize : kDescriptionSize, color: i.chosen == index ? Colors.white : Colors.black), textStyle: TextStyle(fontSize: kIsWeb ? kWebDescriptionSize : kDescriptionSize, color: i.chosen == index ? Colors.white : Colors.black),
customStylesBuilder: (element) { customStylesBuilder: (element) {
return {'text-align': 'center'}; return {'text-align': 'center', 'font-family': "Roboto"};
}, },
), ),
decoration: BoxDecoration( decoration: BoxDecoration(

View File

@ -154,7 +154,7 @@ class _SliderView extends State<SliderView> {
i.description!.firstWhere((translation) => translation.language == appContext.getContext().language).value != null ? i.description!.firstWhere((translation) => translation.language == appContext.getContext().language).value! : "", i.description!.firstWhere((translation) => translation.language == appContext.getContext().language).value != null ? i.description!.firstWhere((translation) => translation.language == appContext.getContext().language).value! : "",
textStyle: TextStyle(fontSize: kIsWeb ? kWebDescriptionSize : kDescriptionSize), textStyle: TextStyle(fontSize: kIsWeb ? kWebDescriptionSize : kDescriptionSize),
customStylesBuilder: (element) { customStylesBuilder: (element) {
return {'text-align': 'center'}; return {'text-align': 'center', 'font-family': "Roboto"};
}, },
), ),
), ),

View File

@ -84,7 +84,7 @@ class _DownloadConfigurationWidgetState extends State<DownloadConfigurationWidge
ExportConfigurationDTO? exportConfigurationDTO; ExportConfigurationDTO? exportConfigurationDTO;
try{ try{
// Retrieve all url from resource to download (get all resource from configuration en somme) // Retrieve all url from resource to download (get all resource from configuration en somme)
exportConfigurationDTO = await tabletAppContext.clientAPI!.configurationApi!.configurationExport(tabletAppContext.configuration!.id!); exportConfigurationDTO = await tabletAppContext.clientAPI!.configurationApi!.configurationExport(tabletAppContext.configuration!.id!); // tabletAppContext.configuration!.id! // 65c5f0ee4c030e63ce16bff5 TODO Remove
} catch(e) { } catch(e) {
print("Erreur lors du téléchargement de la configuration et de ses ressources !"); print("Erreur lors du téléchargement de la configuration et de ses ressources !");
print(e); print(e);