I am trying to mapView of my mobile screen like this. This view is showing on the web. Its camera position is covering all the markers. But On mobile, I am using google_map_flutter. I can't do this same view on mobile.
On mobile, the view looks like this. My zoom level is 0.
Here is my code in flutter
cameraBounds = CameraTargetBounds(getBounds(bounds));
Here is my map container.
Container(
width: MediaQuery.of(context).size.width-50,
height: 400,
child: GoogleMap(
zoomControlsEnabled: true,
cameraTargetBounds: cameraBounds,
zoomGesturesEnabled: true,
mapToolbarEnabled: true,
gestureRecognizers: Set()..add(Factory<EagerGestureRecognizer>(() => EagerGestureRecognizer())),
mapType: MapType.normal,
tiltGesturesEnabled: true,
scrollGesturesEnabled: true,
indoorViewEnabled: true,
markers: this.myMarker(),
padding: EdgeInsets.all(20),
initialCameraPosition: _kGooglePlex,
minMaxZoomPreference: MinMaxZoomPreference(0,13),
onMapCreated: (GoogleMapController controller) {
mapController = controller;
_controller.complete(controller);
// moveCamera();
},
),
)
Getting the markers bound.
getBounds(List<LatLng> list) {
//assert(list.isNotEmpty);
print('Post size :' +list.length.toString());
double x0, x1, y0, y1;
if(list.isEmpty){
return LatLngBounds(northeast: LatLng(0, 0), southwest: LatLng(0, 0));
}else{
for (LatLng latLng in list) {
if (x0 == null) {
x0 = x1 = latLng.latitude;
y0 = y1 = latLng.longitude;
} else {
if (latLng.latitude > x1) x1 = latLng.latitude;
if (latLng.latitude < x0) x0 = latLng.latitude;
if (latLng.longitude > y1) y1 = latLng.longitude;
if (latLng.longitude < y0) y0 = latLng.longitude;
}
}
return LatLngBounds(northeast: LatLng(x1, y1), southwest: LatLng(x0, y0));
}
}
enter code here
I already tried with an animate camera or move camera but the view always looks like this. How I cover the whole map markers in one camera position. Please help me.

