Skip to main content

AnyScrollController

Struct AnyScrollController 

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

Erased ScrollControllerLeaf: what a field or parameter Dart types as ScrollController becomes.

Equality is Dart’s == on an object reference.

Implementations§

Source§

impl AnyScrollController

Source

pub fn upgrade(self, app: &App) -> Option<Retained<AnyScrollController>>

A reference while something still keeps the object, None once it is freed or its last keeper has let go; see Handle::upgrade.

Source

pub fn keep(self, app: &App) -> Retained<AnyScrollController>

A reference to an object something is known to keep; see Handle::keep.

Source§

impl AnyScrollController

Source

pub fn identity_hash(self) -> u64

The identity a dump shows, Dart’s describeIdentity(controller) without the description its toString adds: a widget’s properties are filled without an App.

Source

pub fn type_id(self) -> TypeId

Dart’s controller.runtimeType, for the identity checks a Scrollable makes.

Source

pub fn notification_listener(self) -> Listener

Source

pub fn initial_scroll_offset(self, app: &App) -> f64

Source

pub fn keep_scroll_offset(self, app: &App) -> bool

Each time a scroll completes, save the current scroll offset with PageStorage and restore it if this controller’s scrollable is recreated.

If this property is set to false, the scroll offset is never saved and initial_scroll_offset is always used to initialize the scroll offset. If true (the default), the initial scroll offset is used the first time the controller’s scrollable is created, since there’s no scroll offset to restore yet. Subsequently the saved offset is restored and the initial scroll offset is ignored.

Source

pub fn on_attach(self, app: &App) -> Option<ScrollControllerCallback>

Called when a [ScrollPosition] is attached to the scroll controller.

Since a scroll position is not attached until a Scrollable is actually built, this can be used to respond to a new position being attached.

Source

pub fn on_detach(self, app: &App) -> Option<ScrollControllerCallback>

Called when a [ScrollPosition] is detached from the scroll controller.

Source

pub fn debug_label(self, app: &App) -> Option<String>

A label that is used in the to_string output. Intended to aid with identifying scroll controller instances in debug output.

Source

pub fn positions(self, app: &App) -> Vec<AnyScrollPosition>

The currently attached positions.

This should not be mutated directly. [ScrollPosition] objects can be added and removed using attach and detach.

Source

pub fn has_clients(self, app: &App) -> bool

Whether any [ScrollPosition] objects have attached themselves to this controller using the attach method.

If this is false, then members that interact with the [ScrollPosition], such as position, offset, animate_to, and jump_to, must not be called.

Source

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

Returns the attached [ScrollPosition], from which the actual scroll offset of the ScrollView can be obtained.

Calling this is only valid when only a single position is attached.

Source

pub fn offset(self, app: &App) -> f64

The current scroll offset of the scrollable widget.

Requires the controller to be controlling exactly one scrollable widget.

Source

pub fn animate_to( self, app: &mut App, offset: f64, duration: Duration, curve: Rc<dyn Curve>, ) -> CompleterFuture<()> ⓘ

Animates the position from its current value to the given value.

Any active animation is canceled. If the user is currently scrolling, that action is canceled.

An animation will be interrupted whenever the user attempts to scroll manually, or whenever another activity is started, or whenever the animation reaches the edge of the viewport and attempts to overscroll. (If the [ScrollPosition] does not overscroll but instead allows scrolling beyond the extents, then going beyond the extents will not interrupt the animation.)

The animation is indifferent to changes to the viewport or content dimensions.

Once the animation has completed, the scroll position will attempt to begin a ballistic activity in case its value is not stable.

The duration must not be zero. To jump to a particular value without an animation, use jump_to.

The returned future completes once every attached position’s animation has ended.

Source

pub fn jump_to(self, app: &mut App, value: f64)

Jumps the scroll position from its current value to the given value, without animation, and without checking if the new value is in range.

Any active animation is canceled. If the user is currently scrolling, that action is canceled.

If this method changes the scroll position, a sequence of start/update/end scroll notifications will be dispatched. No overscroll notifications can be generated by this method.

Immediately after the jump, a ballistic activity is started, in case the value was out of range.

Source

pub fn attach(self, app: &mut App, position: ScrollPositionRef)

Source

pub fn detach(self, app: &mut App, position: AnyScrollPosition)

Source

pub fn dispose(self, app: &mut App)

Source

pub fn create_scroll_position( self, app: &mut App, physics: ScrollPhysicsRef, context: Rc<dyn ScrollContext>, old_position: Option<AnyScrollPosition>, ) -> ScrollPositionRef

Source

pub fn debug_fill_description(self, app: &App, description: &mut Vec<String>)

Source

pub fn to_string(self, app: &App) -> String

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

Trait Implementations§

Source§

impl Clone for AnyScrollController

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for AnyScrollController

Source§

impl Debug for AnyScrollController

Source§

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

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

impl Eq for AnyScrollController

Source§

impl From<AnyScrollController> for HandleId

Source§

fn from(handle: AnyScrollController) -> HandleId

Converts to this type from the input type.
Source§

impl<Leaf: ScrollControllerLeaf> From<Handle<Leaf>> for AnyScrollController

Source§

fn from(handle: Handle<Leaf>) -> AnyScrollController

Converts to this type from the input type.
Source§

impl Hash for AnyScrollController

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Listenable for AnyScrollController

Source§

fn add_listener(&self, app: &mut App, listener: Listener)

Register a closure to be called when the object notifies its listeners.
Source§

fn remove_listener(&self, app: &mut App, listener: &Listener)

Remove a previously registered closure from the list of closures that the object notifies.
Source§

impl PartialEq for AnyScrollController

Source§

fn eq(&self, other: &AnyScrollController) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialEq<AnyScrollController> for &Retained<AnyScrollController>

Source§

fn eq(&self, other: &AnyScrollController) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialEq<Retained<AnyScrollController>> for AnyScrollController

Source§

fn eq(&self, other: &Retained<AnyScrollController>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl Forget for AnyScrollController

§

impl Freeze for AnyScrollController
where NonZero<u32>: Freeze, &'static ScrollControllerVTable: Freeze,

§

impl Move for AnyScrollController

§

impl RefUnwindSafe for AnyScrollController

§

impl Send for AnyScrollController
where NonZero<u32>: Send, &'static ScrollControllerVTable: Send,

§

impl Sync for AnyScrollController
where NonZero<u32>: Sync,

§

impl Unpin for AnyScrollController
where NonZero<u32>: Unpin, &'static ScrollControllerVTable: Unpin,

§

impl UnsafeUnpin for AnyScrollController
where NonZeroU32Inner: UnsafeUnpin, &'static ScrollControllerVTable: UnsafeUnpin,

§

impl UnwindSafe for AnyScrollController
where NonZero<u32>: UnwindSafe, &'static ScrollControllerVTable: UnwindSafe,

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> AnyEq for T
where T: PartialEq + Hash + Debug + 'static,

Source§

fn eq_any(&self, other: &(dyn AnyEq + 'static)) -> bool

Dart’s operator ==. Must return false when other is a different concrete type, even if the two carry the same value.
Source§

fn hash_any(&self, state: &mut dyn Hasher)

Dart’s hashCode. Must mix in the concrete type so that two types carrying the same value do not collide.
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> SlotValue for T
where T: Clone + Eq + Hash + Debug + 'static,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,