ScrollDirection enum

The direction of a scroll, relative to the positive scroll offset axis given by an AxisDirection and a GrowthDirection.

This is similar to GrowthDirection, but contrasts in that it has a third value, idle, for the case where no scroll is occurring.

This is used by RenderSliverFloatingPersistentHeader to only expand when the user is scrolling in the same direction as the detected scroll offset change.

This sample shows a CustomScrollView, with Radio buttons in the AppBar.bottom that change the AxisDirection to illustrate different configurations. With a NotificationListener to listen to UserScrollNotifications, which occur when the ScrollDirection changes or stops.
link

To create a local project with this code sample, run:
flutter create --sample=rendering.ScrollDirection.1 mysample

See also:

Inheritance
Available extensions

Values

idle → const ScrollDirection

No scrolling is underway.

forward → const ScrollDirection

Scrolling is happening in the negative scroll offset direction.

For example, for the GrowthDirection.forward part of a vertical AxisDirection.down list, which is the default directional configuration of all scroll views, this means the content is going down, exposing earlier content as it approaches the zero position.

An anecdote for this most common case is 'forward is toward' the zero position.

reverse → const ScrollDirection

Scrolling is happening in the positive scroll offset direction.

For example, for the GrowthDirection.forward part of a vertical AxisDirection.down list, which is the default directional configuration of all scroll views, this means the content is moving up, exposing lower content.

An anecdote for this most common case is reversing, or backing away, from the zero position.

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
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

Constants

values → const List<ScrollDirection>
A constant List of the values in this enum, in order of their declaration.