Yash Kadam
Yash Kadam

Reputation: 1

how to set the marker at the center and move the map around that marker in flutter and I dont what the cameraPosition while Zooming in or out

Movable Marker,

So this is the movable marker when the marker is dragged and dropped it only fetches the lat and long when it is dropped and it is working perfectly, but when I am Zooming IN and OUT the Camera Position is Changes And I Don't want that

I am using Getx and this is the function I am using

var isStop = false;
CameraPosition? cameraPosition;
double previousZoom = 14.0;
LatLng? previousTarget;
void updateCameraPosition(CameraPosition newPosition) {
bool isZooming = newPosition.zoom != previousZoom;
bool isDragging = newPosition.target != previousTarget;
if (isDragging && !isZooming){
isStop = true;
marker = marker?.copyWith(positionParam: newPosition.target); 
isStop = false;
}
previousZoom = newPosition.zoom;
previousTarget = newPosition.target;
cameraPosition = newPosition;
update();

 //--And this is the UI Where I am calling the function--//

 onCameraMove: (CameraPosition newPosition) {
 controller.updateCameraPosition(newPosition);
 },

Upvotes: 0

Views: 42

Answers (0)

Related Questions