From c0d3af6905a9b97da6fb4c191733d0d3f9f39632 Mon Sep 17 00:00:00 2001
From: Per Lindgren <per.lindgren@ltu.se>
Date: Sun, 26 Jan 2020 22:50:27 +0100
Subject: [PATCH] ADSR with a viev (padding experiment)

---
 examples/draw.rs | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/examples/draw.rs b/examples/draw.rs
index f6e8d6f..3c3bed9 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 {
-- 
GitLab