pub struct Flex { /* private fields */ }
Expand description
A container with either horizontal or vertical layout.
This widget is the foundation of most layouts, and is highly configurable.
Implementations§
source§impl Flex
impl Flex
sourcepub fn row() -> Self
pub fn row() -> Self
Create a new horizontal stack.
The child widgets are laid out horizontally, from left to right.
sourcepub fn column() -> Self
pub fn column() -> Self
Create a new vertical stack.
The child widgets are laid out vertically, from top to bottom.
sourcepub fn cross_axis_alignment(self, alignment: CrossAxisAlignment) -> Self
pub fn cross_axis_alignment(self, alignment: CrossAxisAlignment) -> Self
Builder-style method for specifying the childrens’ CrossAxisAlignment
.
sourcepub fn main_axis_alignment(self, alignment: MainAxisAlignment) -> Self
pub fn main_axis_alignment(self, alignment: MainAxisAlignment) -> Self
Builder-style method for specifying the childrens’ MainAxisAlignment
.
sourcepub fn must_fill_main_axis(self, fill: bool) -> Self
pub fn must_fill_main_axis(self, fill: bool) -> Self
Builder-style method for setting whether the container must expand to fill the available space on its main axis.
sourcepub fn with_child(self, child: impl Widget) -> Self
pub fn with_child(self, child: impl Widget) -> Self
Builder-style variant of add_child
.
Convenient for assembling a group of widgets in a single expression.
sourcepub fn with_child_id(self, child: impl Widget, id: WidgetId) -> Self
pub fn with_child_id(self, child: impl Widget, id: WidgetId) -> Self
Builder-style variant of add_child
, that takes the id that the child will have.
Useful for unit tests.
pub fn with_child_pod(self, widget: WidgetPod<Box<dyn Widget>>) -> Self
sourcepub fn with_flex_child(
self,
child: impl Widget,
params: impl Into<FlexParams>
) -> Self
pub fn with_flex_child( self, child: impl Widget, params: impl Into<FlexParams> ) -> Self
Builder-style method to add a flexible child to the container.
sourcepub fn with_default_spacer(self) -> Self
pub fn with_default_spacer(self) -> Self
Builder-style method to add a spacer widget with a standard size.
The actual value of this spacer depends on whether this container is a row or column, as well as theme settings.
sourcepub fn with_spacer(self, len: f64) -> Self
pub fn with_spacer(self, len: f64) -> Self
Builder-style method for adding a fixed-size spacer to the container.
If you are laying out standard controls in this container, you should
generally prefer to use add_default_spacer
.
sourcepub fn with_flex_spacer(self, flex: f64) -> Self
pub fn with_flex_spacer(self, flex: f64) -> Self
Builder-style method for adding a flex
spacer to the container.