Reputation: 42
I want to move a marker like Uber, I found an example in Android but I need to do in Flutter, Can somebody help me?
Upvotes: 0
Views: 3294
Reputation: 221
If you are using google_maps_flutter package, onCameraMove will always give you the lat, lng of the center of the map. So you can have a Stack and place a marker like an image at the center on top of the map.
Stack(children: <Widget>[
GoogleMap(
initialCameraPosition: _initialCamera,
onMapCreated: _mapCreated,
onCameraMove: (position) {
newLocation = position.target;
},
onCameraIdle: () async {
// you can use the captured location here. when the user stops moving the map.
},
),
//This is your marker
Align(
alignment: Alignment.center,
child: Icon(Icons.place),
),
])
Upvotes: 3
Reputation: 7601
Upvotes: 0