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> UnsafeUnpin for ZStack<C>where
C: UnsafeUnpin,
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
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