mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 18:35:34 +00:00
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:
@@ -17,7 +17,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type SwitchStyle struct {
|
type SwitchStyle struct {
|
||||||
Color struct {
|
Description string
|
||||||
|
Color struct {
|
||||||
Enabled color.NRGBA
|
Enabled color.NRGBA
|
||||||
Disabled color.NRGBA
|
Disabled color.NRGBA
|
||||||
Track color.NRGBA
|
Track color.NRGBA
|
||||||
@@ -26,9 +27,10 @@ type SwitchStyle struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Switch is for selecting a boolean value.
|
// 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{
|
sw := SwitchStyle{
|
||||||
Switch: swtch,
|
Switch: swtch,
|
||||||
|
Description: description,
|
||||||
}
|
}
|
||||||
sw.Color.Enabled = th.Palette.ContrastBg
|
sw.Color.Enabled = th.Palette.ContrastBg
|
||||||
sw.Color.Disabled = th.Palette.Bg
|
sw.Color.Disabled = th.Palette.Bg
|
||||||
|
|||||||
Reference in New Issue
Block a user