Skip to main content

DrivenScrollActivity

Struct DrivenScrollActivity 

Source
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:

Implementations§

Source§

impl DrivenScrollActivity

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn scroll_activity_data(self: Handle<Self>, app: &App) -> &ScrollActivityData

Dart’s ScrollActivity fields, held under the field scroll_activity (scroll_activity_accessors!).
Source§

fn scroll_activity_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut ScrollActivityData

Source§

fn dispatch_overscroll_notification( self: Handle<Self>, app: &mut App, metrics: Rc<dyn ScrollMetrics>, context: BuildContext, overscroll: f64, )

Dispatch an OverscrollNotification with the given metrics and overscroll.
Source§

fn should_ignore_pointer(self: Handle<Self>, _app: &App) -> bool

Whether the scroll view should ignore pointer events while performing this activity. Read more
Source§

fn is_scrolling(self: Handle<Self>, _app: &App) -> bool

Whether performing this activity constitutes scrolling. Read more
Source§

fn velocity(self: Handle<Self>, app: &mut App) -> f64

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.
Source§

fn dispose(self: Handle<Self>, app: &mut App)

Called when the scroll view stops performing this activity.
Source§

fn describe(self: Handle<Self>, app: &App) -> String

Dart’s toString, which reads the arena and so cannot be std::fmt::Debug.
Source§

fn delegate(self: Handle<Self>, app: &App) -> AnyScrollActivityDelegate

The delegate that this activity will use to actuate the scroll view.
Source§

fn is_disposed(self: Handle<Self>, app: &App) -> bool

Whether dispose has run; Dart’s _isDisposed.
Source§

fn update_delegate( self: Handle<Self>, app: &mut App, value: AnyScrollActivityDelegate, )

Updates the activity’s link to the ScrollActivityDelegate. Read more
Source§

fn reset_activity(self: Handle<Self>, app: &mut App)

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. Read more
Source§

fn dispatch_scroll_start_notification( self: Handle<Self>, app: &mut App, metrics: Rc<dyn ScrollMetrics>, context: Option<BuildContext>, )

Dispatch a 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, )

Dispatch a 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, )

Dispatch a ScrollEndNotification with the given metrics and overscroll.
Source§

fn apply_new_dimensions(self: Handle<Self>, app: &mut App)

Called when the scroll view that is performing this activity changes its metrics.
Source§

fn as_hold_controller( self: Handle<Self>, ) -> Option<Rc<dyn ScrollHoldController>>

Dart’s activity is ScrollHoldController; None — the default — for every activity but HoldScrollActivity.
Source§

fn as_activity(self: Handle<Self>) -> AnyScrollActivity

This activity as the erased AnyScrollActivity — what to pass where a Dart API takes a ScrollActivity.

Auto Trait Implementations§

§

impl !RefUnwindSafe for DrivenScrollActivity

§

impl !Send for DrivenScrollActivity

§

impl !Sync for DrivenScrollActivity

§

impl !UnwindSafe for DrivenScrollActivity

§

impl Forget for DrivenScrollActivity

§

impl Freeze for DrivenScrollActivity
where NonZero<u32>: Freeze, &'static ScrollActivityDelegateVTable: Freeze, *const RcInner<Shared<()>> is !null: Freeze, PhantomData<RcInner<Shared<()>>>: Freeze, PhantomData<fn() -> AnimationController>: Freeze, *const RcInner<Keep> is !null: Freeze, PhantomData<RcInner<Keep>>: Freeze,

§

impl Move for DrivenScrollActivity

§

impl Unpin for DrivenScrollActivity
where NonZero<u32>: Unpin, &'static ScrollActivityDelegateVTable: Unpin, Rc<Shared<()>>: Unpin, Rc<Keep>: Unpin,

§

impl UnsafeUnpin for DrivenScrollActivity
where NonZeroU32Inner: UnsafeUnpin, &'static ScrollActivityDelegateVTable: UnsafeUnpin, *const RcInner<Shared<()>> is !null: UnsafeUnpin, PhantomData<RcInner<Shared<()>>>: UnsafeUnpin, PhantomData<fn() -> AnimationController>: UnsafeUnpin, *const RcInner<Keep> is !null: UnsafeUnpin, PhantomData<RcInner<Keep>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>