Fixed map issue (filter size + marker Id)

This commit is contained in:
Thomas Fransolet 2024-03-21 13:17:34 +01:00
parent 256d29bcad
commit e17e38e556
2 changed files with 7 additions and 7 deletions

View File

@ -51,7 +51,7 @@ class _GoogleMapViewState extends State<GoogleMapView> {
if (mapMarker.latitude != null && mapMarker.longitude != null) { if (mapMarker.latitude != null && mapMarker.longitude != null) {
markers.add(Marker( markers.add(Marker(
draggable: false, draggable: false,
markerId: MarkerId(mapMarker.latitude! + mapMarker.longitude!), markerId: MarkerId(parse(textSansHTML.body!.text).documentElement!.text + mapMarker.latitude! + mapMarker.longitude!),
position: LatLng( position: LatLng(
double.tryParse(mapMarker.latitude!)!, double.tryParse(mapMarker.latitude!)!,
double.tryParse(mapMarker.longitude!)!, double.tryParse(mapMarker.longitude!)!,
@ -172,7 +172,7 @@ class _GoogleMapViewState extends State<GoogleMapView> {
bottom: 35, bottom: 35,
left: 10, left: 10,
child: SizedBox( child: SizedBox(
width: size.width * 0.55, width: size.width * 0.75,
child: MultiSelectContainer( child: MultiSelectContainer(
label: null, label: null,
color: kBackgroundGrey, color: kBackgroundGrey,
@ -183,9 +183,9 @@ class _GoogleMapViewState extends State<GoogleMapView> {
var tempOutput = new List<String>.from(value); var tempOutput = new List<String>.from(value);
print(tempOutput); print(tempOutput);
if(init) { if(init) {
selectedCategories = tempOutput;
pointsToShow = widget.mapDTO!.points!.where((point) => tempOutput.any((tps) => point.categorie?.label?.firstWhere((lab) => lab.language == widget.language).value == tps) || point.categorie == null).toList();
setState(() { setState(() {
selectedCategories = tempOutput;
pointsToShow = widget.mapDTO!.points!.where((point) => tempOutput.any((tps) => point.categorie?.label?.firstWhere((lab) => lab.language == widget.language).value == tps) || point.categorie == null).toList();
markers = getMarkers(widget.language, mapContext); markers = getMarkers(widget.language, mapContext);
mapContext.notifyListeners(); mapContext.notifyListeners();
}); });

View File

@ -41,7 +41,7 @@ class AnnotationClickListener extends mapBox.OnPointAnnotationClickListener {
@override @override
void onPointAnnotationClick(mapBox.PointAnnotation annotation) { void onPointAnnotationClick(mapBox.PointAnnotation annotation) {
try{ try{
var markerToShow = markersList.firstWhere((ml) => ml.id.toString() == annotation.textField); var markerToShow = markersList.firstWhere((ml) => "${ml.title}${ml.latitude}${ml.longitude}" == annotation.textField);
mapContext.setSelectedMarker(markerToShow); mapContext.setSelectedMarker(markerToShow);
} catch(e) { } catch(e) {
print("ISSSUE setSelectedMarker"); print("ISSSUE setSelectedMarker");
@ -75,7 +75,7 @@ class _MapBoxViewState extends State<MapBoxView> {
double.tryParse(mapMarker.latitude!)!, double.tryParse(mapMarker.latitude!)!,
)).toJson(), )).toJson(),
iconSize: 1.3, iconSize: 1.3,
textField: i.toString(), textField: "${parse(textSansHTML.body!.text).documentElement!.text}${mapMarker.latitude}${mapMarker.longitude}",
textOpacity: 0.0, textOpacity: 0.0,
iconOffset: [0.0, 0.0], iconOffset: [0.0, 0.0],
symbolSortKey: 10, symbolSortKey: 10,
@ -176,7 +176,7 @@ class _MapBoxViewState extends State<MapBoxView> {
bottom: 35, bottom: 35,
left: 10, left: 10,
child: SizedBox( child: SizedBox(
width: size.width * 0.55, width: size.width * 0.85,
child: MultiSelectContainer( child: MultiSelectContainer(
label: null, label: null,
color: kBackgroundGrey, color: kBackgroundGrey,