在Flutter GoogleMap上平移/拖曳手势

时间:2019-10-03 14:56:04

标签: dictionary flutter drag pan

如何在GoogleMap上检测平移手势?我还需要检测用户触摸的纬度和经度。 我已经尝试过了,但是没有成功:

GoogleMap(
        mapType: MapType.hybrid,
        initialCameraPosition: CameraPosition(
          target: LatLng(37.42796133580664, -122.085749655962),
          zoom: 14.4746,
        ),
        gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[
          Factory<OneSequenceGestureRecognizer>(
            () => PanGestureRecognizer()
              ..onUpdate = (data) {
                print(data.localPosition);
              },
          ),
        ].toSet(),
        onMapCreated: (GoogleMapController controller) {
          _mapController.complete(controller);
        },
      )

0 个答案:

没有答案