Added basic styling for checkboxes, yay

Co-authored-by: Max <max@zed.dev>
This commit is contained in:
Mikayla Maki 2023-02-24 17:04:31 -08:00
parent 86e2101592
commit 118435a348
3 changed files with 39 additions and 11 deletions

View file

@ -860,9 +860,10 @@ pub struct WelcomeStyle {
pub struct CheckboxStyle {
pub width: f32,
pub height: f32,
pub unchecked: ContainerStyle,
pub default: ContainerStyle,
pub checked: ContainerStyle,
pub hovered: ContainerStyle,
pub hovered_and_checked: ContainerStyle,
}
#[derive(Clone, Deserialize, Default)]

View file

@ -126,11 +126,17 @@ impl WelcomePage {
.with_height(style.height)
.contained()
.with_style(if checked {
style.checked
} else if state.hovered() {
style.hovered
if state.hovered() {
style.hovered_and_checked
} else {
style.checked
}
} else {
style.unchecked
if state.hovered() {
style.hovered
} else {
style.default
}
})
.boxed()
})