How to 2-finger touch on the "google_maps_flutter" to only zoom, but keep the center of the screen fixed

124 Views Asked by At

I'm building a mobile map app with Flutter, and I want to zoom with two-finger taps, but I don't want the screen to slide.

I want to completely separate the functions, with one-finger touch to move the center of the screen and two-finger touch to zoom.

Additionally, I would like to know how to limit the zoom units to only integers. I can think of two ways to do this, one where the zoom goes from 6 to 6.1 and when you release the touch it goes to 7. The other way is to change the zoom to an unconditional rounded value. Either way, I'd like to make it simple to implement.

[my current code]

GoogleMap(
  initialCameraPosition: CameraPosition(
    target: center,
    zoom: zoom.toDouble(),
  ),
  onMapCreated: mapController.complete,
  mapToolbarEnabled: false,
  cameraTargetBounds: CameraTargetBounds(LatLngBounds(
    southwest: const LatLng(33, 124),
    northeast: const LatLng(39, 132),
  )),
  minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
  rotateGesturesEnabled: false,
  zoomControlsEnabled: false,
  tiltGesturesEnabled: false,
  myLocationButtonEnabled: false,
)
0

There are 0 best solutions below