From e17e38e556cbefcfe471cd1362cda65ec26d3050 Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Thu, 21 Mar 2024 13:17:34 +0100 Subject: [PATCH] Fixed map issue (filter size + marker Id) --- lib/Screens/Map/google_map_view.dart | 8 ++++---- lib/Screens/Map/map_box_view.dart | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Screens/Map/google_map_view.dart b/lib/Screens/Map/google_map_view.dart index 0ec9c55..2f0b42b 100644 --- a/lib/Screens/Map/google_map_view.dart +++ b/lib/Screens/Map/google_map_view.dart @@ -51,7 +51,7 @@ class _GoogleMapViewState extends State { if (mapMarker.latitude != null && mapMarker.longitude != null) { markers.add(Marker( draggable: false, - markerId: MarkerId(mapMarker.latitude! + mapMarker.longitude!), + markerId: MarkerId(parse(textSansHTML.body!.text).documentElement!.text + mapMarker.latitude! + mapMarker.longitude!), position: LatLng( double.tryParse(mapMarker.latitude!)!, double.tryParse(mapMarker.longitude!)!, @@ -172,7 +172,7 @@ class _GoogleMapViewState extends State { bottom: 35, left: 10, child: SizedBox( - width: size.width * 0.55, + width: size.width * 0.75, child: MultiSelectContainer( label: null, color: kBackgroundGrey, @@ -183,9 +183,9 @@ class _GoogleMapViewState extends State { var tempOutput = new List.from(value); print(tempOutput); 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(() { - 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); mapContext.notifyListeners(); }); diff --git a/lib/Screens/Map/map_box_view.dart b/lib/Screens/Map/map_box_view.dart index f78acf3..17a55f6 100644 --- a/lib/Screens/Map/map_box_view.dart +++ b/lib/Screens/Map/map_box_view.dart @@ -41,7 +41,7 @@ class AnnotationClickListener extends mapBox.OnPointAnnotationClickListener { @override void onPointAnnotationClick(mapBox.PointAnnotation annotation) { 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); } catch(e) { print("ISSSUE setSelectedMarker"); @@ -75,7 +75,7 @@ class _MapBoxViewState extends State { double.tryParse(mapMarker.latitude!)!, )).toJson(), iconSize: 1.3, - textField: i.toString(), + textField: "${parse(textSansHTML.body!.text).documentElement!.text}${mapMarker.latitude}${mapMarker.longitude}", textOpacity: 0.0, iconOffset: [0.0, 0.0], symbolSortKey: 10, @@ -176,7 +176,7 @@ class _MapBoxViewState extends State { bottom: 35, left: 10, child: SizedBox( - width: size.width * 0.55, + width: size.width * 0.85, child: MultiSelectContainer( label: null, color: kBackgroundGrey,