From 529baed88b90b090252f78019fb69626b0698a89 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Wed, 1 Dec 2021 11:23:04 +0100 Subject: [PATCH] widget/material: [API] add description argument to Switch constructor Switch needs a semantic description, but doesn't have a text label attached. This change adds a description argument to the constructor. Signed-off-by: Elias Naur --- widget/material/switch.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/widget/material/switch.go b/widget/material/switch.go index 0853b630..dcefaa3e 100644 --- a/widget/material/switch.go +++ b/widget/material/switch.go @@ -17,7 +17,8 @@ import ( ) type SwitchStyle struct { - Color struct { + Description string + Color struct { Enabled color.NRGBA Disabled color.NRGBA Track color.NRGBA @@ -26,9 +27,10 @@ type SwitchStyle struct { } // Switch is for selecting a boolean value. -func Switch(th *Theme, swtch *widget.Bool) SwitchStyle { +func Switch(th *Theme, swtch *widget.Bool, description string) SwitchStyle { sw := SwitchStyle{ - Switch: swtch, + Switch: swtch, + Description: description, } sw.Color.Enabled = th.Palette.ContrastBg sw.Color.Disabled = th.Palette.Bg