MapOptions class

Allows you to provide your map's starting properties for zoom, rotation and center. Alternatively you can provide bounds instead of center. If both, center and bounds are provided, bounds will take preference over center. Zoom, pan boundary and interactivity constraints can be specified here too.

Callbacks for onTap, onSecondaryTap, onLongPress and onPositionChanged can be registered here.

Through crs the Coordinate Reference System can be defined, it defaults to Epsg3857.

Checks if a coordinate is outside of the map's defined boundaries.

If you download offline tiles dynamically, you can set adaptiveBoundaries to true (make sure to pass screenSize and an external controller), which will enforce panning/zooming to ensure there is never a need to display tiles outside the boundaries set by swPanBoundary and nePanBoundary.

Constructors

MapOptions({Crs crs = const Epsg3857(), LatLng? center, LatLngBounds? bounds, FitBoundsOptions boundsOptions = const FitBoundsOptions(), double zoom = 13.0, double rotation = 0.0, bool debugMultiFingerGestureWinner = false, bool enableMultiFingerGestureRace = false, double rotationThreshold = 20.0, int rotationWinGestures = MultiFingerGesture.rotate, double pinchZoomThreshold = 0.5, int pinchZoomWinGestures = MultiFingerGesture.pinchZoom | MultiFingerGesture.pinchMove, double pinchMoveThreshold = 40.0, int pinchMoveWinGestures = MultiFingerGesture.pinchZoom | MultiFingerGesture.pinchMove, bool enableScrollWheel = true, double scrollWheelVelocity = 0.005, double? minZoom, double? maxZoom, int interactiveFlags = InteractiveFlag.all, TapCallback? onTap, TapCallback? onSecondaryTap, LongPressCallback? onLongPress, PointerDownCallback? onPointerDown, PointerUpCallback? onPointerUp, PointerCancelCallback? onPointerCancel, PointerHoverCallback? onPointerHover, PositionCallback? onPositionChanged, MapEventCallback? onMapEvent, void onMapReady()?, bool slideOnBoundaries = false, bool adaptiveBoundaries = false, Size? screenSize, LatLng? swPanBoundary, LatLng? nePanBoundary, LatLngBounds? maxBounds, bool keepAlive = false})

Properties

adaptiveBoundaries bool
final
bounds LatLngBounds?
final
boundsOptions FitBoundsOptions
final
center LatLng
final
crs Crs
final
debugMultiFingerGestureWinner bool
Prints multi finger gesture winner Helps to fine adjust rotationThreshold and pinchZoomThreshold and pinchMoveThreshold Note: only takes effect if enableMultiFingerGestureRace is true
final
enableMultiFingerGestureRace bool
If true then rotationThreshold and pinchZoomThreshold and pinchMoveThreshold will race If multiple gestures win at the same time then precedence: pinchZoomWinGestures > rotationWinGestures > pinchMoveWinGestures
final
enableScrollWheel bool
If true then the map will scroll when the user uses the scroll wheel on his mouse. This is supported on web and desktop, but might also work well on Android. A Listener is used to capture the onPointerSignal events.
final
hashCode int
The hash code for this object.
no setterinherited
interactiveFlags int
see InteractiveFlag for custom settings
final
keepAlive bool
Flag to enable the built in keep alive functionality
final
maxBounds LatLngBounds?
Restrict outer edges of map to LatLng Bounds, to prevent gray areas when panning or zooming. LatLngBounds(LatLng(-90, -180.0), LatLng(90.0, 180.0)) would represent the full extent of the map, so no gray area outside of it.
final
maxZoom double?
final
minZoom double?
final
nePanBoundary LatLng?
final
onLongPress LongPressCallback?
final
onMapEvent MapEventCallback?
final
onMapReady → (void Function()?)
OnMapReady is called after the map runs it's initState. At that point the map has assigned its state to the controller Only use this if your map isn't built immediately (like inside FutureBuilder) and you need to access the controller as soon as the map is built. Otherwise you can use WidgetsBinding.instance.addPostFrameCallback In initState to controll the map before the next frame
final
onPointerCancel PointerCancelCallback?
final
onPointerDown PointerDownCallback?
final
onPointerHover PointerHoverCallback?
final
onPointerUp PointerUpCallback?
final
onPositionChanged PositionCallback?
final
onSecondaryTap TapCallback?
final
onTap TapCallback?
final
pinchMoveThreshold double
Pinch Move threshold default is 40.0 (note: this doesn't take any effect on drag) Map starts to move when pinchMoveThreshold has been achieved or another multi finger gesture wins which allows MultiFingerGesture.pinchMove Note: if interactiveFlags doesn't contain InteractiveFlag.pinchMove or enableMultiFingerGestureRace is false then pinch move cannot win
final
pinchMoveWinGestures int
When pinchMoveThreshold wins over rotationThreshold and pinchZoomThreshold then pinchMoveWinGestures gestures will be used. By default MultiFingerGesture.pinchMove and MultiFingerGesture.pinchZoom gestures will take effect see MultiFingerGesture for custom settings
final
pinchZoomThreshold double
Pinch Zoom threshold default is 0.5 Map starts to zoom when pinchZoomThreshold has been achieved or another multi finger gesture wins which allows MultiFingerGesture.pinchZoom Note: if interactiveFlags doesn't contain InteractiveFlag.pinchZoom or enableMultiFingerGestureRace is false then zoom cannot win
final
pinchZoomWinGestures int
When pinchZoomThreshold wins over rotationThreshold and pinchMoveThreshold then pinchZoomWinGestures gestures will be used. By default MultiFingerGesture.pinchZoom and MultiFingerGesture.pinchMove gestures will take effect see MultiFingerGesture for custom settings
final
rotation double
final
rotationThreshold double
Rotation threshold in degree default is 20.0 Map starts to rotate when rotationThreshold has been achieved or another multi finger gesture wins which allows MultiFingerGesture.rotate Note: if interactiveFlags doesn't contain InteractiveFlag.rotate or enableMultiFingerGestureRace is false then rotate cannot win
final
rotationWinGestures int
When rotationThreshold wins over pinchZoomThreshold and pinchMoveThreshold then rotationWinGestures gestures will be used. By default only MultiFingerGesture.rotate gesture will take effect see MultiFingerGesture for custom settings
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
screenSize Size?
final
scrollWheelVelocity double
final
slideOnBoundaries bool
final
swPanBoundary LatLng?
final
zoom double
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited