Skip to content

armgit / ente

Public Imported from GitHub
0

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

feat(map in info): made map marker flexible in size without without distorting it's parts (image and pointer)

ashilknd05fd44a6508
diff --git a/lib/ui/map/map_marker.dart b/lib/ui/map/map_marker.dart
index 18f330dc72..0009370be1 100644
--- a/lib/ui/map/map_marker.dart
+++ b/lib/ui/map/map_marker.dart
@@ -2,21 +2,28 @@ import "package:flutter/material.dart";
import "package:flutter_map/flutter_map.dart";
import "package:latlong2/latlong.dart";
import "package:photos/ui/map/image_marker.dart";
+import "package:photos/ui/map/map_view.dart";
import "package:photos/ui/map/marker_image.dart";
-Marker mapMarker(ImageMarker imageMarker, String key) {
+Marker mapMarker(
+ ImageMarker imageMarker,
+ String key, {
+ Size markerSize = MapView.defaultMarkerSize,
+}) {
return Marker(
- anchorPos: AnchorPos.exactly(Anchor(75 / 2, -6.5)),
+ //-6.5 is for taking in the height of the MarkerPointer
+ anchorPos: AnchorPos.exactly(Anchor(markerSize.height / 2, -6.5)),
key: Key(key),
- width: 75,
- height: 75,
+ width: markerSize.width,
+ height: markerSize.height,
point: LatLng(
imageMarker.latitude,
imageMarker.longitude,
),
builder: (context) => MarkerImage(
file: imageMarker.imageFile,
- seperator: 85,
+ seperator: (MapView.defaultMarkerSize.height + 10) -
+ (MapView.defaultMarkerSize.height - markerSize.height),
),
);
}
diff --git a/lib/ui/map/map_view.dart b/lib/ui/map/map_view.dart
index 1525ac6353..3b2798d59b 100644
--- a/lib/ui/map/map_view.dart
+++ b/lib/ui/map/map_view.dart
@@ -23,6 +23,8 @@ class MapView extends StatefulWidget {
final bool showControls;
final int interactiveFlags;
final VoidCallback? onTap;
+ final Size markerSize;
+ static const defaultMarkerSize = Size(75, 75);
const MapView({
Key? key,
@@ -35,6 +37,7 @@ class MapView extends StatefulWidget {
required this.initialZoom,
required this.debounceDuration,
required this.bottomSheetDraggableAreaHeight,
+ this.markerSize = MapView.defaultMarkerSize,
this.onTap,
this.interactiveFlags = InteractiveFlag.all,
this.showControls = true,
@@ -113,7 +116,7 @@ class _MapViewState extends State<MapView> {
anchorPos: AnchorPos.align(AnchorAlign.top),
maxClusterRadius: 100,
showPolygon: false,
- size: const Size(75, 75),
+ size: widget.markerSize,
fitBoundsOptions: const FitBoundsOptions(
padding: EdgeInsets.all(80),
),
@@ -200,6 +203,7 @@ class _MapViewState extends State<MapView> {
return mapMarker(
imageMarker,
index.toString(),
+ markerSize: widget.markerSize,
);
});
}