How do you disable the rotation of the map in flutter_map?
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.
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:
https://pub.dev/documentation/flutter_map/latest/flutter_map.plugin_api/MultiFingerGesture-class.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With