ScrollMetrics class

A description of a Scrollable's contents, useful for modeling the state of its viewport.

This class defines a current position, pixels, and a range of values considered "in bounds" for that position. The range has a minimum value at minScrollExtent and a maximum value at maxScrollExtent (inclusive). The viewport scrolls in the direction and axis described by axisDirection and axis.

The outOfRange getter will return true if pixels is outside this defined range. The atEdge getter will return true if the pixels position equals either the minScrollExtent or the maxScrollExtent.

The dimensions of the viewport in the given axis are described by viewportDimension.

The above values are also exposed in terms of extentBefore, extentInside, and extentAfter, which may be more useful for use cases such as scroll bars; for example, see Scrollbar.

See also:

Implementers

Constructors

ScrollMetrics()

Properties

atEdge bool
Whether the pixels value is exactly at the minScrollExtent or the maxScrollExtent.
read-only
axis Axis
The axis in which the scroll view scrolls.
read-only
axisDirection AxisDirection
The direction in which the scroll view scrolls.
read-only
extentAfter double
The quantity of content conceptually "below" the currently visible content of the viewport in the scrollable. This is the content below the content described by extentInside.
read-only
extentBefore double
The quantity of content conceptually "above" the currently visible content of the viewport in the scrollable. This is the content above the content described by extentInside.
read-only
extentInside double
The quantity of visible content. [...]
read-only
maxScrollExtent double
The maximum in-range value for pixels. [...]
read-only
minScrollExtent double
The minimum in-range value for pixels. [...]
read-only
outOfRange bool
Whether the pixels value is outside the minScrollExtent and maxScrollExtent.
read-only
pixels double
The current scroll position, in logical pixels along the axisDirection.
read-only
viewportDimension double
The extent of the viewport along the axisDirection.
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

copyWith({double minScrollExtent, double maxScrollExtent, double pixels, double viewportDimension, AxisDirection axisDirection }) ScrollMetrics
Creates a ScrollMetrics that has the same properties as this object. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited