CodePudding user response:
For draggable you should use setOptions
map.setOptions({draggable: true});
and for marker in center
marker.setPosition( map.getCenter(););
CodePudding user response:
Put your GoogleMap
inside Stack
then put your cursor widget in the Center
on the top of your GoogleMap
as follow:
Stack(
children: [
GoogleMap(),
Center(child: CursorrWidget()),
],
);
To calculate your cursor latitude and longitude call this function when notifying onCameraIdle
:
GoogleMap(
onCameraIdle: () {
LatLngBounds bounds = mapController.getVisibleRegion();
final lon = (bounds.northeast.longitude bounds.southwest.longitude) / 2;
final lat = (bounds.northeast.latitude bounds.southwest.latitude) / 2;
}
)