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, Option<ScrollController<Point>>)
pub fn into_inner(self) -> (Axis, AnyView, Option<ScrollController<Point>>)
Decomposes the ScrollView into its axis, content, and controller.
Sourcepub const fn as_parts(
&self,
) -> (Axis, &AnyView, Option<&ScrollController<Point>>)
pub const fn as_parts( &self, ) -> (Axis, &AnyView, Option<&ScrollController<Point>>)
Returns borrowed access to axis, content, and controller.
Sourcepub fn scroll_controller(self, controller: &ScrollController<Point>) -> Self
pub fn scroll_controller(self, controller: &ScrollController<Point>) -> Self
Connects a programmatic scroll controller.
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 !RefUnwindSafe for ScrollView
impl !Send for ScrollView
impl !Sync for ScrollView
impl !UnwindSafe for ScrollView
impl Freeze for ScrollView
impl Unpin for ScrollView
impl UnsafeUnpin for ScrollView
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
Source§impl<T> IdentifiableExt for T
impl<T> IdentifiableExt for T
Source§impl<V> PositionExt for Vwhere
V: View,
impl<V> PositionExt for Vwhere
V: View,
Source§fn position(
self,
x: impl IntoSignalF32,
y: impl IntoSignalF32,
) -> PositionedChild<Self>
fn position( self, x: impl IntoSignalF32, y: impl IntoSignalF32, ) -> PositionedChild<Self>
Position view’s center at absolute (x, y) coordinates. Read more
Source§fn position_anchor(
self,
anchor: UnitPoint,
x: impl IntoSignalF32,
y: impl IntoSignalF32,
) -> PositionedChild<Self>
fn position_anchor( self, anchor: UnitPoint, x: impl IntoSignalF32, y: impl IntoSignalF32, ) -> PositionedChild<Self>
Position view’s anchor point at absolute coordinates. Read more
Source§fn position_in(self, position: UnitPoint) -> PositionedChild<Self>
fn position_in(self, position: UnitPoint) -> PositionedChild<Self>
Position view’s center at fractional location in parent. Read more
Source§fn position_in_anchor(
self,
anchor: UnitPoint,
position: UnitPoint,
) -> PositionedChild<Self>
fn position_in_anchor( self, anchor: UnitPoint, position: UnitPoint, ) -> PositionedChild<Self>
Position view’s anchor at fractional location in parent. Read more
Source§fn position_in_offset(
self,
anchor: UnitPoint,
position: UnitPoint,
offset_x: impl IntoSignalF32,
offset_y: impl IntoSignalF32,
) -> PositionedChild<Self>
fn position_in_offset( self, anchor: UnitPoint, position: UnitPoint, offset_x: impl IntoSignalF32, offset_y: impl IntoSignalF32, ) -> PositionedChild<Self>
Position with fractional location plus offset. Read more
Source§fn pin(self, constraints: PinConstraints) -> PositionedChild<Self>
fn pin(self, constraints: PinConstraints) -> PositionedChild<Self>
Position using edge pins and optional explicit size. Read more