InteractiveMap<T>.locator constructor

InteractiveMap<T>.locator({
  1. Key? key,
  2. required List<T> items,
  3. required LatLng positionMapper(
    1. T item
    ),
  4. required Widget markerBuilder(
    1. BuildContext context,
    2. T item,
    3. int index
    ),
  5. void onStoreTapped(
    1. T item,
    2. int index
    )?,
  6. void onMapTapped(
    1. TapPosition,
    2. LatLng
    )?,
  7. InteractiveMapController<T>? controller,
  8. double markerWidth = 80.0,
  9. double markerHeight = 80.0,
  10. double? focusedZoom = 15.0,
  11. MapInteractionConfig<T>? interaction,
  12. MapThemeConfig? theme,
  13. MapControlConfig? compassConfig = const MapControlConfig(alignment: Alignment.topRight),
  14. MapUserLocationConfig? userLocation = const MapUserLocationConfig(followUser: false, requestPermissionAutomatically: false, showUserLocationButton: false, buttonConfig: MapControlConfig(alignment: Alignment.bottomRight)),
  15. MapControlConfig? zoomConfig,
})

Factory tailored for Store Locators / Exploration.

Implementation

factory InteractiveMap.locator({
  Key? key,
  required List<T> items,
  required LatLng Function(T item) positionMapper,
  required Widget Function(BuildContext context, T item, int index)
  markerBuilder,
  void Function(T item, int index)? onStoreTapped,
  void Function(TapPosition, LatLng)? onMapTapped,
  InteractiveMapController<T>? controller,
  double markerWidth = 80.0,
  double markerHeight = 80.0,
  double? focusedZoom = 15.0,
  MapInteractionConfig<T>? interaction,
  MapThemeConfig? theme,
  MapControlConfig? compassConfig = const MapControlConfig(
    alignment: Alignment.topRight,
  ),
  MapUserLocationConfig? userLocation = const MapUserLocationConfig(
    followUser: false,
    requestPermissionAutomatically: false,
    showUserLocationButton: false,
    buttonConfig: MapControlConfig(alignment: Alignment.bottomRight),
  ),
  MapControlConfig? zoomConfig,
}) {
  return InteractiveMap<T>(
    key: key,
    items: items,
    positionMapper: positionMapper,
    markerBuilder: markerBuilder,
    controller: controller,
    markerWidth: markerWidth,
    markerHeight: markerHeight,
    theme: theme ?? const MapThemeConfig(),
    compassConfig: compassConfig,
    userLocation: userLocation,
    zoomConfig: zoomConfig,
    interaction:
        interaction ??
        MapInteractionConfig<T>(
          onTapItem: onStoreTapped,
          onMapTap: onMapTapped,
          enableRotation: true,
          showCompass: true,
          focusedZoom: focusedZoom,
        ),
  );
}