showInteractiveMap function

Future<void> showInteractiveMap(
  1. BuildContext context, {
  2. required GeoLocation initialLocation,
  3. String? title,
  4. required List<Polygon<Object>> polygons,
  5. double? initialZoom,
  6. OnPolygonHit? onPolygonHit,
})

Helper function to navigate to the interactive map page

Implementation

Future<void> showInteractiveMap(
  BuildContext context, {
  required GeoLocation initialLocation,
  String? title,
  required List<Polygon> polygons,
  double? initialZoom,
  OnPolygonHit? onPolygonHit,
}) async {
  if (!context.mounted) return;

  await Navigator.of(context).push(
    MaterialPageRoute(
      builder: (context) => InteractiveMapPage(
        initialLocation: initialLocation,
        title: title ?? 'Iraq Location Picker',
        polygons: polygons,
        initialZoom: initialZoom ?? defaultMapZoom,
        onPolygonHit: onPolygonHit,
      ),
    ),
  );
}