OverviewViewportState class final

A viewport state that configures the camera to display an overview of a specified geometry.

The OverviewViewportState adjusts the camera to ensure that the given geometry fits within the visible area of the map. This is particularly useful for zooming out to show an entire route, area, or any geometric shape.

You can customize the camera's orientation using bearing and pitch, and control the zoom level with maxZoom. The geometryPadding adds extra space around the geometry so it doesn't touch the edges of the map. Use offset to shift the center of the geometry relative to the map's center. The animationDuration defines the length of the camera transition animation.

Example usage:

final viewportState = OverviewViewportState(
  geometry: myGeometry,
  geometryPadding: EdgeInsets.all(20.0),
  bearing: 30.0,
  pitch: 45.0,
  maxZoom: 15.0,
  offset: Offset(0, -100),
  animationDuration: Duration(milliseconds: 800),
);
Inheritance

Constructors

OverviewViewportState.new({required GeometryObject geometry, EdgeInsets geometryPadding = const EdgeInsets.all(0), double? bearing = 0.0, double? pitch = 0.0, double? maxZoom, Offset? offset, Duration animationDuration = const Duration(seconds: 1)})
Creates an OverviewViewportState that configures the camera to display an overview of the specified geometry.
const

Properties

animationDuration Duration
The duration of the camera transition animation.
final
bearing double?
The bearing of the map in degrees clockwise from true north.
final
geometry GeometryObject
The geometry to display in the overview.
final
geometryPadding EdgeInsets
Extra padding to add around the geometry.
final
hashCode int
The hash code for this object.
no setterinherited
maxZoom double?
The maximum zoom level allowed when fitting the geometry into view.
final
offset Offset?
The offset of the center of the geometry relative to the map's center, measured in points.
final
pitch double?
The pitch of the camera toward the horizon in degrees.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited