MapWidget class
A MapWidget provides an embeddable map interface. You use this class to display map information and to manipulate the map contents from your application. You can center the map on a given coordinate, specify the size of the area you want to display, and style the features of the map to fit your application's use case.
Use of MapWidget requires a Mapbox API access token. Obtain an access token on the Mapbox account page.
Warning: Please note that you are responsible for getting permission to use the map data, and for ensuring your use adheres to the relevant terms of use.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- MapWidget
Constructors
-
MapWidget({Key? key, required ResourceOptions resourceOptions, MapOptions? mapOptions, CameraOptions? cameraOptions, bool? textureView = true, String styleUri = MapboxStyles.MAPBOX_STREETS, Set<
Factory< ? gestureRecognizers, MapCreatedCallback? onMapCreated, OnStyleLoadedListener? onStyleLoadedListener, OnCameraChangeListener? onCameraChangeListener, OnMapIdleListener? onMapIdleListener, OnMapLoadedListener? onMapLoadedListener, OnMapLoadErrorListener? onMapLoadErrorListener, OnRenderFrameStartedListener? onRenderFrameStartedListener, OnRenderFrameFinishedListener? onRenderFrameFinishedListener, OnSourceAddedListener? onSourceAddedListener, OnSourceDataLoadedListener? onSourceDataLoadedListener, OnSourceRemovedListener? onSourceRemovedListener, OnStyleDataLoadedListener? onStyleDataLoadedListener, OnStyleImageMissingListener? onStyleImageMissingListener, OnStyleImageUnusedListener? onStyleImageUnusedListener, OnMapTapListener? onTapListener, OnMapLongTapListener? onLongTapListener, OnMapScrollListener? onScrollListener})OneSequenceGestureRecognizer> >
Properties
- cameraOptions → CameraOptions?
-
The Initial Camera options when creating a MapWidget.
final
-
gestureRecognizers
→ Set<
Factory< ?OneSequenceGestureRecognizer> > -
Which gestures should be consumed by the map.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- mapOptions → MapOptions?
-
Describes the map options value when using a MapWidget.
final
- onCameraChangeListener → OnCameraChangeListener?
-
Invoked whenever camera position changes.
final
- onLongTapListener → OnMapLongTapListener?
-
final
- onMapCreated → MapCreatedCallback?
-
Invoked when a new Map is created and return a MapboxMap instance to handle the Map.
final
- onMapIdleListener → OnMapIdleListener?
-
Invoked when the Map has entered the idle state. The Map is in the idle state when there are no ongoing transitions
and the Map has rendered all available tiles.
final
- onMapLoadedListener → OnMapLoadedListener?
-
Invoked when the Map's style has been fully loaded, and the Map has rendered all visible tiles.
final
- onMapLoadErrorListener → OnMapLoadErrorListener?
-
Invoked whenever the map load errors out.
final
- onRenderFrameFinishedListener → OnRenderFrameFinishedListener?
-
Invoked whenever the Map finished rendering a frame.
The render-mode value tells whether the Map has all data ("full") required to render the visible viewport.
The needs-repaint value provides information about ongoing transitions that trigger Map repaint.
The placement-changed value tells if the symbol placement has been changed in the visible viewport.
final
- onRenderFrameStartedListener → OnRenderFrameStartedListener?
-
Invoked whenever the Map started rendering a frame.
final
- onScrollListener → OnMapScrollListener?
-
final
- onSourceAddedListener → OnSourceAddedListener?
-
Invoked whenever the Source has been added with StyleManager#addStyleSource runtime API.
final
- onSourceDataLoadedListener → OnSourceDataLoadedListener?
-
Invoked when the requested source data has been loaded.
final
- onSourceRemovedListener → OnSourceRemovedListener?
-
Invoked whenever the Source has been removed with StyleManager#removeStyleSource runtime API.
final
- onStyleDataLoadedListener → OnStyleDataLoadedListener?
-
Invoked when the requested style data has been loaded.
final
- onStyleImageMissingListener → OnStyleImageMissingListener?
-
Invoked whenever a style has a missing image. This event is emitted when the Map renders visible tiles and
one of the required images is missing in the sprite sheet. Subscriber has to provide the missing image
by calling StyleManager#addStyleImage method.
final
- onStyleImageUnusedListener → OnStyleImageUnusedListener?
-
Invoked whenever an image added to the Style is no longer needed and can be removed using StyleManager#removeStyleImage method.
final
- onStyleLoadedListener → OnStyleLoadedListener?
-
Invoked when the requested style has been fully loaded, including the style, specified sprite and sources' metadata.
final
- onTapListener → OnMapTapListener?
-
final
- resourceOptions → ResourceOptions
-
Resource options when using a MapWidget. Access token required when using a Mapbox service. Please see https://www.mapbox.com/help/create-api-access-token/ to learn how to create one.More information in this guide https://www.mapbox.com/help/first-steps-android-sdk/#access-tokens.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- styleUri → String
-
The styleUri will applied for the MapWidget in the onStart lifecycle event if no style is set. Default is
Style.MAPBOX_STREETS
.final - textureView → bool?
-
Flag indicating to use a TextureView as render surface for the MapWidget.
Only works for Android.
FIXME Flutter 3.x has memory leak on Android using in SurfaceView mode, see https://github.com/flutter/flutter/issues/118384
As a workaround default is true.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< StatefulWidget> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
getMapboxMap(
) → MapboxMap? -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited