pub struct ZStackLayout {
pub alignment: Alignment,
}Expand description
Stacks an arbitrary number of children with a shared alignment.
ZStackLayout positions every child within the same bounds, overlaying them
according to the specified alignment. Each child is sized independently,
and the container’s final width/height are the maxima of the children’s
reported sizes. If you instead need the base child to dictate the container
size while layering secondary content, see crate::overlay::OverlayLayout.
Fields§
§alignment: AlignmentThe alignment used to position children within the ZStack
Trait Implementations§
Source§impl Clone for ZStackLayout
impl Clone for ZStackLayout
Source§impl Debug for ZStackLayout
impl Debug for ZStackLayout
Source§impl Default for ZStackLayout
impl Default for ZStackLayout
Source§impl Layout for ZStackLayout
impl Layout for ZStackLayout
Source§fn stretch_axis(&self, children: &[StretchAxis]) -> StretchAxis
fn stretch_axis(&self, children: &[StretchAxis]) -> StretchAxis
A ZStack is content-sized only while every child is — a child that
stretches (a Color, a GpuSurface) makes the stack stretch on the
same axes, since place hands such children the full bounds.
Axis-relative answers have no direction to resolve against here:
MainAxis children (Spacer) want whatever space is offered, which in
a zstack is both axes; CrossAxis children (Divider) resolve to
their default orientation — a horizontal rule — and fill horizontally.