Change label of Toggler to optional

This commit is contained in:
Kaiden42 2020-09-24 16:31:39 +02:00 committed by Héctor Ramón
parent aa18a6e0d5
commit 7a626f3b7b
3 changed files with 53 additions and 32 deletions

View file

@ -33,7 +33,7 @@ where
bounds: Rectangle,
is_active: bool,
is_mouse_over: bool,
(label, _): Self::Output,
label: Option<Self::Output>,
style_sheet: &Self::Style,
) -> Self::Output {
let style = if is_mouse_over {
@ -82,7 +82,12 @@ where
(
Primitive::Group {
primitives: vec![label, toggler_background, toggler_foreground],
primitives: match label {
Some((l, _)) => {
vec![l, toggler_background, toggler_foreground]
}
None => vec![toggler_background, toggler_foreground],
},
},
if is_mouse_over {
mouse::Interaction::Pointer