MapOptions class
All options for the FlutterMap widget.
- Annotations
Constructors
- MapOptions({Crs crs = const Epsg3857(), LatLng initialCenter = const LatLng(50.5, 30.51), double initialZoom = 13.0, double initialRotation = 0.0, CameraFit? initialCameraFit, CameraConstraint cameraConstraint = const CameraConstraint.unconstrained(), InteractionOptions interactionOptions = const InteractionOptions(), double? minZoom, double? maxZoom, Color backgroundColor = const Color(0xFFE0E0E0), TapCallback? onTap, TapCallback? onSecondaryTap, LongPressCallback? onLongPress, PointerDownCallback? onPointerDown, PointerUpCallback? onPointerUp, PointerCancelCallback? onPointerCancel, PointerHoverCallback? onPointerHover, PositionCallback? onPositionChanged, MapEventCallback? onMapEvent, VoidCallback? onMapReady, bool keepAlive = false, @Deprecated('If necessary, manually wrap layers with `TransulcentPointer` widgets. ' 'This parameter will be removed as proper hit detection has now been incorporated into both `PolygonLayer` & `PolylineLayer`, which reduces the need for this workaround, and because it caused issues in some cases. More information about hit detection & interactivity rules can be found in the online documentation. ' 'The default of this parameter is now `false` and will use the rules above - the option is retained so as not to break APIs. ' 'This feature was deprecated (and the default changed) after v7.') bool applyPointerTranslucencyToLayers = false})
-
Create the map options for FlutterMap.
const
Properties
- applyPointerTranslucencyToLayers → bool
-
DEPRECATED
final
- backgroundColor → Color
-
The background color of the FlutterMap widget, defaults to a
yellow grey-ish color.
final
- cameraConstraint → CameraConstraint
-
Define limits for viewing the map.
final
- crs → Crs
-
The Coordinate Reference System, defaults to Epsg3857.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- initialCameraFit → CameraFit?
-
Defines the visible bounds when the map is first loaded. Takes precedence
over initialCenter/initialZoom.
final
- initialCenter → LatLng
-
The center when the map is first loaded. If initialCameraFit is defined
this has no effect.
final
- initialRotation → double
-
The rotation when the map is first loaded.
final
- initialZoom → double
-
The zoom when the map is first loaded. If initialCameraFit is defined
this has no effect.
final
- interactionOptions → InteractionOptions
-
Gesture and input options for the map widget.
final
- keepAlive → bool
-
Flag to enable the built in keep alive functionality
final
- maxZoom → double?
-
The maximum (highest) zoom level of every layer. Each layer can specify
additional zoom level restrictions.
final
- minZoom → double?
-
The minimum (smallest) zoom level of every layer. Each layer can specify
additional zoom level restrictions.
final
- onLongPress → LongPressCallback?
-
Callback that fires when the primary pointer has remained in contact with the
screen at the same location for a long period of time.
final
- onMapEvent → MapEventCallback?
-
This callback fires on every map event that gets emitted. Check the type
of MapEvent to distinguish between the different event types.
final
- onMapReady → VoidCallback?
-
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?
-
This callback fires when the pointer that previously triggered the
onTapDown won’t end up causing a tap.
final
- onPointerDown → PointerDownCallback?
-
A pointer that might cause a tap has contacted the screen at a
particular location.
final
- onPointerHover → PointerHoverCallback?
-
Called when a pointer that has not triggered an onPointerDown
changes position.
This is only fired for pointers which report their location when not
down (e.g. mouse pointers, but not most touch pointers)
final
- onPointerUp → PointerUpCallback?
-
A pointer that triggers a tap has stopped contacting the screen at a
particular location.
final
- onPositionChanged → PositionCallback?
-
This callback fires when the MapCamera data has changed. This gets
called if the zoom level, or map center changes.
final
- onSecondaryTap → TapCallback?
-
Callback that fires when the map gets tapped or clicked with the
secondary mouse button. This is normally the right mouse button.
final
- onTap → TapCallback?
-
Callback that fires when the map gets tapped or clicked with the
primary mouse button. This is normally the left mouse button. This
callback does not fire if the gesture is recognized as a double click.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
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.
override
Static Methods
-
maybeOf(
BuildContext context) → MapOptions? - The options of the closest FlutterMap ancestor. If this is called from a context with no FlutterMap ancestor, null is returned.
-
of(
BuildContext context) → MapOptions - The options of the closest FlutterMap ancestor. If this is called from a context with no FlutterMap ancestor a StateError will be thrown.