API ReferenceLayout Values
MainAxisSize
Whether a flex expands to the parent or shrinks to content.
use incular::prelude::*;
fn main() {
println!("min: {:?}", MainAxisSize::Min);
println!("max: {:?}", MainAxisSize::Max);
}| Variant | Layout |
|---|---|
Min | Shrink to content |
Max | Expand to parent (default) |
use incular::prelude::*;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let app = Application::new(|_cx| {
Container::builder()
.padding(EdgeInsets::all(24.0))
.alignment(Alignment::CENTER)
.child(
Column::builder()
.children(Vec::<Widget>::from([
Text::new("Shrunk").into(),
Text::new("To fit").into(),
]))
.main_axis_size(MainAxisSize::Min)
.spacing(8.0)
.build(),
)
.build()
.into()
})?;
incular::run(app)?;
Ok(())
}