Incular logoIncular
API ReferenceLayout Widgets

OverflowBox

Let a child overflow while the parent reports its constrained size.

OverflowBox gives the child independent min/max bounds while the parent keeps reporting the incoming size. All four bounds default None (passthrough).

Props

Prop

Type

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(
                OverflowBox::new(Text::new("Overflowing content"))
                    .min_width(50.0)
                    .max_width(400.0)
                    .min_height(20.0)
                    .max_height(200.0),
            )
            .build()
            .into()
    })?;
    incular::run(app)?;
    Ok(())
}

Methods

pub fn new(child: impl Into<Widget>) -> Self
pub fn min_width(mut self, value: f32) -> Self
pub fn max_width(mut self, value: f32) -> Self
pub fn min_height(mut self, value: f32) -> Self
pub fn max_height(mut self, value: f32) -> Self

Related: LimitedBox, ConstrainedBox.

On this page