dynamic
build(- dynamic context
)
Implementation
@override
Widget build(BuildContext context) {
if (mapElement.pointers.isEmpty || mapElement.pointers.first.geo == null) {
return EMPTY_WIDGET;
}
// TODO(monsieurtanuki): Zoom the map to show all [mapElement.pointers]
// TODO(monsieurtanuki): Add a OSM copyright.
return Padding(
padding: const EdgeInsets.only(bottom: MEDIUM_SPACE),
child: SizedBox(
height: 200,
child: FlutterMap(
options: MapOptions(
// The first pointer is used as the center of the map.
center: LatLng(
mapElement.pointers.first.geo!.lat,
mapElement.pointers.first.geo!.lng,
),
zoom: 6.0,
),
layers: <LayerOptions>[
TileLayerOptions(
urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
subdomains: <String>['a', 'b', 'c'],
),
MarkerLayerOptions(
markers: getMarkers(mapElement.pointers),
),
],
),
),
);
}