example/kitchen: use a different color for the disabled button

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-10-14 15:08:26 +02:00
parent 0559393633
commit 641656b307
+7 -3
View File
@@ -5,6 +5,7 @@ package main
// A Gio program that demonstrates Gio widgets. See https://gioui.org for more information. // A Gio program that demonstrates Gio widgets. See https://gioui.org for more information.
import ( import (
"image/color"
"log" "log"
"gioui.org/app" "gioui.org/app"
@@ -19,7 +20,7 @@ import (
) )
func main() { func main() {
ic, err := material.NewIcon(icons.ContentSend) ic, err := material.NewIcon(icons.ContentAdd)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
@@ -114,13 +115,16 @@ func kitchen(gtx *layout.Context, th *material.Theme) {
}) })
b3 := buttons.Rigid(gtx, func() { b3 := buttons.Rigid(gtx, func() {
in.Layout(gtx, func() { in.Layout(gtx, func() {
var btn material.Button
if enabled { if enabled {
for disabledButton.Clicked(gtx) { for disabledButton.Clicked(gtx) {
} }
th.Button("Enabled").Layout(gtx, disabledButton) btn = th.Button("Enabled")
} else { } else {
th.Button("Disabled").Layout(gtx, disabledButton) btn = th.Button("Disabled")
} }
btn.Background = color.RGBA{A: 0xff, R: 0x9e, G: 0x9d, B: 0x24}
btn.Layout(gtx, disabledButton)
}) })
}) })
buttons.Layout(gtx, b1, b2, b3) buttons.Layout(gtx, b1, b2, b3)