use druid::widget::{Button, Flex, Label, SizedBox, WidgetExt};
use druid::{AppLauncher, Color, Widget, WindowDesc};
fn build_app() -> impl Widget<u32> {
let mut col = Flex::column();
let mut header = Flex::row();
header.add_child(
Label::new("One")
.center()
.fix_width(60.0)
.background(Color::rgb8(0x77, 0x77, 0))
.border(Color::WHITE, 3.0),
0.0,
);
header.add_child(SizedBox::empty().expand(), 1.0);
header.add_child(Button::new("Two", Button::noop).padding(20.), 0.0);
col.add_child(
header
.fix_height(100.0)
.background(Color::rgb8(0, 0x77, 0x88)),
0.0,
);
for i in 0..5 {
let weight = if i == 2 { 3.0 } else { 1.0 };
col.add_child(Button::new(format!("Button #{}", i), Button::noop), weight);
}
col
}
fn main() {
let window = WindowDesc::new(build_app);
AppLauncher::with_window(window)
.use_simple_logger()
.launch(0u32)
.expect("launch failed");
}