10

如何在flutter_map中禁用地图的旋转?

4

2 回答 2

22

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.

于 2021-02-01T12:10:08.710 回答
1

查看 API 文档,有一个类MultiFingerGesture。这看起来像是控制 Widget 上的手势,并且有一个选项只允许PinchMovePinchZoom。默认看起来像是全部选项。如果您更改相当于此类的 Map 属性,并更改为PinchMovePinchZoom ,那么它应该可以工作。请在此处查看课程:

https://pub.dev/documentation/flutter_map/latest/flutter_map.plugin_api/MultiFingerGesture-class.html

于 2021-02-01T10:58:06.433 回答