pub struct DrivenScrollActivity { /* private fields */ }Expand description
An activity that drives a scroll view through a given animation.
For example, a DrivenScrollActivity is used to implement
ScrollController::animate_to.
The scrolling will be driven by the given animation parameters
or the given Simulation.
Unlike a BallisticScrollActivity, if a DrivenScrollActivity is
in progress when the scroll metrics change, the activity will continue
with its original animation.
See also:
BallisticScrollActivity, which sets into motion a scroll view.
Implementations§
Source§impl DrivenScrollActivity
impl DrivenScrollActivity
Sourcepub fn new(
app: &mut App,
delegate: AnyScrollActivityDelegate,
from: f64,
to: f64,
duration: Duration,
curve: Rc<dyn Curve>,
vsync: impl TickerProvider,
) -> Ref<DrivenScrollActivity>
pub fn new( app: &mut App, delegate: AnyScrollActivityDelegate, from: f64, to: f64, duration: Duration, curve: Rc<dyn Curve>, vsync: impl TickerProvider, ) -> Ref<DrivenScrollActivity>
Creates an activity that drives a scroll view through an animation given by animation parameters.
Sourcepub fn simulation(
app: &mut App,
delegate: AnyScrollActivityDelegate,
simulation: Box<dyn Simulation>,
vsync: impl TickerProvider,
) -> Ref<DrivenScrollActivity>
pub fn simulation( app: &mut App, delegate: AnyScrollActivityDelegate, simulation: Box<dyn Simulation>, vsync: impl TickerProvider, ) -> Ref<DrivenScrollActivity>
Creates an activity that drives a scroll view through an animation
given by a Simulation.
Sourcepub fn done(self: Handle<Self>, app: &App) -> CompleterFuture<()> ⓘ
pub fn done(self: Handle<Self>, app: &App) -> CompleterFuture<()> ⓘ
A future that completes when the activity stops.
For example, this future will complete if the animation reaches the end or if the user interacts with the scroll view in way that causes the animation to stop before it reaches the end.
Sourcepub fn apply_move_to(self: Handle<Self>, app: &mut App, value: f64) -> bool
pub fn apply_move_to(self: Handle<Self>, app: &mut App, value: f64) -> bool
Move the position to the given location.
If the new position was fully applied, returns true. If there was any overflow, returns false.
The default implementation calls ScrollActivityDelegate::set_pixels
and returns true if the overflow was zero.
Trait Implementations§
Source§impl ScrollActivity for DrivenScrollActivity
impl ScrollActivity for DrivenScrollActivity
Source§fn scroll_activity_data(self: Handle<Self>, app: &App) -> &ScrollActivityData
fn scroll_activity_data(self: Handle<Self>, app: &App) -> &ScrollActivityData
Source§fn scroll_activity_data_mut(
self: Handle<Self>,
app: &mut App,
) -> &mut ScrollActivityData
fn scroll_activity_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut ScrollActivityData
scroll_activity_data.Source§fn dispatch_overscroll_notification(
self: Handle<Self>,
app: &mut App,
metrics: Rc<dyn ScrollMetrics>,
context: BuildContext,
overscroll: f64,
)
fn dispatch_overscroll_notification( self: Handle<Self>, app: &mut App, metrics: Rc<dyn ScrollMetrics>, context: BuildContext, overscroll: f64, )
OverscrollNotification with the given metrics and overscroll.Source§fn should_ignore_pointer(self: Handle<Self>, _app: &App) -> bool
fn should_ignore_pointer(self: Handle<Self>, _app: &App) -> bool
Source§fn is_scrolling(self: Handle<Self>, _app: &App) -> bool
fn is_scrolling(self: Handle<Self>, _app: &App) -> bool
Source§fn velocity(self: Handle<Self>, app: &mut App) -> f64
fn velocity(self: Handle<Self>, app: &mut App) -> f64
Source§fn dispose(self: Handle<Self>, app: &mut App)
fn dispose(self: Handle<Self>, app: &mut App)
Source§fn describe(self: Handle<Self>, app: &App) -> String
fn describe(self: Handle<Self>, app: &App) -> String
toString, which reads the arena and so cannot be std::fmt::Debug.Source§fn delegate(self: Handle<Self>, app: &App) -> AnyScrollActivityDelegate
fn delegate(self: Handle<Self>, app: &App) -> AnyScrollActivityDelegate
Source§fn is_disposed(self: Handle<Self>, app: &App) -> bool
fn is_disposed(self: Handle<Self>, app: &App) -> bool
dispose has run; Dart’s _isDisposed.Source§fn update_delegate(
self: Handle<Self>,
app: &mut App,
value: AnyScrollActivityDelegate,
)
fn update_delegate( self: Handle<Self>, app: &mut App, value: AnyScrollActivityDelegate, )
ScrollActivityDelegate. Read moreSource§fn reset_activity(self: Handle<Self>, app: &mut App)
fn reset_activity(self: Handle<Self>, app: &mut App)
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. Read moreSource§fn dispatch_scroll_start_notification(
self: Handle<Self>,
app: &mut App,
metrics: Rc<dyn ScrollMetrics>,
context: Option<BuildContext>,
)
fn dispatch_scroll_start_notification( self: Handle<Self>, app: &mut App, metrics: Rc<dyn ScrollMetrics>, context: Option<BuildContext>, )
ScrollStartNotification with the given metrics.Source§fn dispatch_scroll_update_notification(
self: Handle<Self>,
app: &mut App,
metrics: Rc<dyn ScrollMetrics>,
context: BuildContext,
scroll_delta: f64,
)
fn dispatch_scroll_update_notification( self: Handle<Self>, app: &mut App, metrics: Rc<dyn ScrollMetrics>, context: BuildContext, scroll_delta: f64, )
ScrollUpdateNotification with the given metrics and scroll delta.Source§fn dispatch_scroll_end_notification(
self: Handle<Self>,
app: &mut App,
metrics: Rc<dyn ScrollMetrics>,
context: BuildContext,
)
fn dispatch_scroll_end_notification( self: Handle<Self>, app: &mut App, metrics: Rc<dyn ScrollMetrics>, context: BuildContext, )
ScrollEndNotification with the given metrics and overscroll.Source§fn apply_new_dimensions(self: Handle<Self>, app: &mut App)
fn apply_new_dimensions(self: Handle<Self>, app: &mut App)
Source§fn as_hold_controller(
self: Handle<Self>,
) -> Option<Rc<dyn ScrollHoldController>>
fn as_hold_controller( self: Handle<Self>, ) -> Option<Rc<dyn ScrollHoldController>>
activity is ScrollHoldController; None — the default — for every activity
but HoldScrollActivity.Source§fn as_activity(self: Handle<Self>) -> AnyScrollActivity
fn as_activity(self: Handle<Self>) -> AnyScrollActivity
AnyScrollActivity — what to pass where a Dart API takes
a ScrollActivity.