flutterfluttermap

Disabling flutter_map package rotation while zooming


How to disable map rotation in flutter_map while zooming?

I tried this way:

MapOptions(

    interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
    zoom: 15.0,
  ),

But this always disable rotation. I only want to temporarily disable rotation when zooming. Is this possible?


Solution

  • With the release of V6, you can achieve this via the interactionOptions parameter.

    Releases v6.0.0

    Here is a code sample for reference:

    FlutterMap(
      options: MapOptions(
        //...
        interactionOptions: const InteractionOptions(
          enableMultiFingerGestureRace: true,
          flags: InteractiveFlag.doubleTapDragZoom |
              InteractiveFlag.doubleTapZoom |
              InteractiveFlag.drag |
              InteractiveFlag.flingAnimation |
              InteractiveFlag.pinchZoom |
              InteractiveFlag.scrollWheelZoom,
        ),
        // ...