feat : marker with zoom changes

This commit is contained in:
2025-07-29 12:37:17 +03:30
parent 716dd6e70a
commit 22cfbda124
6 changed files with 123 additions and 150 deletions

View File

@@ -43,7 +43,11 @@ class InspectionMapPage extends GetView<InspectionMapLogic> {
),
initialZoom: 15,
onPositionChanged: (camera, hasGesture) {
controller.debouncedUpdateVisibleMarkers(center: camera.center,zoom: camera.zoom);
wLog(camera.zoom);
controller.debouncedUpdateVisibleMarkers(
center: camera.center,
zoom: camera.zoom,
);
},
),
@@ -52,29 +56,35 @@ class InspectionMapPage extends GetView<InspectionMapLogic> {
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
userAgentPackageName: 'ir.mnpc.rasadyar',
),
MarkerClusterLayerWidget(
options: MarkerClusterLayerOptions(
maxClusterRadius: 80,
size: const Size(40, 40),
alignment: Alignment.center,
padding: const EdgeInsets.all(50),
maxZoom: 15,
markers: controller.markers,
builder: (context, markers) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.blue,
),
child: Center(
child: Text(
markers.length.toString(),
style: const TextStyle(color: Colors.white),
),
),
);
},
),
ObxValue(
(markers) {
return MarkerClusterLayerWidget(
options: MarkerClusterLayerOptions(
maxClusterRadius: 80,
size: const Size(40, 40),
alignment: Alignment.center,
padding: const EdgeInsets.all(50),
maxZoom: 15,
markers: markers.value,
builder: (context, clusterMarkers) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.blue,
),
child: Center(
child: Text(
clusterMarkers.length.toString(),
style: const TextStyle(color: Colors.white),
),
),
);
},
),
);
},
controller.markers,
),
],
);