Disabling flutter_map package rotation in Flutter
1,531
Solution 1
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),
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
zoom: 13.0,
),
By doing this, you can ensure that only pinchZoom
and drag
actions are allowed in your map.
Solution 2
Looking at the API Documentation, there is a class MultiFingerGesture. This looks like it controls the gestures on the Widget, and there is an option to only allow PinchMove, or PinchZoom. The default looks like it's the all option. If you change the Map's property that equates to this class, and change to either PinchMove, or PinchZoom then it should work. Please review the class here:
Author by
João Martins
A Portuguese Android Developer, currently living in Poland :)
Updated on November 28, 2022Comments
-
João Martins over 1 year
How do you disable the rotation of the map in flutter_map?
-
Dan Gerchcovich over 3 yearsI've never used this package, so I'm taking this only from the author's api documentation. If this does not give you any compile time errors, then go ahead. Please try this, and let me know
-
João Martins over 3 yearsNah it did not work. I added the
.pichZoom
option and it still rotates. -
Dan Gerchcovich over 3 yearsthen I would post an issue on the github repository. Contact the Author, and they can help