Comment on page
FlutterMapwidget, containing multiple feature layers, atop a
To insert a layer, add it to the
childrenproperty. Other layers (sometimes referred to as 'feature layers', as they are map features) can then be stacked on top, where the last widget in the
childrenlist is topmost. For example, you might display a
MarkerLayer, or any widget as your own custom layer (Creating New Layers)!
It is possible to add more than one
TileLayer! Transparency in one layer will reveal the layers underneath.
Each layer is isolated from the other layers, and so handles its own independent logic and handling. However, they can access and modify the internal state of the map, as well as respond to changes.
By default, each layer acts translucently to gestures, meaning they can handle gestures themselves, but they also allow gestures to bubble down to other layers beneath them.
This behaviour can be disabled in the
MapOptions, by setting
.applyPointerTranslucencyToLayersfalse. Optionally, then, the
TranslucentPointerwidget can be wrapped around individal layers to achieve the desired effect.
Most layers are 'mobile', such as the
TileLayer. These use a
MobileLayerTransformerwidget internally, which enables the layer to properly move and rotate with the map's current camera.
However, some layers are 'static', such as the
AttributionLayers. These aren't designed to move nor rotate with the map, and usually make use of a widget like
SizedBox.expandto achieve this.
Both of these layer types are defined in the same
childrenlist. Most of the time, static layers go atop mobile layers, so should be at the end of the list.
Last modified 3mo ago