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 fn new(alignment: HorizontalAlignment, spacing: f32, contents: C) -> Self
pub fn new(alignment: HorizontalAlignment, spacing: f32, contents: C) -> Self
Creates a vertical stack with the provided alignment, spacing, and children.
Source§impl<C> VStack<C>
impl<C> VStack<C>
Sourcepub const fn alignment(self, alignment: HorizontalAlignment) -> Self
pub const fn alignment(self, alignment: HorizontalAlignment) -> Self
Sets the horizontal alignment for children in the stack.
Sourcepub fn spacing(self, spacing: impl IntoSignalF32 + 'static) -> Self
pub fn spacing(self, spacing: impl IntoSignalF32 + 'static) -> Self
Sets the spacing between children in the stack.
Accepts any numeric literal or signal of f32. Signal changes invalidate
only this stack’s layout.
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> !RefUnwindSafe for VStack<C>
impl<C> !Send for VStack<C>
impl<C> !Sync for VStack<C>
impl<C> !UnwindSafe for VStack<C>
impl<C> Freeze for VStack<C>where
C: Freeze,
impl<C> Unpin for VStack<C>where
C: Unpin,
impl<C> UnsafeUnpin for VStack<C>where
C: UnsafeUnpin,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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