pub struct ScrollView { /* private fields */ }Expand description
A scrollable view that displays content larger than its frame.
Use a ScrollView when you have content that might not fit in the available space.
The view automatically enables scrolling in the specified direction.
ⓘ
scroll(
vstack((
text("Item 1"),
text("Item 2"),
text("Item 3"),
// ... many more items
))
)By default, ScrollView scrolls vertically. For horizontal scrolling:
ⓘ
scroll_horizontal(long_content)Or both directions:
ⓘ
scroll_both(large_image)Implementations§
Source§impl ScrollView
impl ScrollView
Sourcepub const fn new(axis: Axis, content: AnyView) -> Self
pub const fn new(axis: Axis, content: AnyView) -> Self
Creates a new ScrollView with the specified scroll axis and content.
Sourcepub fn into_inner(self) -> (Axis, AnyView)
pub fn into_inner(self) -> (Axis, AnyView)
Decomposes the ScrollView into its axis and content.
Sourcepub fn horizontal(content: impl View) -> Self
pub fn horizontal(content: impl View) -> Self
Creates a ScrollView with horizontal scrolling.
Trait Implementations§
Source§impl Debug for ScrollView
impl Debug for ScrollView
Source§impl NativeView for ScrollView
impl NativeView for ScrollView
Source§fn stretch_axis(&self) -> StretchAxis
fn stretch_axis(&self) -> StretchAxis
Which axis (or axes) this view stretches to fill available space.
Source§impl View for ScrollView
impl View for ScrollView
Auto Trait Implementations§
impl Freeze for ScrollView
impl !RefUnwindSafe for ScrollView
impl !Send for ScrollView
impl !Sync for ScrollView
impl Unpin for ScrollView
impl !UnwindSafe for ScrollView
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more