Skip to main content

CarouselController

Struct CarouselController 

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

A controller for CarouselView.

Using a carousel controller helps to show the first visible item on the carousel list.

Implementations§

Source§

impl CarouselController

Source

pub fn new(app: &mut App, initial_item: i32) -> Ref<CarouselController>

Creates a carousel controller.

Source

pub fn initial_item(self: Handle<Self>, app: &App) -> i32

The item that will be the leading item when the carousel is first built.

Source

pub fn leading_item(self: Handle<Self>, app: &App) -> i32

The index of the current leading item of the controlled CarouselView.

Reading it panics before a CarouselView is built with this controller, and while several carousels are attached to it.

Source

pub fn animate_to_item( self: Handle<Self>, app: &mut App, index: i32, duration: Duration, curve: Rc<dyn Curve>, ) -> CompleterFuture<()> ⓘ

Animates the controlled carousel so that the item at index is the leading item (or, for a weighted carousel with consume_max_weight unset, the one with the largest weight).

The returned future resolves when the animation completes; it resolves at once without a controlled carousel. Dart’s defaults are a duration of 300 milliseconds and Curves.ease.

Trait Implementations§

Source§

impl ChangeNotifier for CarouselController

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 CarouselController

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 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 attach(self: Handle<Self>, app: &mut App, position: ScrollPositionRef)

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

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

The initial value to use for offset. 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 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<Rc<dyn Fn(&mut App, AnyScrollPosition)>>

Source§

fn on_detach( self: Handle<Self>, app: &App, ) -> Option<Rc<dyn Fn(&mut App, AnyScrollPosition)>>

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 CarouselController

§

impl !Send for CarouselController

§

impl !Sync for CarouselController

§

impl !UnwindSafe for CarouselController

§

impl Forget for CarouselController

§

impl Freeze for CarouselController

§

impl Move for CarouselController

§

impl Unpin for CarouselController
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 CarouselController

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>