Skip to main content

TrackingScrollController

Struct TrackingScrollController 

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

A ScrollController whose initial_scroll_offset tracks its most recently updated [ScrollPosition].

This type can be used to synchronize the scroll offset of two or more lazily created scroll views that share a single TrackingScrollController. It tracks the most recently updated scroll position and reports it as its initial scroll offset.

Implementations§

Source§

impl TrackingScrollController

Source

pub fn new( app: &mut App, initial_scroll_offset: f64, keep_scroll_offset: bool, debug_label: Option<String>, on_attach: Option<ScrollControllerCallback>, on_detach: Option<ScrollControllerCallback>, ) -> Ref<TrackingScrollController>

Creates a scroll controller that continually updates its initial_scroll_offset to match the last scroll notification it received.

Source

pub fn default(app: &mut App) -> Ref<TrackingScrollController>

A tracking controller with all of Dart’s defaults.

Source

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

The last [ScrollPosition] to change. Returns None if there aren’t any attached scroll positions, or there hasn’t been any scrolling yet, or the last position to change has since been removed.

Trait Implementations§

Source§

impl ChangeNotifier for TrackingScrollController

Source§

fn change_notifier_data(&self) -> &ChangeNotifierData

Source§

fn change_notifier_data_mut(&mut self) -> &mut ChangeNotifierData

Source§

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

Runs before the listener is stored. Dart overrides of addListener that work before super.addListener go here.
Source§

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

Runs after the listener is removed. Dart overrides of removeListener that work after super.removeListener go here.
Source§

impl ScrollControllerLeaf for TrackingScrollController

Source§

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

Returns the scroll offset of the most_recently_updated_position or, if that is None, the initial scroll offset provided to the constructor.

Source§

fn scroll_controller_data( self: Handle<Self>, app: &App, ) -> &ScrollControllerData

Dart’s ScrollController fields, held under the field scroll_controller (scroll_controller_accessors!).
Source§

fn scroll_controller_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut ScrollControllerData

Source§

fn attach(self: Handle<Self>, app: &mut App, position: ScrollPositionRef)

Register the given position with this controller. Read more
Source§

fn detach(self: Handle<Self>, app: &mut App, position: AnyScrollPosition)

Unregister the given position with this controller. Read more
Source§

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

Discards any resources used by the object.
Source§

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

Creates a [ScrollPosition] for use by a Scrollable widget. Read more
Source§

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

Add additional information to the given description for use by to_string. Read more
Source§

fn notification_listener(self: Handle<Self>) -> Listener

Dart’s notifyListeners tear-off: the listener this controller keeps on each attached position.
Source§

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

The body behind notification_listener.
Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn jump_to(self: Handle<Self>, app: &mut App, value: f64)

Source§

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

Source§

fn as_controller(self: Handle<Self>) -> AnyScrollController

This controller as the erased AnyScrollController — what to pass where a Dart API takes a ScrollController.

Auto Trait Implementations§

§

impl !RefUnwindSafe for TrackingScrollController

§

impl !Send for TrackingScrollController

§

impl !Sync for TrackingScrollController

§

impl !UnwindSafe for TrackingScrollController

§

impl Forget for TrackingScrollController

§

impl Freeze for TrackingScrollController
where *const u8 is !null: Freeze, PhantomData<Option<Listener>>: Freeze, *const RcInner<Cell<usize>> is !null: Freeze, PhantomData<RcInner<Cell<usize>>>: Freeze, *const RcInner<dyn Fn(&mut App, AnyScrollPosition)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, AnyScrollPosition)>>: Freeze, PhantomData<u8>: Freeze, PhantomData<Retained<AnyScrollPosition>>: Freeze, PhantomData<usize>: Freeze, PhantomData<Bucket<Retained<AnyScrollPosition>, Listener>>: Freeze, NonZero<u32>: Freeze, &'static ScrollPositionVTable: Freeze, *const RcInner<Keep> is !null: Freeze, PhantomData<RcInner<Keep>>: Freeze,

§

impl Move for TrackingScrollController

§

impl Unpin for TrackingScrollController
where *const u8 is !null: Unpin, Rc<dyn Fn(&mut App)>: Unpin, NonZero<u32>: Unpin, *const (): Unpin, Rc<Cell<usize>>: Unpin, Rc<dyn Fn(&mut App, AnyScrollPosition)>: Unpin, &'static ScrollPositionVTable: Unpin, Rc<Keep>: Unpin,

§

impl UnsafeUnpin for TrackingScrollController

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> ListenableObject for T
where T: ChangeNotifier,

Source§

fn add_listener(self: Handle<T>, app: &mut App, listener: Listener)

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

fn remove_listener(self: Handle<T>, app: &mut App, listener: &Listener)

Remove a previously registered closure from the list of closures that the object notifies.
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>