Conversation
|
While this approach is simple, the main reason for style sheets to exist is dynamic widget state. A |
Forgive me but i don't understand why my rfc imply that pub struct ButtonColors {
pub background: Option<Background>,
pub border_color: Color,
pub text_color: Color,
}
// we could use a builder patter here
let colors = ButtonColors {
background: None,
border_color: color!(...),
text_color: color!(...),
};
Button::new("hello")
// this is just a setter.
.colors(colors);
we can then match the internal state to compute his appearance, based on his styling state |
|
I like the way flutter handles this (which in turn inspired Jetpack Compose). Each platform gets its own Theme object like TLDR: Current methods of style sheets are nice for implementing custom design language, but a base palette structure needs to be implemented in it so that they can be used for styling/creating custom widgets that follow the same theme. |
renderer