Bm Mn
Bm Mn

Reputation: 641

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?

Upvotes: 4

Views: 1491

Answers (3)

Deepak Sapkota
Deepak Sapkota

Reputation: 124

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,
    ),
    // ...

Upvotes: 4

Valeriy Golyshev
Valeriy Golyshev

Reputation: 21

You need to add this

MapOptions(
  enableMultiFingerGestureRace: true,
),

Found solution in flutter_map issues here.

Upvotes: 2

Md. Samiul Islam
Md. Samiul Islam

Reputation: 21

Add "InteractiveFlag.rotate" inside.

MapOptions(

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

Upvotes: 0

Related Questions