ScrollMetrics mixin Null safety

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:

Mixin Applications

Properties

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

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
A string representation of this object.
inherited

Operators

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