Skip to content

Instantly share code, notes, and snippets.

@Aditsyal Aditsyal/mapType.dart Secret
Last active Apr 10, 2019

What would you like to do?
MapType _defaultMapType = MapType.normal;
void _changeMapType() {
setState(() {
_defaultMapType = _defaultMapType == MapType.normal ? MapType.satellite : MapType.normal;
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Maps in Flutter'),
centerTitle: true,
body: Stack(
children: <Widget>[
mapType: _defaultMapType,
myLocationEnabled: true,
onMapCreated: _onMapCreated,
initialCameraPosition: _initialPosition,
margin: EdgeInsets.only(top: 80, right: 10),
alignment: Alignment.topRight,
child: Column(
children: <Widget>[
child: Icon(Icons.layers),
elevation: 5,
backgroundColor: Colors.teal[200],
onPressed: () {
print('Changing the Map Type');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.