my bytecode
my bytecode

Reputation: 404

Flutter google_maps pinch to zoom

I am trying to implement a google_maps in flutter where I can zoom-in and zoom-out by pinching like official google maps. I cannot find any method for implementing the same. My code snippet is -

GoogleMap(
       onMapCreated: _onMapCreated,
       initialCameraPosition: CameraPosition(
       target: _center,
       zoom: -3.0
       ),
       scrollGesturesEnabled: true,
       zoomGesturesEnabled: true,
       myLocationButtonEnabled: false,
       gestureRecognizers: Set()
         ..add( Factory<PanGestureRecognizer>(() => PanGestureRecognizer())),
       markers: markers
   );

Thanks in advance.

Upvotes: 1

Views: 2604

Answers (3)

Praveen Aanand
Praveen Aanand

Reputation: 117

I Just upgrade the flutter SDK, And now its working.

Upvotes: 0

Muhammad Tameem Rafay
Muhammad Tameem Rafay

Reputation: 4575

The above answer is also correct but if your map is wrapped in the SingleChildScrollView() widget then the zoom feature will not work fine.

Upvotes: 0

Mohammad Kurjieh
Mohammad Kurjieh

Reputation: 1143

The problem is that the zoom level is negative however the min zoom level is 0.

Upvotes: 1

Related Questions