API ReferenceLayout Widgets
FractionallySizedBox
Size a child as a fraction of incoming constraints.
FractionallySizedBox scales the child by factors of the parent constraints.
Both default None (no scaling); 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(
FractionallySizedBox::new(Text::new("Half"))
.width_factor(0.5)
.height_factor(0.5),
)
.build()
.into()
})?;
incular::run(app)?;
Ok(())
}Methods
pub fn new(child: impl Into<Widget>) -> Self
pub fn width_factor(mut self, factor: f32) -> Self
pub fn height_factor(mut self, factor: f32) -> SelfRelated: AspectRatio,
Align.