Fix bugs + optimize layout

This commit is contained in:
Thomas Fransolet 2024-03-21 16:02:22 +01:00
parent 1e4baa7ecd
commit a28eeedf61
6 changed files with 50 additions and 100 deletions

Binary file not shown.

View File

@ -111,7 +111,7 @@ class _EventPopupState extends State<EventPopup> {
borderRadius: BorderRadius.all(Radius.circular(20.0)), borderRadius: BorderRadius.all(Radius.circular(20.0)),
color: kBackgroundColor, color: kBackgroundColor,
), ),
height: size.height * 0.8, height: size.height * 0.85,
child: Stack( child: Stack(
children: [ children: [
Positioned( Positioned(
@ -181,14 +181,15 @@ class _EventPopupState extends State<EventPopup> {
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: SizedBox( child: Container(
height: size.height * 0.11, color: Colors.green,
width: size.width * 0.7, height: size.height * 0.13,
width: size.width * 0.65,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
height: size.height * 0.06, height: size.height * 0.08,
child: HtmlWidget( child: HtmlWidget(
widget.eventAgenda.name!, widget.eventAgenda.name!,
textStyle: TextStyle(fontSize: 23.0), textStyle: TextStyle(fontSize: 23.0),

View File

@ -455,18 +455,14 @@ class _MainViewWidget extends State<MainViewWidget> {
}, },
child: Container( child: Container(
decoration: boxDecoration(appContext, sectionsLocal![index], false), decoration: boxDecoration(appContext, sectionsLocal![index], false),
padding: const EdgeInsets.all(25), padding: const EdgeInsets.all(18),
margin: EdgeInsets.symmetric(vertical: 25, horizontal: 25), margin: EdgeInsets.symmetric(vertical: 25, horizontal: 25),
child: Align( child: Align(
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,
child: FractionallySizedBox( child: FractionallySizedBox(
heightFactor: 0.4, heightFactor: 0.5,
child: Container( child: Container(
//color: Colors.green, //color: Colors.green,
child: Column(
children: [
Container(
//color: Colors.orange,
child: SizedBox( child: SizedBox(
width: double.infinity, width: double.infinity,
child: Align( child: Align(
@ -480,55 +476,6 @@ class _MainViewWidget extends State<MainViewWidget> {
), ),
), ),
), ),
),
Container(
//color: Colors.red,
child: SizedBox(
width: double.infinity,
child: Align(
alignment: Alignment.centerRight,
child: HtmlWidget(
sectionsLocal![index].description!.firstWhere((translation) => translation.language == appContext.getContext().language).value ?? "",
customStylesBuilder: (element) {
return {'text-align': 'right'};
},
textStyle: TextStyle(fontSize: isPortrait ? 5 : 15),//calculateFontSize(constraints.maxWidth, constraints.maxHeight, kIsWeb ? kWebMenuTitleDetailSize : kMenuTitleDetailSize)),
),
),
),
),
/*Container(
color: Colors.orange,
child: FittedBox(
fit: BoxFit.fitWidth,
child: Align(
alignment: Alignment.centerRight,
child: HtmlWidget(
snapshot.data[index].title.firstWhere((translation) => translation.language == appContext.getContext().language).value,
customStylesBuilder: (element) {
return {'text-align': 'right'};
},
textStyle: new TextStyle(fontSize: calculateFontSize(context, kIsWeb ? kWebMenuTitleDetailSize: kMenuTitleDetailSize)),
),
),
),
),
FittedBox(
fit: BoxFit.fill,
child: Align(
alignment: Alignment.centerRight,
child: HtmlWidget(
snapshot.data[index].description.firstWhere((translation) => translation.language == appContext.getContext().language).value,
customStylesBuilder: (element) {
return {'text-align': 'right'};
},
textStyle: new TextStyle(fontSize: calculateFontSize(context, kIsWeb ? kWebMenuDescriptionDetailSize: kMenuDescriptionDetailSize), fontFamily: ""),
),
),
),*/
],
),
) )
), ),
), ),
@ -568,7 +515,7 @@ boxDecoration(AppContext appContext, SectionDTO section, bool isSelected) {
borderRadius: BorderRadius.circular(30.0), borderRadius: BorderRadius.circular(30.0),
image: section.imageSource != null ? new DecorationImage( image: section.imageSource != null ? new DecorationImage(
fit: BoxFit.cover, fit: BoxFit.cover,
colorFilter: !isSelected? new ColorFilter.mode(Colors.black.withOpacity(kIsWeb ? 0.3 : 0.3), BlendMode.dstATop) : null, colorFilter: !isSelected? new ColorFilter.mode(kBackgroundLight.withOpacity(0.2), BlendMode.dstATop) : null,
image: ImageCustomProvider.getImageProvider(appContext, section.imageId!, section.imageSource!), image: ImageCustomProvider.getImageProvider(appContext, section.imageId!, section.imageSource!),
): null, ): null,
boxShadow: [ boxShadow: [

View File

@ -100,9 +100,10 @@ class _MenuView extends State<MenuView> {
return Stack( return Stack(
children: [ children: [
Center( Center(
child: Padding(
padding: selectedSection!.type == SectionType.video || selectedSection!.type == SectionType.web ? EdgeInsets.all(8.0) : EdgeInsets.all(0.0),
child: Container( child: Container(
width: size.width, width: size.width,
height: kIsWeb ? size.height * 0.8 : size.height * 0.8,
decoration: selectedSection!.type != SectionType.video && selectedSection!.type != SectionType.web && selectedSection!.type != SectionType.slider && selectedSection!.type != SectionType.map ? BoxDecoration( decoration: selectedSection!.type != SectionType.video && selectedSection!.type != SectionType.web && selectedSection!.type != SectionType.slider && selectedSection!.type != SectionType.map ? BoxDecoration(
color: kBackgroundLight, color: kBackgroundLight,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
@ -121,8 +122,9 @@ class _MenuView extends State<MenuView> {
child: elementToShow), child: elementToShow),
), ),
), ),
),
Padding( Padding(
padding: const EdgeInsets.only(bottom: kIsWeb ? 5: 20, right: kIsWeb ? 5: 20), padding: const EdgeInsets.only(bottom: 5, right: 5),
child: Align( child: Align(
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,
child: InkWell( child: InkWell(
@ -174,11 +176,11 @@ class _MenuView extends State<MenuView> {
child: Container( child: Container(
decoration: boxDecoration(appContext, menuDTO.sections![index], false), decoration: boxDecoration(appContext, menuDTO.sections![index], false),
padding: const EdgeInsets.all(25), padding: const EdgeInsets.all(25),
margin: EdgeInsets.symmetric(vertical: kIsWeb ? 15 : 25, horizontal: kIsWeb ? 15 : 25), margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15),
child: Align( child: Align(
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,
child: FractionallySizedBox( child: FractionallySizedBox(
heightFactor: kIsWeb ? 0.3 : 0.4, heightFactor: 0.45,
child: Column( child: Column(
children: [ children: [
Align( Align(
@ -220,8 +222,8 @@ boxDecoration(AppContext appContext, SectionDTO section, bool isSelected) {
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(30.0), borderRadius: BorderRadius.circular(30.0),
image: section.imageSource != null ? new DecorationImage( image: section.imageSource != null ? new DecorationImage(
fit: kIsWeb ? BoxFit.cover : BoxFit.contain, fit: BoxFit.cover,
colorFilter: !isSelected? new ColorFilter.mode(Colors.black.withOpacity(0.3), BlendMode.dstATop) : null, colorFilter: !isSelected? new ColorFilter.mode(kBackgroundLight.withOpacity(0.2), BlendMode.dstATop) : null,
image: ImageCustomProvider.getImageProvider(appContext, section.imageId!, section.imageSource!), image: ImageCustomProvider.getImageProvider(appContext, section.imageId!, section.imageSource!),
): null, ): null,
boxShadow: [ boxShadow: [

View File

@ -130,7 +130,7 @@ class _PDFViewWidget extends State<PDFViewWidget> {
Expanded( Expanded(
flex: 4, flex: 4,
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 8.0), padding: const EdgeInsets.all(8.0),
child: ValueListenableBuilder<PDFFileDTO?>( child: ValueListenableBuilder<PDFFileDTO?>(
valueListenable: selectedPdf, valueListenable: selectedPdf,
builder: (context, value, _) { builder: (context, value, _) {
@ -177,7 +177,7 @@ class _PDFViewWidget extends State<PDFViewWidget> {
), ),
Positioned( Positioned(
bottom: 20, bottom: 20,
right: 20, left: 20,
child: ValueListenableBuilder<Map<String, int>>( child: ValueListenableBuilder<Map<String, int>>(
valueListenable: currentState, valueListenable: currentState,
builder: (context, value, _) { builder: (context, value, _) {

View File

@ -92,14 +92,14 @@ class _PuzzlePieceState extends State<PuzzlePiece> {
top = Random().nextInt((imageHeight - pieceHeight).ceil()).toDouble(); top = Random().nextInt((imageHeight - pieceHeight).ceil()).toDouble();
var test = top!; var test = top!;
test -= widget.row * pieceHeight; test -= widget.row * pieceHeight;
top = test /2.2; // TODO change ? top = test /7; // TODO change ?
} }
if (left == null) { if (left == null) {
left = Random().nextInt((imageWidth - pieceWidth).ceil()).toDouble(); left = Random().nextInt((imageWidth - pieceWidth).ceil()).toDouble();
var test = left!; var test = left!;
test -= widget.col * pieceWidth; test -= widget.col * pieceWidth;
left = test /2.2; // TODO change ? left = test /7; // TODO change ?
} }
if(widget.row == 0 && widget.col == 0) { if(widget.row == 0 && widget.col == 0) {