pub struct PagerState { /* private fields */ }Expand description
Where a pager is — Compose’s PagerState. It is Copy, so it moves into
any number of closures.
Implementations§
Source§impl PagerState
impl PagerState
Sourcepub fn new(initial_page: usize) -> PagerState
pub fn new(initial_page: usize) -> PagerState
A pager’s state on initial_page, for code that remembers the state
itself. Call it inside a remember, as LazyListState::new.
Sourcepub fn try_first_page(&self) -> Option<usize>
pub fn try_first_page(&self) -> Option<usize>
The first page in view, or None once the slot that held this state
was released.
Sourcepub fn current_page(&self) -> usize
pub fn current_page(&self) -> usize
The page that fills most of the pager. A composable that reads it recomposes while the pager scrolls.
Sourcepub fn settled_page(&self) -> usize
pub fn settled_page(&self) -> usize
The page the pager rests on: Compose’s settledPage. While a drag,
a fling or an animation moves the pager, it stays the page that
scroll began on, so a composable that reads it recomposes when a
scroll starts and when it ends, not on the frames between.
Sourcepub fn is_scroll_in_progress(&self) -> bool
pub fn is_scroll_in_progress(&self) -> bool
Whether a drag, a fling or an animation moves the pager now:
Compose’s isScrollInProgress.
Sourcepub fn target_page(&self) -> usize
pub fn target_page(&self) -> usize
The page the pager is on its way to: Compose’s targetPage. While an
animation or the settle after a release moves the pager, it is the
page that motion ends on; during a drag and at rest it is
Self::current_page.
Sourcepub fn current_page_offset_fraction(&self) -> f32
pub fn current_page_offset_fraction(&self) -> f32
How far the pager stands from Self::current_page, as a fraction of
a page from -0.5 to 0.5 — Compose’s currentPageOffsetFraction.
Sourcepub fn scroll_to_page(&self, page: usize)
pub fn scroll_to_page(&self, page: usize)
Shows page at once.
Sourcepub fn animate_scroll_to_page(&self, page: usize)
pub fn animate_scroll_to_page(&self, page: usize)
Scrolls to page with a spring — Compose’s animateScrollToPage. A
press on the pager stops it, and letting go settles on a page.
Sourcepub fn lazy_list_state(&self) -> LazyListState
pub fn lazy_list_state(&self) -> LazyListState
The state of the lazy row or column the pages sit in, for a scroll indicator.
Trait Implementations§
Source§impl Clone for PagerState
impl Clone for PagerState
Source§fn clone(&self) -> PagerState
fn clone(&self) -> PagerState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for PagerState
Source§impl PartialEq for PagerState
impl PartialEq for PagerState
impl StructuralPartialEq for PagerState
Auto Trait Implementations§
impl Freeze for PagerState
impl RefUnwindSafe for PagerState
impl Send for PagerState
impl Sync for PagerState
impl Unpin for PagerState
impl UnsafeUnpin for PagerState
impl UnwindSafe for PagerState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.