From 812a999c8df9a4a0c608a628ce4bcb7d446c8050 Mon Sep 17 00:00:00 2001 From: miakh <2659269+miakh@users.noreply.github.com> Date: Tue, 13 Aug 2024 11:14:41 +0200 Subject: [PATCH] hidden place fix --- lib/pages/MapPage.dart | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/lib/pages/MapPage.dart b/lib/pages/MapPage.dart index 9732df56..4a24de9d 100644 --- a/lib/pages/MapPage.dart +++ b/lib/pages/MapPage.dart @@ -88,6 +88,13 @@ class _MapPageState extends State with TickerProviderStateMixin { offlinePlaces.where((element) => !element.isHidden).toList(); } + if(placeId != null) { + var p = offlinePlaces.firstWhereOrNull((p)=>p.id == placeId); + if(p != null) { + mapOfflinePlaces.add(p); + } + } + await addEventsToPlace(mapOfflinePlaces); addPlacesToMap(mapOfflinePlaces); @@ -100,6 +107,8 @@ class _MapPageState extends State with TickerProviderStateMixin { _icons = await DataService.getAllIcons(); List mapPlaces = []; + List showMapPlaces = []; + if (loadOtherGroups) { var groups = await DataService.getGroupsWithPlaces(); for (var element in groups) { @@ -111,15 +120,22 @@ class _MapPageState extends State with TickerProviderStateMixin { } } else { mapPlaces = await DataService.getAllPlaces(); - mapPlaces = mapPlaces.where((p)=>!p.isHidden).toList(); - mapPlaces.sortPlaces(false); + showMapPlaces = mapPlaces.where((p)=>!p.isHidden).toList(); + showMapPlaces.sortPlaces(false); await OfflineDataHelper.saveAllPlaces(mapPlaces); } - if (mapPlaces.isNotEmpty) { + if(placeId != null) { + var p = mapPlaces.firstWhereOrNull((p)=>p.id == placeId); + if(p != null) { + showMapPlaces.add(p); + } + } + + if (showMapPlaces.isNotEmpty) { _markers.clear(); - await addEventsToPlace(mapPlaces); - addPlacesToMap(mapPlaces); + await addEventsToPlace(showMapPlaces); + addPlacesToMap(showMapPlaces); } if(placeId != null) {