BallisticScrollActivity class

The activity a scroll view performs after being set into motion.

For example, a BallisticScrollActivity is used when the user lifts their finger off the screen after a DragScrollActivity, to continue the scrolling motion starting from the current velocity.

BallisticScrollActivity is also used to restore a scroll view to a valid scroll offset when the geometry of the scroll view changes. In these situations, the Simulation typically starts with a zero velocity.

The scrolling will be driven by the given Simulation. If a BallisticScrollActivity is in progress when the scroll metrics change, then the activity will be replaced with a new ballistic activity starting from the current velocity (see ScrollPhysics.createBallisticSimulation). To ensure the user perceives smooth motion across such a change, the simulation should typically be the result of ScrollPhysics.createBallisticSimulation for the scroll physics of the scroll view.

See also:

  • DrivenScrollActivity, which drives a scroll view through a given animation, without resetting to a ballistic simulation when scroll metrics change.
Inheritance

Constructors

BallisticScrollActivity.new(ScrollActivityDelegate delegate, Simulation simulation, TickerProvider vsync, bool shouldIgnorePointer)
Creates an activity that sets into motion a scroll view.

Properties

delegate ScrollActivityDelegate
The delegate that this activity will use to actuate the scroll view.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isScrolling bool
Whether performing this activity constitutes scrolling.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shouldIgnorePointer bool
Whether the scroll view should ignore pointer events while performing this activity.
final
velocity double
If applicable, the velocity at which the scroll offset is currently independently changing (i.e. without external stimuli such as a dragging gestures) in logical pixels per second for this activity.
no setteroverride

Methods

applyMoveTo(double value) bool
Move the position to the given location.
applyNewDimensions() → void
Called when the scroll view that is performing this activity changes its metrics.
override
dispatchOverscrollNotification(ScrollMetrics metrics, BuildContext context, double overscroll) → void
Dispatch an OverscrollNotification with the given metrics and overscroll.
override
dispatchScrollEndNotification(ScrollMetrics metrics, BuildContext context) → void
Dispatch a ScrollEndNotification with the given metrics and overscroll.
inherited
dispatchScrollStartNotification(ScrollMetrics metrics, BuildContext? context) → void
Dispatch a ScrollStartNotification with the given metrics.
inherited
dispatchScrollUpdateNotification(ScrollMetrics metrics, BuildContext context, double scrollDelta) → void
Dispatch a ScrollUpdateNotification with the given metrics and scroll delta.
inherited
dispose() → void
Called when the scroll view stops performing this activity.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resetActivity() → void
Called by the ScrollActivityDelegate when it has changed type (for example, when changing from an Android-style scroll position to an iOS-style scroll position). If this activity can differ between the two modes, then it should tell the position to restart that activity appropriately.
override
toString() String
A string representation of this object.
override
updateDelegate(ScrollActivityDelegate value) → void
Updates the activity's link to the ScrollActivityDelegate.
inherited

Operators

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