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 <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-12-01 11:23:04 +01:00
parent 763fca1f29
commit 529baed88b
+5 -3
View File
@@ -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