pub trait StackView: View {
// Provided methods
fn from_justify_content(justify_content: JustifyContent) -> Self { ... }
fn from_align_items(align_items: AlignItems) -> Self { ... }
fn flex_direction(self, direction: FlexDirection) -> Self { ... }
fn wrap(self, wrap: FlexWrap) -> Self { ... }
fn justify_content(self, justify: JustifyContent) -> Self { ... }
fn align_items(self, align_items: AlignItems) -> Self { ... }
fn row_gap(self, gap: Val) -> Self { ... }
fn column_gap(self, gap: Val) -> Self { ... }
}Expand description
Provides a flexible layout interface for stack-style containers (e.g. HStack, VStack).
This trait is intended for views that manage their children using a FlexDirection-based
layout model. It offers a fluent builder-style interface for configuring core layout
properties like spacing, alignment, and wrapping.
Provided Methods§
Sourcefn from_justify_content(justify_content: JustifyContent) -> Self
fn from_justify_content(justify_content: JustifyContent) -> Self
Creates a new instance with a specified JustifyContent alignment along the main axis.
§Arguments
justify_content- Defines how free space is distributed along the main axis.
Sourcefn from_align_items(align_items: AlignItems) -> Self
fn from_align_items(align_items: AlignItems) -> Self
Creates a new instance with a specified AlignItems alignment along the cross axis.
§Arguments
align_items- Defines how child elements are aligned perpendicular to the main axis.
Sourcefn flex_direction(self, direction: FlexDirection) -> Self
fn flex_direction(self, direction: FlexDirection) -> Self
Sets the direction of content flow within the stack (e.g. horizontal or vertical).
§Arguments
direction- The flex direction, such asRoworColumn.
Sourcefn wrap(self, wrap: FlexWrap) -> Self
fn wrap(self, wrap: FlexWrap) -> Self
Sets the wrapping behavior of the flex container.
Determines whether children wrap to the next line or stay on a single line.
§Arguments
wrap- The wrapping strategy, such asNoWraporWrap.
Sourcefn justify_content(self, justify: JustifyContent) -> Self
fn justify_content(self, justify: JustifyContent) -> Self
Defines how extra space along the main axis is distributed.
§Arguments
justify- The justification mode (e.g.Center,SpaceBetween).
Sourcefn align_items(self, align_items: AlignItems) -> Self
fn align_items(self, align_items: AlignItems) -> Self
Defines how children are aligned along the cross axis.
§Arguments
align_items- The alignment mode (e.g.Start,Stretch).
Sourcefn row_gap(self, gap: Val) -> Self
fn row_gap(self, gap: Val) -> Self
Sets the vertical spacing between rows when wrapping is enabled.
§Arguments
gap- The spacing between rows (Val::Px,Val::Percent, etc.).
Sourcefn column_gap(self, gap: Val) -> Self
fn column_gap(self, gap: Val) -> Self
Sets the horizontal spacing between columns when wrapping is enabled.
§Arguments
gap- The spacing between columns (Val::Px,Val::Percent, etc.).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.