Incular logoIncular
API ReferenceLayout Widgets

SizedOverflowBox

Fixed-size box with aligned overflowing child.

SizedOverflowBox { size: Size, alignment: Alignment, child: Widget } reports a fixed size while letting the child overflow, positioned by alignment (default CENTER).

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(
                SizedOverflowBox::new(
                    Size::new(120.0, 48.0),
                    Text::new("Overflowing text"),
                )
                .alignment(Alignment::CENTER),
            )
            .build()
            .into()
    })?;
    incular::run(app)?;
    Ok(())
}

Props

Prop

Type

Related: OverflowBox, UnconstrainedBox.

On this page