pub struct ScrollDragController {
pub on_drag_canceled: Option<Listener>,
pub carried_velocity: Option<f64>,
pub motion_start_distance_threshold: Option<f64>,
/* private fields */
}Expand description
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.
Fields§
§on_drag_canceled: Option<Listener>Called when dispose is called.
carried_velocity: Option<f64>Velocity that was present from a previous ScrollActivity when this drag
began.
motion_start_distance_threshold: Option<f64>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.
Implementations§
Source§impl ScrollDragController
impl ScrollDragController
Sourcepub const MOMENTUM_RETAIN_STATIONARY_DURATION_THRESHOLD: Duration
pub const MOMENTUM_RETAIN_STATIONARY_DURATION_THRESHOLD: 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.
Sourcepub const MOMENTUM_RETAIN_VELOCITY_THRESHOLD_FACTOR: f64 = 0.5
pub const MOMENTUM_RETAIN_VELOCITY_THRESHOLD_FACTOR: f64 = 0.5
The minimum amount of velocity needed to apply the
carried_velocity at the end of a drag. Expressed as a
factor. For example with a carried_velocity of 2000, we
will need a velocity of at least 1000 to apply the
carried_velocity as well. If the velocity does not meet
the threshold, the carried_velocity is lost. Decided by
fair eyeballing with the scroll_overlay platform test.
Sourcepub const MOTION_STOPPED_DURATION_THRESHOLD: Duration
pub const MOTION_STOPPED_DURATION_THRESHOLD: Duration
Maximum amount of time interval the drag can have consecutive stationary
pointer update events before needing to break the
motion_start_distance_threshold to start
motion again.
Sourcepub fn new(
app: &mut App,
delegate: AnyScrollActivityDelegate,
details: DragStartDetails,
on_drag_canceled: Option<Listener>,
carried_velocity: Option<f64>,
motion_start_distance_threshold: Option<f64>,
) -> Ref<ScrollDragController>
pub fn new( app: &mut App, delegate: AnyScrollActivityDelegate, details: DragStartDetails, on_drag_canceled: Option<Listener>, carried_velocity: Option<f64>, motion_start_distance_threshold: Option<f64>, ) -> Ref<ScrollDragController>
Creates an object that scrolls a scroll view as the user drags their finger across the screen.
Sourcepub fn delegate(self: Handle<Self>, app: &App) -> AnyScrollActivityDelegate
pub fn delegate(self: Handle<Self>, app: &App) -> AnyScrollActivityDelegate
The object that will actuate the scroll view as the user drags.
Sourcepub fn kind(self: Handle<Self>, app: &App) -> Option<PointerDeviceKind>
pub fn kind(self: Handle<Self>, app: &App) -> Option<PointerDeviceKind>
The type of input device driving the drag; Dart’s _kind.
Sourcepub fn last_details(self: Handle<Self>, app: &App) -> Option<&LastDragDetails>
pub fn last_details(self: Handle<Self>, app: &App) -> Option<&LastDragDetails>
The most recently observed DragStartDetails, DragUpdateDetails, or
DragEndDetails object.
Sourcepub fn update_delegate(
self: Handle<Self>,
app: &mut App,
value: AnyScrollActivityDelegate,
)
pub fn update_delegate( self: Handle<Self>, app: &mut App, value: AnyScrollActivityDelegate, )
Updates the controller’s link to the ScrollActivityDelegate.
This should only be called when a controller is being moved from a defunct
(or about-to-be defunct) ScrollActivityDelegate object to a new one.
Sourcepub fn dispose(self: Handle<Self>, app: &mut App)
pub fn dispose(self: Handle<Self>, app: &mut App)
Called by the delegate when it is no longer sending events to this object.
Sourcepub fn describe(self: Handle<Self>) -> String
pub fn describe(self: Handle<Self>) -> String
Dart’s toString, which reads the arena and so cannot be std::fmt::Debug.
Trait Implementations§
Source§impl DragObject for ScrollDragController
impl DragObject for ScrollDragController
Source§fn update(self: Handle<Self>, app: &mut App, details: DragUpdateDetails)
fn update(self: Handle<Self>, app: &mut App, details: DragUpdateDetails)
Drag::update.