pub struct ZStack<C> { /* private fields */ }Expand description
A view that overlays its children, aligning them in front of each other.
Use a ZStack when you want to layer views on top of each other. The stack
sizes itself to fit its largest child.
ⓘ
zstack((
Color::blue(),
text("Overlay Text"),
))You can control how children align within the stack:
ⓘ
ZStack::new(Alignment::TopLeading, (
background_view,
content_view,
))Note: If you only need a decorative background without affecting layout size,
use .background() instead.
Implementations§
Source§impl<C: TupleViews> ZStack<(C,)>
impl<C: TupleViews> ZStack<(C,)>
Trait Implementations§
Source§impl<V> FromIterator<V> for ZStack<(Vec<AnyView>,)>where
V: View,
impl<V> FromIterator<V> for ZStack<(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 ZStack<C>where
C: Freeze,
impl<C> RefUnwindSafe for ZStack<C>where
C: RefUnwindSafe,
impl<C> Send for ZStack<C>where
C: Send,
impl<C> Sync for ZStack<C>where
C: Sync,
impl<C> Unpin for ZStack<C>where
C: Unpin,
impl<C> UnwindSafe for ZStack<C>where
C: UnwindSafe,
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