diff --git a/examples/draw.rs b/examples/draw.rs index f6e8d6f1c66bff8576394a0823cc2918317f3eb3..3c3bed9e56254929b41704fb037b611194405301 100644 --- a/examples/draw.rs +++ b/examples/draw.rs @@ -115,6 +115,10 @@ impl Widget<Envelope> for Draw { _data: &Envelope, _env: &Env, ) -> Size { + // info!("layout bc {:?}", bc); + // info!("layout bc.min {:?}", bc.min()); + + // bc.min() bc.constrain((100.0, 100.0)) // this is probably incorrect } @@ -179,8 +183,36 @@ impl Adsr { } } +fn build_app() -> impl Widget<Adsr> { + let solid = Color::rgb8(0x3a, 0x3a, 0x3a); + + Flex::column() + .with_child( + Flex::row() + .with_child(Adsr::new().padding(10.0), 0.0) + //.with_child(Adsr::new().expand().padding(10.0), 0.0) + .with_child( + Label::new("top right") + .background(solid.clone()) + .padding(10.0), + 1.0, + ), + 1.0, + ) + .with_child( + Flex::row() + .with_child(Label::new("bottom left").padding(10.0), 1.0) + .with_child( + Label::new("bottom right") + .border(solid.clone(), 4.0) + .padding(10.0), + 1.0, + ), + 1.0, + ) +} fn main() -> Result<(), PlatformError> { - AppLauncher::with_window(WindowDesc::new(Adsr::new)) + AppLauncher::with_window(WindowDesc::new(build_app)) .use_simple_logger() .launch(Adsr { envelope: Envelope {