Vmap class
A map of any MapLibre style, drawn by vmap.
One finger pans; two pinch, turn, and tilt when dragged up or down
together; a double tap zooms in and a two finger tap out; a double tap
held and dragged zooms. A mouse wheel zooms, a double click zooms in and
a shift double click out, a right or control drag turns and tilts, and a
shift drag zooms to its box. Two fingers on a trackpad slide the map, a
pinch zooms and a twist turns it. With focus the arrow keys pan, + and
- zoom, two levels with shift, and shift with the arrows turns and
tilts. gestures switches each of them off, by MapLibre GL JS's
handler names. Released gestures and interrupted animations keep their
speed and slow down naturally.
- Inheritance
Constructors
-
Vmap({VmapController? controller, VmapCamera initialCamera = const VmapCamera(center: LatLng(0, 0), zoom: 1), VmapStyle style = VmapStyle.light, VmapOverlay? overlay, List<
VmapStyleEdit> styleEdits = const [], List<VmapFeatureState> featureStates = const [], List<VmapMarker> markers = const [], VmapPins? pins, VmapTextStyle textStyle = const VmapTextStyle(), VmapLabelOptions labels = const VmapLabelOptions(), VmapNetworkOptions network = const VmapNetworkOptions(), VmapRenderOptions rendering = const VmapRenderOptions(), List<VmapFont> fonts = const [], VmapEngine? engine, double minZoom = 0, double maxZoom = 22, double maxPitch = 60, VmapGestureOptions gestures = const VmapGestureOptions(), bool attribution = true, WidgetBuilder? loadingBuilder, void onTap(LatLng point)?, void onFeatureTap(VmapFeature feature, LatLng point)?, List<String> ? tappableLayers, void onLongPress(LatLng point)?, void onCameraMove(VmapCamera camera)?, void onCameraIdle(VmapCamera camera)?, VoidCallback? onStyleLoaded, VoidCallback? onIdle, void onError(VmapError error)?, String semanticLabel = 'Map', Key? key}) -
A map of
style, atinitialCameraor wherecontrollersays.const
Properties
- attribution → bool
-
Shows the credit the style's sources ask for in a corner, as their
terms require. Off, the app must show it some other way: see
VmapEngine.attributions.
final
- controller → VmapController?
-
Moves the map from code and reads where it looks. The map makes its
own, starting at initialCamera, when none is given.
final
- engine → VmapEngine?
-
Draws with an engine the app made and owns, to keep loaded tiles
across pages or share them. The parameters above that configure an
engine are then ignored: set them on this one.
final
-
featureStates
→ List<
VmapFeatureState> -
State for single features, which the style reads with
['feature-state', name]: the way to highlight what was tapped.final -
fonts
→ List<
VmapFont> -
Fonts labels may be shaped with, beyond the app's own. Read when the
map is first built.
final
- gestures → VmapGestureOptions
-
Which gestures, mouse moves and keys move the map.
VmapGestureOptions.none leaves it to controller; taps are still
reported.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialCamera → VmapCamera
-
Where a map without a controller starts.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- labels → VmapLabelOptions
-
Which labels are written and how they are placed.
final
- loadingBuilder → WidgetBuilder?
-
Shown over the map until it first draws tiles, or until it fails.
final
-
markers
→ List<
VmapMarker> -
Widgets drawn above the map at places. Map labels keep clear of them.
final
- maxPitch → double
-
Degrees, at most 85. Past about 60 the horizon and the sky show.
final
- maxZoom → double
-
final
- minZoom → double
-
The zooms gestures and animations keep to.
final
- network → VmapNetworkOptions
-
How the map fetches and keeps what it loads. Read when the map is
first built.
final
- onCameraIdle → void Function(VmapCamera camera)?
-
Called once the camera comes to rest after moving.
final
- onCameraMove → void Function(VmapCamera camera)?
-
Called as the camera moves, by a gesture or from code.
final
- onError → void Function(VmapError error)?
-
Told of everything the map could not load or draw. Only for the map's
own engine; an app's engine reports to its own
onError.final - onFeatureTap → void Function(VmapFeature feature, LatLng point)?
-
Called with the topmost feature under a tap, when there is one: a
road, a place, a building, a feature of the overlay. It reads the
tiles off the UI thread, so it comes a moment after onTap.
final
- onIdle → VoidCallback?
-
Called when the map has drawn everything in view and has nothing left
to load or animate.
final
- onLongPress → void Function(LatLng point)?
-
Called with the place a finger was held on.
final
- onStyleLoaded → VoidCallback?
-
Called each time a style has loaded and is drawn.
final
- onTap → void Function(LatLng point)?
-
Called with the place tapped. VmapController.featuresAt tells what
the style draws there.
final
- overlay → VmapOverlay?
-
Sources and layers of the app's own, drawn with the style.
final
- pins → VmapPins?
-
Draws places of interest as round pins instead of the style's icons.
final
- rendering → VmapRenderOptions
-
What draws the map. Read when the map is first built.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticLabel → String
-
What screen readers announce for the map.
final
- style → VmapStyle
-
The style to draw: one of MapLibre's, by address or as JSON, or the
built in one, which needs no key.
final
-
styleEdits
→ List<
VmapStyleEdit> -
Changes to single layers of the style: a colour, a filter, whether a
layer is shown.
final
-
tappableLayers
→ List<
String> ? -
The ids of the style layers onFeatureTap reports features of, as
MapLibre's
map.on('click', layerId); every layer when null.final - textStyle → VmapTextStyle
-
The fonts of labels, their scale, and the look of markers' names.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< Vmap> -
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
-
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, int wrapWidth = 65}) → 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