Incular logoIncular
API ReferenceLayout Widgets

DecoratedBox

Background and border wrapper without clipping.

DecoratedBox paints background/border around its child without clipping (pair with an explicit clip widget when needed).

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(
                DecoratedBox::new(Text::new("Decorated"))
                    .background(Color::WHITE)
                    .border(Border::new(1.0, Color::BLACK))
                    .radius(8.0),
            )
            .build()
            .into()
    })?;
    incular::run(app)?;
    Ok(())
}

Props

Prop

Type

See Path for BoxDecoration, BoxShape, and shadow types.

Related: Container, ClipRRect.

On this page