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(
eventAgenda.name!.length > 75 ? eventAgenda.name!.substring(0, 75) + " ..." : eventAgenda.name!,
customStylesBuilder: (element) {
return {'text-align': 'center'};
return {'text-align': 'center', 'font-family': "Roboto"};
},
textStyle: TextStyle(fontSize: 14.0),
),

View File

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

View File

@ -216,7 +216,7 @@ class _MainViewWidget extends State<MainViewWidget> {
Future<ConfigurationDTO?> getCurrentConfiguration(dynamic appContext) async {
TabletAppContext tabletAppContext = await appContext.getContext();
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;
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(
sectionsLocal![index].title!.firstWhere((translation) => translation.language == appContext.getContext().language).value ?? "",
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)),
),

View File

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

View File

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

View File

@ -3,9 +3,11 @@ import 'dart:developer';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:confetti/confetti.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
import 'package:manager_api/api.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! : "",
textStyle: TextStyle(fontSize: kIsWeb ? kWebDescriptionSize : kDescriptionSize),
customStylesBuilder: (element) {
return {'text-align': 'center'};
return {'text-align': 'center', 'font-family': "Roboto"};
},
)
: Text("No data"),
@ -331,7 +333,9 @@ class _QuizzView extends State<QuizzView> {
),
width: MediaQuery.of(context).size.width *0.70,
child: Center(
child: SingleChildScrollView(
child: Container(
//color: Colors.yellow,
//height: size.height * 0.2,
child: Row(
children: [
if(i.label!.firstWhere((translation) => translation.language == appContext.getContext().language).resourceId != null)
@ -348,16 +352,22 @@ class _QuizzView extends State<QuizzView> {
child: getElementForResource(context, appContext, i.label!.firstWhere((translation) => translation.language == appContext.getContext().language), true),
)
),
Padding(
SingleChildScrollView(
child: Container(
//color: Colors.green,
width: i.label!.firstWhere((translation) => translation.language == appContext.getContext().language).resourceId == null ? size.width * 0.65 : size.width * 0.5,
child: Padding(
padding: const EdgeInsets.all(10.0),
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'};
return {'text-align': 'center', 'font-family': "Roboto"};
},
),
),
),
),
],
),
),
@ -422,17 +432,19 @@ class _QuizzView extends State<QuizzView> {
child: getElementForResource(context, appContext, i.responsesSubDTO![index].label!.firstWhere((translation) => translation.language == appContext.getContext().language), true),
)
),
Container(
width: size.width * 0.1,
SingleChildScrollView(
child: Container(
width: i.responsesSubDTO![index].label!.firstWhere((translation) => translation.language == appContext.getContext().language).resourceId == null ? size.width * 0.3 : size.width * 0.13,
//color: Colors.yellow,
child: HtmlWidget(
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),
customStylesBuilder: (element) {
return {'text-align': 'center'};
return {'text-align': 'center', 'font-family': "Roboto"};
},
),
),
),
],
),
decoration: BoxDecoration(
@ -582,7 +594,7 @@ getElementForResource(BuildContext context, AppContext appContext, TranslationAn
//color: kBackgroundLight,
image: DecorationImage(
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)),
/*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! : "",
textStyle: TextStyle(fontSize: kIsWeb ? kWebDescriptionSize : kDescriptionSize),
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! : "",
textStyle: TextStyle(fontSize: kIsWeb ? kWebDescriptionSize : kDescriptionSize, color: i.chosen == index ? Colors.white : Colors.black),
customStylesBuilder: (element) {
return {'text-align': 'center'};
return {'text-align': 'center', 'font-family': "Roboto"};
},
),
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! : "",
textStyle: TextStyle(fontSize: kIsWeb ? kWebDescriptionSize : kDescriptionSize),
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;
try{
// 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) {
print("Erreur lors du téléchargement de la configuration et de ses ressources !");
print(e);