fromSource static method
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) {
MapEventSource.flingAnimationController => MapEventFlingAnimation(
center: oldCenter,
zoom: oldZoom,
targetCenter: targetCenter,
targetZoom: targetZoom,
source: source,
),
MapEventSource.doubleTapZoomAnimationController =>
MapEventDoubleTapZoom(
center: oldCenter,
zoom: oldZoom,
targetCenter: targetCenter,
targetZoom: targetZoom,
source: source,
),
MapEventSource.scrollWheel => MapEventScrollWheelZoom(
center: oldCenter,
zoom: oldZoom,
targetCenter: targetCenter,
targetZoom: targetZoom,
source: source,
),
MapEventSource.onDrag ||
MapEventSource.onMultiFinger ||
MapEventSource.mapController ||
MapEventSource.custom =>
MapEventMove(
id: id,
center: oldCenter,
zoom: oldZoom,
targetCenter: targetCenter,
targetZoom: targetZoom,
source: source,
),
_ => null,
};