Created
February 9, 2021 22:55
-
-
Save dariadobsai/f4c4107f5b61097e79a11df029efbd9a to your computer and use it in GitHub Desktop.
Historical map overlay with MapBox in Flutter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return Scaffold( | |
body: FlutterMap( | |
options: MapOptions( | |
onLongPress: addPin, | |
center: LatLng(47.4990, 19.0437), // Széchenyi Chain Bridge Coordinates | |
zoom: 12.0, // Changed zoom level from 16 to 12, to better see the whole overlay area from further distance | |
minZoom: 10, | |
plugins: [ | |
UserLocationPlugin(), | |
], | |
), | |
layers: [ | |
new TileLayerOptions( | |
urlTemplate: | |
"https://api.mapbox.com/styles/v1/{user}/{style}/tiles/256/{z}/{x}/{y}?access_token={accessToken}", // TODO: Paste your style here | |
// TODO: add access token here OR if you keep it in one line in `urlTemplate`, then delete `additionalOptions`. | |
additionalOptions: { | |
'accessToken': 'Your accessToken', | |
}, | |
), | |
MarkerLayerOptions( | |
markers: markers, | |
), | |
userLocationOptions, | |
], | |
mapController: mapController, | |
), | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment