ScrollDragController class Null safety

Scrolls a scroll view as the user drags their finger across the screen.

See also:

  • DragScrollActivity, which is the activity the scroll view performs while a drag is underway.
Implemented types

Constructors

ScrollDragController({required ScrollActivityDelegate delegate, required DragStartDetails details, VoidCallback? onDragCanceled, double? carriedVelocity, double? motionStartDistanceThreshold})
Creates an object that scrolls a scroll view as the user drags their finger across the screen.

Properties

carriedVelocity double?
Velocity that was present from a previous ScrollActivity when this drag began.
final
delegate ScrollActivityDelegate
The object that will actuate the scroll view as the user drags.
read-only
hashCode int
The hash code for this object.
read-onlyinherited
lastDetails → dynamic
The most recently observed DragStartDetails, DragUpdateDetails, or DragEndDetails object.
read-only
motionStartDistanceThreshold double?
Amount of pixels in either direction the drag has to move by to start scroll movement again after each time scrolling came to a stop.
final
onDragCanceled VoidCallback?
Called when dispose is called.
final
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

cancel() → void
The input from the pointer is no longer directed towards this receiver.
override
dispose() → void
Called by the delegate when it is no longer sending events to this object.
mustCallSuper">@mustCallSuper
end(DragEndDetails details) → void
The pointer is no longer in contact with the screen.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
override
update(DragUpdateDetails details) → void
The pointer has moved.
override
updateDelegate(ScrollActivityDelegate value) → void
Updates the controller's link to the ScrollActivityDelegate.

Operators

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

Constants

momentumRetainStationaryDurationThreshold → const Duration
Maximum amount of time interval the drag can have consecutive stationary pointer update events before losing the momentum carried from a previous scroll activity.
Duration(milliseconds: 20)
momentumRetainVelocityThresholdFactor → const double
The minimum amount of velocity needed to apply the carriedVelocity at the end of a drag. Expressed as a factor. For example with a carriedVelocity of 2000, we will need a velocity of at least 1000 to apply the carriedVelocity as well. If the velocity does not meet the threshold, the carriedVelocity is lost. Decided by fair eyeballing with the scroll_overlay platform test.
0.5
motionStoppedDurationThreshold → const Duration
Maximum amount of time interval the drag can have consecutive stationary pointer update events before needing to break the motionStartDistanceThreshold to start motion again.
Duration(milliseconds: 50)