pub struct TopAppBarScrollBehavior {
pub collapsed_offset: Signal<f32>,
pub height: f32,
pub collapsed_height: f32,
pub mode: TopAppBarScrollMode,
/* private fields */
}Expand description
Drives scroll-based collapsing/expanding of a TopAppBar.
Create one, pass its nested_scroll_connection
to a lazy list’s [set_nested_scroll_parent] method, and either set the
resulting collapsed_offset
on the TopAppBar via TopAppBarConfig::scroll_offset, or attach it via
TopAppBarConfig::scroll_behavior so the bar wires offset + color itself.
Fields§
§collapsed_offset: Signal<f32>§height: f32§collapsed_height: f32§mode: TopAppBarScrollModeImplementations§
Source§impl TopAppBarScrollBehavior
impl TopAppBarScrollBehavior
pub fn new( height: f32, collapsed_height: f32, mode: TopAppBarScrollMode, ) -> Self
Sourcepub fn nested_scroll_connection(&self) -> NestedScrollConnection
pub fn nested_scroll_connection(&self) -> NestedScrollConnection
Returns a NestedScrollConnection that collapses the bar on
downward scroll and expands on upward scroll. ExitUntilCollapsed
only expands once the nested content is back at the top.
Sourcepub fn offset(&self) -> f32
pub fn offset(&self) -> f32
Returns the current collapsed offset (0 = fully expanded, negative = collapsed).
Sourcepub fn collapsed_fraction(&self) -> f32
pub fn collapsed_fraction(&self) -> f32
Collapse progress in 0.0..=1.0 (0 = expanded, 1 = fully collapsed).
Drives the container color lerp so the scrolled color tracks the offset.
Trait Implementations§
Source§impl Clone for TopAppBarScrollBehavior
impl Clone for TopAppBarScrollBehavior
Source§fn clone(&self) -> TopAppBarScrollBehavior
fn clone(&self) -> TopAppBarScrollBehavior
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for TopAppBarScrollBehavior
impl !Send for TopAppBarScrollBehavior
impl !Sync for TopAppBarScrollBehavior
impl !UnwindSafe for TopAppBarScrollBehavior
impl Freeze for TopAppBarScrollBehavior
impl Unpin for TopAppBarScrollBehavior
impl UnsafeUnpin for TopAppBarScrollBehavior
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
Mutably borrows from an owned value. Read more