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
impl CarouselController
Sourcepub fn new(app: &mut App, initial_item: i32) -> Ref<CarouselController>
pub fn new(app: &mut App, initial_item: i32) -> Ref<CarouselController>
Creates a carousel controller.
Sourcepub fn initial_item(self: Handle<Self>, app: &App) -> i32
pub fn initial_item(self: Handle<Self>, app: &App) -> i32
The item that will be the leading item when the carousel is first built.
Sourcepub fn leading_item(self: Handle<Self>, app: &App) -> i32
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.
Sourcepub fn animate_to_item(
self: Handle<Self>,
app: &mut App,
index: i32,
duration: Duration,
curve: Rc<dyn Curve>,
) -> CompleterFuture<()> ⓘ
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
impl ChangeNotifier for CarouselController
fn change_notifier_data(&self) -> &ChangeNotifierData
fn change_notifier_data_mut(&mut self) -> &mut ChangeNotifierData
Source§fn will_add_listener(self: Handle<Self>, app: &mut App)
fn will_add_listener(self: Handle<Self>, app: &mut App)
addListener that
work before super.addListener go here.Source§fn did_remove_listener(self: Handle<Self>, app: &mut App)
fn did_remove_listener(self: Handle<Self>, app: &mut App)
removeListener that
work after super.removeListener go here.Source§impl ScrollControllerLeaf for CarouselController
impl ScrollControllerLeaf for CarouselController
Source§fn scroll_controller_data(
self: Handle<Self>,
app: &App,
) -> &ScrollControllerData
fn scroll_controller_data( self: Handle<Self>, app: &App, ) -> &ScrollControllerData
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
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
fn create_scroll_position( self: Handle<Self>, app: &mut App, physics: ScrollPhysicsRef, context: Rc<dyn ScrollContext>, old_position: Option<AnyScrollPosition>, ) -> ScrollPositionRef
Source§fn attach(self: Handle<Self>, app: &mut App, position: ScrollPositionRef)
fn attach(self: Handle<Self>, app: &mut App, position: ScrollPositionRef)
Source§fn detach(self: Handle<Self>, app: &mut App, position: AnyScrollPosition)
fn detach(self: Handle<Self>, app: &mut App, position: AnyScrollPosition)
Source§fn notification_listener(self: Handle<Self>) -> Listener
fn notification_listener(self: Handle<Self>) -> Listener
notifyListeners tear-off: the listener this controller keeps on each attached
position.Source§fn forward_notification(self: Handle<Self>, app: &mut App)
fn forward_notification(self: Handle<Self>, app: &mut App)
notification_listener.Source§fn on_attach(
self: Handle<Self>,
app: &App,
) -> Option<Rc<dyn Fn(&mut App, AnyScrollPosition)>>
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)>>
fn on_detach( self: Handle<Self>, app: &App, ) -> Option<Rc<dyn Fn(&mut App, AnyScrollPosition)>>
Source§fn animate_to(
self: Handle<Self>,
app: &mut App,
offset: f64,
duration: Duration,
curve: Rc<dyn Curve>,
) -> CompleterFuture<()> ⓘ
fn animate_to( self: Handle<Self>, app: &mut App, offset: f64, duration: Duration, curve: Rc<dyn Curve>, ) -> CompleterFuture<()> ⓘ
Source§fn as_controller(self: Handle<Self>) -> AnyScrollController
fn as_controller(self: Handle<Self>) -> AnyScrollController
AnyScrollController — what to pass where a Dart API
takes a ScrollController.