fromSource static method
MapEventWithMove?
fromSource({
- required LatLng targetCenter,
- required double targetZoom,
- required LatLng oldCenter,
- required double oldZoom,
- required bool hasGesture,
- required MapEventSource source,
- String? id,
Returns a subclass of MapEventWithMove if the source
belongs to a
movement event, otherwise returns null.
Implementation
static MapEventWithMove? fromSource({
required LatLng targetCenter,
required double targetZoom,
required LatLng oldCenter,
required double oldZoom,
required bool hasGesture,
required MapEventSource source,
String? id,
}) {
switch (source) {
case MapEventSource.flingAnimationController:
return MapEventFlingAnimation(
center: oldCenter,
zoom: oldZoom,
targetCenter: targetCenter,
targetZoom: targetZoom,
source: source,
);
case MapEventSource.doubleTapZoomAnimationController:
return MapEventDoubleTapZoom(
center: oldCenter,
zoom: oldZoom,
targetCenter: targetCenter,
targetZoom: targetZoom,
source: source,
);
case MapEventSource.scrollWheel:
return MapEventScrollWheelZoom(
center: oldCenter,
zoom: oldZoom,
targetCenter: targetCenter,
targetZoom: targetZoom,
source: source,
);
case MapEventSource.onDrag:
case MapEventSource.onMultiFinger:
case MapEventSource.mapController:
case MapEventSource.custom:
return MapEventMove(
id: id,
center: oldCenter,
zoom: oldZoom,
targetCenter: targetCenter,
targetZoom: targetZoom,
source: source,
);
default:
return null;
}
}