Skip to content

Instantly share code, notes, and snippets.

@Aditsyal Aditsyal/moveTheCamera.dart Secret
Last active Apr 11, 2019

Embed
What would you like to do?
final double _zoom = 10;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Maps in Flutter'),
centerTitle: true,
),
drawer: _drawer(),
.
.
.
.
.
);
}
Widget _drawer(){
return Drawer(
elevation: 16.0,
child: Column(
children: <Widget>[
UserAccountsDrawerHeader(
accountName: Text("xyz"),
accountEmail: Text("xyz@gmail.com"),
currentAccountPicture: CircleAvatar(
backgroundColor: Colors.white,
child: Text("xyz"),
),
otherAccountsPictures: <Widget>[
CircleAvatar(
backgroundColor: Colors.white,
child: Text("abc"),
)
],
),
ListTile(
title: new Text("Places"),
leading: new Icon(Icons.flight),
),
Divider(),
ListTile(
onTap: (){
_goToNewYork();
Navigator.of(context).pop();
},
title: new Text("New York"),
trailing: new Icon(Icons.arrow_forward_ios),
),
],
),
);
}
Future<void> _goToNewYork() async {
double lat = 40.7128;
double long = -74.0060;
GoogleMapController controller = await _controller.future;
controller.animateCamera(CameraUpdate.newLatLngZoom(LatLng(lat, long), _zoom));
}
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.