Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何检查google地图是否仅通过用户手势移动(平移、倾斜、挤压…),而不是通过编程方式移动_Android_Google Maps_Flutter_Dart - Fatal编程技术网

Android 如何检查google地图是否仅通过用户手势移动(平移、倾斜、挤压…),而不是通过编程方式移动

Android 如何检查google地图是否仅通过用户手势移动(平移、倾斜、挤压…),而不是通过编程方式移动,android,google-maps,flutter,dart,Android,Google Maps,Flutter,Dart,医生说 // Called when the camera starts moving. /// /// This can be initiated by the following: /// 1. Non-gesture animation initiated in response to user actions. /// For example: zoom buttons, my location button, or marker clicks. /// 2.

医生说

// Called when the camera starts moving.
  ///
  /// This can be initiated by the following:
  /// 1. Non-gesture animation initiated in response to user actions.
  ///    For example: zoom buttons, my location button, or marker clicks.
  /// 2. Programmatically initiated animation.
  /// 3. Camera motion initiated in response to user gestures on the map.
  ///    For example: pan, tilt, pinch to zoom, or rotate.
  final VoidCallback onCameraMoveStarted;
如何检查地图是否仅通过用户手势移动(3)(平移、倾斜、收缩…)而非编程方式(1)和(2)

无论如何,您可以一起跟踪和相机更新,并确定地图是否由于用户手势而移动。甚至像提议的那样:

返回吸收器指针(
是的,
孩子:谷歌地图(
mapType:mapType.normal,
initialCameraPosition:cameraPosition,
手势识别器:{
工厂(()=>scalegesturererecognizer()),
}
)
);

然后以编程方式处理所有这些问题,并决定如何处理地图。

即使以编程方式移动相机,也会调用此函数
return AbsorbPointer(
  absorbing: true,
  child: GoogleMap(
    mapType: MapType.normal,
    initialCameraPosition: cameraPosition,
    gestureRecognizers: {
    Factory<OneSequenceGestureRecognizer>(() => ScaleGestureRecognizer()),
    }
  )
);