Skip to main content

ScrollableState

Struct ScrollableState 

Source
pub struct ScrollableState { /* private fields */ }
Expand description

State object for a Scrollable widget.

To manipulate a Scrollable widget’s scroll position, use the object obtained from the position property.

To be informed of when a Scrollable widget is scrolling, use a NotificationListener to listen for crate::ScrollNotification notifications.

Implementations§

Source§

impl ScrollableState

Source

pub fn position(self: Handle<Self>, app: &App) -> AnyScrollPosition

The manager for this Scrollable widget’s viewport position.

To control what kind of ScrollPosition is created for a Scrollable, provide it with a custom ScrollController that creates the appropriate ScrollPosition in its create_scroll_position method.

Source

pub fn resolved_physics( self: Handle<Self>, app: &App, ) -> Option<ScrollPhysicsRef>

The resolved ScrollPhysics of the ScrollableState.

Source

pub fn delta_to_scroll_origin(self: Handle<Self>, app: &App) -> Offset

An Offset that represents the absolute distance from the origin, or 0, of the ScrollPosition expressed in the associated Axis.

Used by an auto scroller to progress the position forward when a drag gesture reaches the edge of the viewport.

Source

pub fn kept_position(self: Handle<Self>, app: &App) -> ScrollPositionRef

The position as a reference, for a caller that keeps it: a field Dart types as the ScrollPosition it reads from a ScrollableState.

Trait Implementations§

Source§

impl Debug for ScrollableState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl RestorationMixin for ScrollableState

Source§

fn restoration_mixin_data( self: Handle<Self>, app: &App, ) -> &RestorationMixinData

Dart’s RestorationMixin fields, held under the field restoration (restoration_mixin_accessors!).
Source§

fn restoration_mixin_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut RestorationMixinData

Source§

fn restoration_id(self: Handle<Self>, app: &App) -> Option<&str>

The restoration ID used for the RestorationBucket in which the mixin will store the restoration data of all registered properties. Read more
Source§

fn restore_state( self: Handle<Self>, app: &mut App, _old_bucket: Option<Handle<RestorationBucket>>, initial_restore: bool, )

Called to initialize or restore the RestorablePropertys used by the State object. Read more
Source§

fn bucket(self: Handle<Self>, app: &App) -> Option<Handle<RestorationBucket>>

The RestorationBucket used for the restoration data of the RestorablePropertys registered to this mixin. Read more
Source§

fn did_toggle_bucket( self: Handle<Self>, app: &mut App, old_bucket: Option<Handle<RestorationBucket>>, )

Called when bucket switches between None and non-None values. Read more
Source§

fn register_for_restoration( self: Handle<Self>, app: &mut App, property: AnyRestorableProperty, restoration_id: &str, )

Registers a RestorableProperty for state restoration. Read more
Source§

fn unregister_from_restoration( self: Handle<Self>, app: &mut App, property: AnyRestorableProperty, )

Unregisters a RestorableProperty from state restoration. Read more
Source§

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

Must be called when the value returned by restoration_id changes. Read more
Source§

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

Whether restore_state will be called at the beginning of the next build phase. Read more
Source§

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

Dart’s RestorationMixin.didChangeDependencies, called by the State from its own State::did_change_dependencies.
Source§

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

Dart’s RestorationMixin.dispose, called by the State from its own State::dispose.
Source§

fn as_restoration_mixin(self: Handle<Self>) -> AnyRestorationMixin

This state as the erased AnyRestorationMixin — what a RestorableProperty keeps as its owner.
Source§

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

Dart’s _debugDoingRestore.
Source§

fn do_restore( self: Handle<Self>, app: &mut App, old_bucket: Option<Handle<RestorationBucket>>, )

Dart’s _doRestore.
Source§

fn update_bucket_if_necessary( self: Handle<Self>, app: &mut App, parent: Option<Handle<RestorationBucket>>, restore_pending: bool, ) -> bool

Dart’s _updateBucketIfNecessary. Returns true if bucket has been replaced with a new bucket; it is the responsibility of the caller to dispose the old bucket when this returns true.
Source§

fn set_new_bucket_if_necessary( self: Handle<Self>, app: &mut App, new_bucket: Option<Ref<RestorationBucket>>, restore_pending: bool, ) -> bool

Dart’s _setNewBucketIfNecessary. Returns true if bucket has been replaced with a new bucket; it is the responsibility of the caller to dispose the old bucket when this returns true.
Source§

fn update_property( self: Handle<Self>, app: &mut App, property: AnyRestorableProperty, )

Dart’s _updateProperty.
Source§

fn unregister( self: Handle<Self>, app: &mut App, property: AnyRestorableProperty, )

Dart’s RestorationMixin._unregister.
Source§

impl State for ScrollableState

Source§

type Widget = Scrollable

The widget this state belongs to; Dart’s State<T> type argument.
Source§

fn state_data(self: Handle<Self>, app: &App) -> &StateData<Self::Widget>

The framework’s bookkeeping, held under the field state (state_accessors!).
Source§

fn state_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut StateData<Self::Widget>

Source§

fn debug_fill_properties( self: Handle<Self>, app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s debugFillProperties: the properties this state shows where its element’s dump names it (state: ScrollableState#1a2b3(offset: 0.0)), after the lifecycle and mounting properties State’s base adds, which the framework adds first.
Source§

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

Called when this object is inserted into the tree. Read more
Source§

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

Called when a dependency of this State object changes. Read more
Source§

fn did_update_widget(self: Handle<Self>, app: &mut App, old_widget: &Scrollable)

Called whenever the widget configuration changes. Read more
Source§

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

Called when this object is removed from the tree permanently. Read more
Source§

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

Called when this object is reinserted into the tree after having been removed via deactivate. Read more
Source§

fn build(self: Handle<Self>, app: &mut App, context: BuildContext) -> WidgetRef

Describes the part of the user interface represented by this widget. Read more
Source§

fn widget(self: Handle<Self>, app: &App) -> &Self::Widget

The current configuration. Read more
Source§

fn context(self: Handle<Self>, app: &App) -> BuildContext

The location in the tree where this widget builds. Read more
Source§

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

Whether this State object is currently in a tree. Read more
Source§

fn set_state(self: Handle<Self>, app: &mut App, f: impl FnOnce(&mut Self))

Notify the framework that the internal state of this object has changed. Read more
Source§

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

Called when this object is removed from the tree. Read more
Source§

impl TickerProviderObject for ScrollableState

Source§

impl TickerProviderStateMixin for ScrollableState

Source§

fn ticker_provider_data( self: Handle<Self>, app: &App, ) -> &TickerProviderStateMixinData

Mixin field access.
Source§

fn ticker_provider_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut TickerProviderStateMixinData

Source§

fn debug_fill_properties( self: Handle<Self>, app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s TickerProviderStateMixin.debugFillProperties, which a state’s own body calls where Dart’s mixin adds its line.
Source§

fn create_ticker( self: Handle<Self>, app: &mut App, on_tick: TickerCallback, ) -> Ref<Ticker>

TickerProvider::create_ticker: creates a ticker with the given callback.
Source§

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

The mixin’s part of State::activate; the state calls it where Dart’s super.activate() would reach the mixin. A GlobalKey that moves the element to another view deactivates and activates it, so this is where the tickers follow it.
Source§

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

The mixin’s part of State::dispose; the state calls it where Dart’s super.dispose() would reach the mixin. Every vended ticker must already be disposed (by disposing its AnimationController).

Auto Trait Implementations§

§

impl !RefUnwindSafe for ScrollableState

§

impl !Send for ScrollableState

§

impl !Sync for ScrollableState

§

impl !UnwindSafe for ScrollableState

§

impl Forget for ScrollableState

§

impl Freeze for ScrollableState

§

impl Move for ScrollableState

§

impl Unpin for ScrollableState
where Rc<dyn Widget>: Unpin, NonZero<u32>: Unpin, *const u8 is !null: Unpin, Rc<Keep>: Unpin, Rc<dyn ValueListenable<TickerModeData>>: Unpin, &'static RestorablePropertyVTable: Unpin, Rc<dyn Fn(&mut App)>: Unpin, *const (): Unpin, &'static ScrollPositionVTable: Unpin, Rc<dyn ScrollPhysics>: Unpin, Rc<dyn ScrollBehavior>: Unpin, Rc<dyn Key>: Unpin, Rc<dyn AnyGestureRecognizerFactory>: Unpin, Rc<dyn Drag>: Unpin, Rc<dyn ScrollHoldController>: Unpin, Rc<dyn ScrollContext>: Unpin,

§

impl UnsafeUnpin for ScrollableState
where *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, PhantomData<fn() -> StatefulElement>: UnsafeUnpin, PhantomData<fn() -> Scrollable>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<(Retained<Handle<Ticker>>, ())>: UnsafeUnpin, *const RcInner<dyn ValueListenable<TickerModeData>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn ValueListenable<TickerModeData>>>: UnsafeUnpin, PhantomData<fn() -> RestorationBucket>: UnsafeUnpin, *const RcInner<Keep> is !null: UnsafeUnpin, PhantomData<RcInner<Keep>>: UnsafeUnpin, PhantomData<usize>: UnsafeUnpin, PhantomData<Bucket<Retained<AnyRestorableProperty>, Listener>>: UnsafeUnpin, PhantomData<Retained<AnyRestorableProperty>>: UnsafeUnpin, &'static ScrollPositionVTable: UnsafeUnpin, *const RcInner<dyn ScrollPhysics> is !null: UnsafeUnpin, PhantomData<RcInner<dyn ScrollPhysics>>: UnsafeUnpin, PhantomData<fn() -> RestorableScrollOffset>: UnsafeUnpin, *const RcInner<dyn ScrollBehavior> is !null: UnsafeUnpin, PhantomData<RcInner<dyn ScrollBehavior>>: UnsafeUnpin, PhantomData<fn() -> ScrollController>: UnsafeUnpin, *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, PhantomData<(TypeId, Rc<dyn AnyGestureRecognizerFactory>)>: UnsafeUnpin, *const RcInner<dyn Drag> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Drag>>: UnsafeUnpin, *const RcInner<dyn ScrollHoldController> is !null: UnsafeUnpin, PhantomData<RcInner<dyn ScrollHoldController>>: UnsafeUnpin, *const RcInner<dyn ScrollContext> is !null: UnsafeUnpin, PhantomData<RcInner<dyn ScrollContext>>: 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>