mirror of
https://github.com/danbulant/cushy
synced 2026-05-24 20:32:28 +00:00
measure() now is layout(). LayoutContext can either persist layout information or be used temporarily for measurement. While this caching is constantly thrown out currently, this is a step towards being able to only re-layout widgets if they've been invalidated.
25 lines
755 B
Rust
25 lines
755 B
Rust
use gooey::styles::components::TextColor;
|
|
use gooey::styles::Styles;
|
|
use gooey::widget::{Children, MakeWidget, Widget};
|
|
use gooey::widgets::stack::Stack;
|
|
use gooey::widgets::{Button, Style};
|
|
use gooey::window::Window;
|
|
use gooey::{styles, Run};
|
|
use kludgine::Color;
|
|
|
|
fn main() -> gooey::Result {
|
|
Window::for_widget(
|
|
Stack::rows(
|
|
Children::new()
|
|
.with_widget(Button::new("Default"))
|
|
.with_widget(red_text(Button::new("Styled"))),
|
|
)
|
|
.with_styles(Styles::new().with(&TextColor, Color::GREEN)),
|
|
)
|
|
.run()
|
|
}
|
|
|
|
/// Creating reusable style helpers that work with any Widget is straightfoward
|
|
fn red_text(w: impl Widget) -> Style {
|
|
Style::new(styles!(TextColor => Color::RED), w)
|
|
}
|