Fix localisation bug

This commit is contained in:
Thomas Fransolet 2024-04-19 17:23:29 +02:00
parent 1db1c78538
commit 2428d22558
5 changed files with 29 additions and 12 deletions

View File

@ -18,7 +18,7 @@ class RoundedButton extends StatelessWidget {
this.text,
this.press,
this.icon,
this.color = kMainRed,
this.color = kTestSecondColor,
this.textColor = Colors.white,
this.fontSize,
this.vertical,
@ -37,7 +37,7 @@ class RoundedButton extends StatelessWidget {
backgroundColor: MaterialStateColor.resolveWith((states) => color!),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 20.0),
borderRadius: BorderRadius.circular(tabletAppContext.configuration?.roundedValue?.toDouble() ?? 20.0),
)
)
),

View File

@ -71,8 +71,7 @@ class _LoadingCommonState extends State<LoadingCommon> with TickerProviderStateM
print("not a local loader succck");
return CachedNetworkImage(
imageUrl: tabletAppContext.configuration!.loaderImageUrl!,
progressIndicatorBuilder: (context, url, downloadProgress) =>
CircularProgressIndicator(value: downloadProgress.progress, color: primaryColor),
progressIndicatorBuilder: (context, url, downloadProgress) => CircularProgressIndicator(value: downloadProgress.progress, color: primaryColor),
errorWidget: (context, url, error) => Icon(Icons.error),
);
} else {

View File

@ -17,7 +17,7 @@ class RoundedInputField extends StatelessWidget {
this.icon,
this.color = kBackgroundGrey,
this.textColor = kMainGrey,
this.iconColor = kMainRed,
this.iconColor = kTestSecondColor,
this.onChanged,
this.maxLength, // 50
this.isString = true,

View File

@ -58,14 +58,14 @@ class _SectionPageDetailState extends State<SectionPageDetail> {
child: Container(
height: size.height,
width: size.width,
color: widget.configurationDTO.imageId == null ? widget.configurationDTO.secondaryColor != null ? new Color(int.parse(widget.configurationDTO.secondaryColor!.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey : null,
/*color: widget.configurationDTO.imageId == null ? widget.configurationDTO.secondaryColor != null ? new Color(int.parse(widget.configurationDTO.secondaryColor!.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey : null,
decoration: widget.configurationDTO.imageId != null ? BoxDecoration(
image: new DecorationImage(
fit: BoxFit.cover,
colorFilter: new ColorFilter.mode(Colors.white.withOpacity(0.8), BlendMode.lighten),
image: ImageCustomProvider.getImageProvider(appContext, widget.configurationDTO.imageId!, widget.configurationDTO.imageSource!),
),
) : null,
) : null,*/
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(

View File

@ -1,5 +1,6 @@
import 'dart:ui';
import 'dart:math';
//import 'package:animated_tree_view/animated_tree_view.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -69,8 +70,11 @@ class _GeoPointFilterState extends State<GeoPointFilter> {
// Pour chaque point sans categorie, créer un noeud
for(var pointWithoutCat in geoPoints.where((gp) => gp.categorieId == null && gp.categorie == null))
{
TreeNode nodeWithoutCat = TreeNode(
id: int.parse(pointWithoutCat.latitude!.substring(0,10).replaceAll(".", "")+pointWithoutCat.longitude!.substring(0,10).replaceAll(".", "")),
id: int.parse(
(pointWithoutCat.latitude ?? '').substring(0, min(pointWithoutCat.latitude!.length, 10)).replaceAll(".", "") + (pointWithoutCat.longitude ?? '').substring(0, min(pointWithoutCat.longitude!.length, 10)).replaceAll(".", "")
),
title: parse(pointWithoutCat.title!.firstWhere((l) => l.language == widget.language).value!).documentElement!.text,
children: [],
checked: true, // default true
@ -97,7 +101,9 @@ class _GeoPointFilterState extends State<GeoPointFilter> {
for (var geoPoint in geoPoints.where((gp) => gp.categorie != null || gp.categorieId != null)) {
if (geoPoint.categorieId == category.id) {
TreeNode geoPointNode = TreeNode(
id: int.parse(geoPoint.latitude!.substring(0,10).replaceAll(".", "")+geoPoint.longitude!.substring(0,10).replaceAll(".", "")),
id: int.parse(
(geoPoint.latitude ?? '').substring(0, min(geoPoint.latitude!.length, 10)).replaceAll(".", "") + (geoPoint.longitude ?? '').substring(0, min(geoPoint.longitude!.length, 10)).replaceAll(".", "")
),
title: parse(geoPoint.title!.firstWhere((l) => l.language == widget.language).value!).documentElement!.text,
checked: true, // default true
show: false,
@ -139,12 +145,16 @@ class _GeoPointFilterState extends State<GeoPointFilter> {
if (node.children.isNotEmpty) {
for (var childNode in node.children) {
if (childNode.checked) {
checkedGeoPoints.add(widget.geoPoints.firstWhere((point) => int.parse(point.latitude!.substring(0,10).replaceAll(".", "")+point.longitude!.substring(0,10).replaceAll(".", "")) == childNode.id));
checkedGeoPoints.add(widget.geoPoints.firstWhere((point) => int.parse(
(point.latitude ?? '').substring(0, min(point.latitude!.length, 10)).replaceAll(".", "") + (point.longitude ?? '').substring(0, min(point.longitude!.length, 10)).replaceAll(".", "")
) == childNode.id));
}
}
} else {
if(node.checked) {
checkedGeoPoints.add(widget.geoPoints.firstWhere((point) => int.parse(point.latitude!.substring(0,10).replaceAll(".", "")+point.longitude!.substring(0,10).replaceAll(".", "")) == node.id));
checkedGeoPoints.add(widget.geoPoints.firstWhere((point) => int.parse(
(point.latitude ?? '').substring(0, min(point.latitude!.length, 10)).replaceAll(".", "") + (point.longitude ?? '').substring(0, min(point.longitude!.length, 10)).replaceAll(".", "")
) == node.id));
}
}
}
@ -157,7 +167,15 @@ class _GeoPointFilterState extends State<GeoPointFilter> {
List<TreeNode> filteredNodes = [];
for (var node in buildTreeNodes(widget.categories, widget.geoPoints)) {
if (_nodeOrChildrenContainsText(node, searchText)) {
filteredNodes.add(node);
if(node.children.isNotEmpty) {
for (var childNode in node.children) {
if (_nodeOrChildrenContainsText(childNode, searchText)) {
filteredNodes.add(childNode);
}
}
} else {
filteredNodes.add(node);
}
}
}
return filteredNodes;