InteractiveMap<T>.delivery constructor
InteractiveMap<T>.delivery ({
- Key? key,
- required List<
T> items, - required LatLng positionMapper(
- T item
- required Widget markerBuilder(
- BuildContext context,
- T item,
- int index
- void onDeliveryTapped(
- T item,
- int index
- InteractiveMapController<
T> ? controller, - LatLng initialCenter = const LatLng(45.4642, 9.1900),
- Color clusterColor = Colors.orange,
- double markerWidth = 80.0,
- double markerHeight = 80.0,
- double? focusedZoom = 15.0,
- MapInteractionConfig<
T> ? interaction, - MapThemeConfig? theme,
- MapUserLocationConfig? userLocation,
- MapControlConfig? zoomConfig,
Factory tailored for Delivery Tracking.
Implementation
factory InteractiveMap.delivery({
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)? onDeliveryTapped,
InteractiveMapController<T>? controller,
LatLng initialCenter = const LatLng(45.4642, 9.1900),
Color clusterColor = Colors.orange,
double markerWidth = 80.0,
double markerHeight = 80.0,
double? focusedZoom = 15.0,
MapInteractionConfig<T>? interaction,
MapThemeConfig? theme,
MapUserLocationConfig? userLocation,
MapControlConfig? zoomConfig,
}) {
return InteractiveMap<T>(
key: key,
items: items,
positionMapper: positionMapper,
markerBuilder: markerBuilder,
controller: controller,
initialCenter: initialCenter,
initialZoom: 12.0,
markerWidth: markerWidth,
markerHeight: markerHeight,
theme: theme ?? const MapThemeConfig(),
compassConfig: null,
userLocation: userLocation,
zoomConfig: zoomConfig,
interaction:
interaction ??
MapInteractionConfig<T>(
onTapItem: onDeliveryTapped,
enableRotation: false,
showCompass: false,
focusedZoom: focusedZoom,
),
clustering: MapClusteringConfig(
maxZoom: 16,
fitBoundsPadding: const EdgeInsets.all(80.0),
clusterBuilder: (context, markers) => Container(
decoration: BoxDecoration(
color: clusterColor,
shape: BoxShape.circle,
border: Border.all(color: Colors.white, width: 2),
),
child: Center(
child: Text(
markers.length.toString(),
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
),
),
);
}