📜  颤动谷歌地图更改相机位置 - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:05.928000             🧑  作者: Mango

代码示例1
CameraPosition _initialPosition = CameraPosition(target: _latlng, zoom: 16);
 Position currentLocation;



_getLocation() async {
   currentLocation = await Geolocator()
       .getCurrentPosition(desiredAccuracy: LocationAccuracy.best);

   var newPosition = CameraPosition(
       target: LatLng(currentLocation.latitude, currentLocation.longitude),
       zoom: 16);

   CameraUpdate update =CameraUpdate.newCameraPosition(newPosition);
   CameraUpdate zoom = CameraUpdate.zoomTo(16);

   _mapController.moveCamera(update);      
 }