fitBounds method

  1. @override
  2. @Deprecated('Prefer `fitCamera` with a CameraFit.bounds() or CameraFit.insideBounds() instead. ' 'This method has been changed to use the new `CameraFit` classes which allows different kinds of fit. ' 'This method is deprecated since v6.')
bool fitBounds(
  1. LatLngBounds bounds, {
  2. FitBoundsOptions options = const FitBoundsOptions(padding: EdgeInsets.all(12)),
})
override

Move and zoom the map to perfectly fit bounds, with additional configurable options

For information about return value meaning and emitted events, see move's documentation.

Implementation

@override
@Deprecated(
  'Prefer `fitCamera` with a CameraFit.bounds() or CameraFit.insideBounds() instead. '
  'This method has been changed to use the new `CameraFit` classes which allows different kinds of fit. '
  'This method is deprecated since v6.',
)
bool fitBounds(
  LatLngBounds bounds, {
  FitBoundsOptions options =
      const FitBoundsOptions(padding: EdgeInsets.all(12)),
}) =>
    fitCamera(
      options.inside
          ? CameraFit.insideBounds(
              bounds: bounds,
              padding: options.padding,
              maxZoom: options.maxZoom,
              forceIntegerZoomLevel: options.forceIntegerZoomLevel,
            )
          : CameraFit.bounds(
              bounds: bounds,
              padding: options.padding,
              maxZoom: options.maxZoom,
              forceIntegerZoomLevel: options.forceIntegerZoomLevel,
            ),
    );