setCenterCoordinate method
设置地图中心点
Implementation
Future setCenterCoordinate(
double lat,
double lng, {
double zoomLevel = 15,
bool animated = true,
}) {
return platform(
android: (pool) async {
final map = await _androidController.getMap();
final latLng = await ObjectFactory_Android
.createcom_amap_api_maps_model_LatLng__double__double(lat, lng);
final cameraPosition = await ObjectFactory_Android
.createcom_amap_api_maps_model_CameraPosition__com_amap_api_maps_model_LatLng__float__float__float(
latLng, zoomLevel, 0, 0);
final cameraUpdate = await com_amap_api_maps_CameraUpdateFactory
.newCameraPosition(cameraPosition);
await map.moveCamera(cameraUpdate);
pool..add(map)..add(latLng)..add(cameraUpdate);
},
ios: (pool) async {
final latLng =
await ObjectFactory_iOS.createCLLocationCoordinate2D(lat, lng);
await _iosController.setCenterCoordinateAnimated(latLng, animated);
pool..add(latLng);
},
);
}