Skip to content

Instantly share code, notes, and snippets.

@dariadobsai
Last active November 20, 2020 15:15
Show Gist options
  • Save dariadobsai/54784f4153be65e480c69623bbb24d0c to your computer and use it in GitHub Desktop.
Save dariadobsai/54784f4153be65e480c69623bbb24d0c to your computer and use it in GitHub Desktop.
MapBox in Flutter Part 1
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