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

Key.toString() is working as expected on debug mode after upgrading flutter to 3.22.0
This commit is contained in:
ashilkn
2024-05-30 20:34:59 +05:30
parent 7739be4e21
commit f871255833
2 changed files with 9 additions and 12 deletions

View File

@@ -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(

View File

@@ -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,
);
});