Simplify theming for Text widget

This commit is contained in:
Héctor Ramón Jiménez 2024-03-04 19:31:26 +01:00
parent ce309db37b
commit 4130ae4be9
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
12 changed files with 116 additions and 122 deletions

View file

@ -82,7 +82,10 @@ impl Application for Example {
row![
text(label),
horizontal_space(),
text(value).font(Font::MONOSPACE).size(14).style(color),
text(value)
.font(Font::MONOSPACE)
.size(14)
.color_maybe(color),
]
.height(40)
.align_items(Alignment::Center)
@ -102,13 +105,12 @@ impl Application for Example {
})
.unwrap_or_default()
{
Color {
Some(Color {
g: 1.0,
..Color::BLACK
}
.into()
})
} else {
theme::Text::Default
None
},
)
};
@ -120,7 +122,7 @@ impl Application for Example {
Some(Point { x, y }) => format!("({x}, {y})"),
None => "unknown".to_string(),
},
theme::Text::Default,
None,
),
view_bounds("Outer container", self.outer_bounds),
view_bounds("Inner container", self.inner_bounds),