20

How do you disable the rotation of the map in flutter_map?

3
  • 4
    pub.dev/documentation/flutter_map/latest/flutter_map.plugin_api/… Commented Feb 1, 2021 at 11:06
  • 1
    This worked. If you wish to get a correct answer please post an Answer instead of a comment. Thank you :) Or I can answer it by myself and give you the credits. Commented Feb 1, 2021 at 12:05
  • yes, write a self answer then Commented Feb 1, 2021 at 12:06

4 Answers 4

47

As written by @pskink the answer is to use the InteractiveFlag provided by flutter_map in such a way

MapOptions(
    minZoom: 11.0,
    maxZoom: 17.0,
    center: LatLng(lat, lng),
    interactionOptions: const InteractionOptions(
        flags: InteractiveFlag.pinchZoom | InteractiveFlag.drag),
    zoom: 13.0,
  ),

By doing this, you can ensure that only pinchZoom and drag actions are allowed in your map.

Sign up to request clarification or add additional context in comments.

Comments

15

This is better:

MapOptions (  
    interactiveFlags: InteractiveFlag.all & ~InteractiveFlag.rotate,
 )

Comments

4

MapOptions (
interactiveFlags: InteractiveFlag.all & ~InteractiveFlag.rotate, )

I have used this in the past

Comments

3

Update April 2024:

MapOptions(
  interactionOptions: InteractionOptions(
      flags: InteractiveFlag.drag | InteractiveFlag.pinchZoom,
  ),
)

You can allow the interactions you need in "flags", by specifying them, just like I did with the drag and pinchZoom interactions.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.