Last active
November 20, 2020 15:15
-
-
Save dariadobsai/54784f4153be65e480c69623bbb24d0c to your computer and use it in GitHub Desktop.
MapBox in Flutter Part 1
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
class HomePage extends StatefulWidget { | |
@override | |
_HomePageState createState() => _HomePageState(); | |
} | |
class _HomePageState extends State<HomePage> { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: FlutterMap( | |
options: MapOptions( | |
center: LatLng(51.5074, 0.1278), | |
zoom: 16.0, | |
minZoom: 10, | |
), | |
layers: [ | |
new TileLayerOptions( | |
urlTemplate: | |
'https://api.mapbox.com/styles/v1/{user}/{style}/tiles/256/{z}/{x}/{y}@2x?access_token={accessToken}', | |
additionalOptions: { | |
'accessToken': 'YOUR accessToken', | |
}, | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment