How do you disable the rotation of the map in flutter_map?
-
4pub.dev/documentation/flutter_map/latest/flutter_map.plugin_api/…pskink– pskink2021-02-01 11:06:30 +00:00Commented Feb 1, 2021 at 11:06
-
1This 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.João Martins– João Martins2021-02-01 12:05:31 +00:00Commented Feb 1, 2021 at 12:05
-
yes, write a self answer thenpskink– pskink2021-02-01 12:06:19 +00:00Commented Feb 1, 2021 at 12:06
Add a comment
|
4 Answers
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.