onZooming method
Called whenever zooming is happening.
Subclasses can override this method to do any custom operations based on
the details provided in the MapZoomDetails. When
super.onZooming(details)
is not called, zooming will not happen.
MapZoomDetails contains following properties.
- MapZoomDetails.previousVisibleBounds - provides the visible bounds before the current zooming operation completes i.e. current visible bounds.
- MapZoomDetails.newVisibleBounds - provides the new visible bounds
when the current zoom completes. Hence, if the
super.onZooming(details)
is not called, there will be no changes in the UI. - MapZoomDetails.previousZoomLevel - provides the zoom level before the current zooming operation completes i.e. current zoom level.
- MapZoomDetails.newZoomLevel - provides the new zoom level
when the current zoom completes. Hence, if the
super.onZooming(details)
is not called, there will be no changes in the UI. - MapZoomDetails.globalFocalPoint - The global focal point of the pointers in contact with the screen.
- MapZoomDetails.localFocalPoint - The local focal point of the pointers in contact with the screen.
Implementation
void onZooming(MapZoomDetails details) {
if (_controller != null) {
_latLngBounds = details.newVisibleBounds;
if (_controller!.layerType == LayerType.shape) {
_controller!.notifyZoomingListeners(details);
_controller!.notifyListeners();
} else {
_controller!
..isInInteractive = true
..gesture = Gesture.scale;
zoomLevel = details.newZoomLevel!;
focalLatLng = details.focalLatLng;
_controller!.notifyListeners();
}
}
}