feat : Cluster Map

This commit is contained in:
2025-07-29 10:50:18 +03:30
parent 8acd951c05
commit 716dd6e70a
7 changed files with 225 additions and 75 deletions

View File

@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_inspection/presentation/pages/filter/view.dart';
import 'package:rasadyar_inspection/presentation/routes/app_routes.dart';
import 'package:rasadyar_inspection/presentation/widget/base_page/view.dart';
import 'package:rasadyar_inspection/presentation/widget/custom_chips.dart';
@@ -39,40 +38,44 @@ class InspectionMapPage extends GetView<InspectionMapLogic> {
mapController: controller.animatedMapController.mapController,
options: MapOptions(
initialCenter: currentLocation.value,
initialZoom: 18,
interactionOptions: const InteractionOptions(
flags: InteractiveFlag.all & ~InteractiveFlag.rotate,
),
initialZoom: 15,
onPositionChanged: (camera, hasGesture) {
controller.debouncedUpdateVisibleMarkers(center: camera.center);
controller.debouncedUpdateVisibleMarkers(center: camera.center,zoom: camera.zoom);
},
),
children: [
TileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
userAgentPackageName: 'ir.mnpc.rasadyar',
),
ObxValue((markers) {
return MarkerLayer(
markers: markers
.map(
(e) => markerWidget(
marker: LatLng(e.lat??0, e.long??0),
onTap: () {
Get.bottomSheet(
selectedLocationWidget2(
showHint: false,
sliderController: controller.slidController.value,
trigger: () {},
toggle: () {},
),
isScrollControlled: true,
enableDrag: true,
backgroundColor: Colors.transparent,
);
},
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),
),
)
.toList(),
);
}, controller.markers),
),
);
},
),
),
],
);
}, controller.currentLocation),
@@ -521,7 +524,6 @@ Widget cardWithLabel({
);
}
Widget selectedLocationWidget({
required bool showHint,
required SlidableController sliderController,