Created
December 1, 2018 09:13
-
-
Save fvisticot/3a77ed847d6ddfcaadb68120cb12daea to your computer and use it in GitHub Desktop.
Debug Google Maps View in ListView
This file contains 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
import 'package:flutter/material.dart'; | |
import 'package:google_maps_flutter/google_maps_flutter.dart'; | |
class SettingsPage extends StatefulWidget { | |
@override | |
createState() => SettingsPageState(); | |
} | |
class SettingsPageState extends State<SettingsPage> { | |
GoogleMapController _mapController; | |
@override | |
void initState() { | |
super.initState(); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text('Settings'), | |
), | |
body: ListView( | |
children: [ | |
SizedBox( | |
height: 250, | |
child: GoogleMap( | |
options: GoogleMapOptions( | |
mapType: MapType.hybrid, | |
zoomGesturesEnabled: true, | |
rotateGesturesEnabled: true, | |
scrollGesturesEnabled: true, | |
tiltGesturesEnabled: true, | |
), | |
onMapCreated: (GoogleMapController controller) { | |
_mapController = controller; | |
_mapController.animateCamera( | |
CameraUpdate.newCameraPosition( | |
CameraPosition( | |
target: LatLng(44.659, -1.156), zoom: 17.0), | |
), | |
); | |
_mapController.addMarker( | |
MarkerOptions( | |
position: LatLng(44.659, -1.156), | |
infoWindowText: InfoWindowText("Title", "Content"), | |
icon: BitmapDescriptor.fromAsset( | |
'images/icon.png', | |
), | |
), | |
); | |
}, | |
), | |
), | |
], | |
)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment