pub struct VStack<C> { /* private fields */ }Expand description
A view that arranges its children in a vertical line.
Use a VStack to arrange views top-to-bottom. The stack sizes itself to fit
its contents, distributing available space among its children.
ⓘ
vstack((
text("Title"),
text("Subtitle"),
))You can customize the spacing between children and their horizontal alignment:
ⓘ
VStack::new(HorizontalAlignment::Leading, 8.0, (
text("First"),
text("Second"),
))Use [spacer()] to push content to the top and bottom:
ⓘ
vstack((
text("Header"),
spacer(),
text("Footer"),
))Implementations§
Source§impl<C: TupleViews> VStack<(C,)>
impl<C: TupleViews> VStack<(C,)>
Sourcepub const fn new(
alignment: HorizontalAlignment,
spacing: f32,
contents: C,
) -> Self
pub const fn new( alignment: HorizontalAlignment, spacing: f32, contents: C, ) -> Self
Creates a vertical stack with the provided alignment, spacing, and children.
Trait Implementations§
Source§impl<V> FromIterator<V> for VStack<(Vec<AnyView>,)>where
V: View,
impl<V> FromIterator<V> for VStack<(Vec<AnyView>,)>where
V: View,
Source§fn from_iter<T: IntoIterator<Item = V>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = V>>(iter: T) -> Self
Creates a value from an iterator. Read more
Auto Trait Implementations§
impl<C> Freeze for VStack<C>where
C: Freeze,
impl<C> RefUnwindSafe for VStack<C>where
C: RefUnwindSafe,
impl<C> Send for VStack<C>where
C: Send,
impl<C> Sync for VStack<C>where
C: Sync,
impl<C> Unpin for VStack<C>where
C: Unpin,
impl<C> UnwindSafe for VStack<C>where
C: UnwindSafe,
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
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)