Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] fix clusters in map not rendering properly in profile or release mode

ashilknf871255833b4
diff --git a/mobile/lib/ui/map/map_marker.dart b/mobile/lib/ui/map/map_marker.dart
index e9de524227..3dc026697a 100644
--- a/mobile/lib/ui/map/map_marker.dart
+++ b/mobile/lib/ui/map/map_marker.dart
@@ -7,12 +7,12 @@ import "package:photos/ui/map/marker_image.dart";
Marker mapMarker(
ImageMarker imageMarker,
- String key, {
+ ValueKey<int> key, {
Size markerSize = MapView.defaultMarkerSize,
}) {
return Marker(
alignment: Alignment.topCenter,
- key: Key(key),
+ key: key,
width: markerSize.width,
height: markerSize.height,
point: LatLng(
diff --git a/mobile/lib/ui/map/map_view.dart b/mobile/lib/ui/map/map_view.dart
index 3ff86f2ae1..d4de022197 100644
--- a/mobile/lib/ui/map/map_view.dart
+++ b/mobile/lib/ui/map/map_view.dart
@@ -4,8 +4,8 @@ import "package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart";
import "package:latlong2/latlong.dart";
import "package:photos/ui/map/image_marker.dart";
import "package:photos/ui/map/map_button.dart";
-import 'package:photos/ui/map/map_gallery_tile.dart';
-import 'package:photos/ui/map/map_gallery_tile_badge.dart';
+import "package:photos/ui/map/map_gallery_tile.dart";
+import "package:photos/ui/map/map_gallery_tile_badge.dart";
import "package:photos/ui/map/map_marker.dart";
import "package:photos/ui/map/tile/layers.dart";
import "package:photos/utils/debouncer.dart";
@@ -114,13 +114,10 @@ class _MapViewState extends State<MapView> {
onChange(widget.controller.camera.visibleBounds);
},
builder: (context, List<Marker> markers) {
- final index = int.parse(
- markers.first.key
- .toString()
- .replaceAll(RegExp(r'[^0-9]'), ''),
- );
- final String clusterKey =
- 'map-badge-$index-len-${markers.length}';
+ final valueKey = markers.first.key as ValueKey;
+ final index = valueKey.value as int;
+
+ final clusterKey = 'map-badge-$index-len-${markers.length}';
return Stack(
key: ValueKey(clusterKey),
@@ -199,7 +196,7 @@ class _MapViewState extends State<MapView> {
final imageMarker = widget.imageMarkers[index];
return mapMarker(
imageMarker,
- index.toString(),
+ ValueKey(index),
markerSize: widget.markerSize,
);
});