API ReferenceLayout Widgets
LimitedBox
Maximum dimensions applying only when incoming constraints are unbounded.
LimitedBox caps sizes that would otherwise be infinite (e.g. inside
scrollables). Defaults are infinity (no-op); setters clamp to max(0.0).
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(
LimitedBox::new(Text::new("Capped at 200x100"))
.max_width(200.0)
.max_height(100.0),
)
.build()
.into()
})?;
incular::run(app)?;
Ok(())
}Methods
pub fn new(child: impl Into<Widget>) -> Self
pub fn max_width(mut self, max_width: f32) -> Self
pub fn max_height(mut self, max_height: f32) -> SelfRelated: ConstrainedBox,
OverflowBox.