mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 01:15:35 +00:00
example/kitchen: place buttons on the same row
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+29
-18
@@ -104,24 +104,35 @@ func kitchen(gtx *layout.Context, th *material.Theme) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
func() {
|
func() {
|
||||||
for button.Clicked(gtx) {
|
buttons := layout.Flex{Alignment: layout.Middle}
|
||||||
enabled = !enabled
|
in := layout.UniformInset(unit.Dp(8))
|
||||||
}
|
b1 := buttons.Rigid(gtx, func() {
|
||||||
th.Button("Click me!").Layout(gtx, button)
|
in.Layout(gtx, func() {
|
||||||
},
|
for iconButton.Clicked(gtx) {
|
||||||
func() {
|
}
|
||||||
if enabled {
|
th.IconButton(icon).Layout(gtx, iconButton)
|
||||||
for disabledButton.Clicked(gtx) {
|
})
|
||||||
}
|
})
|
||||||
th.Button("Enabled").Layout(gtx, disabledButton)
|
b2 := buttons.Rigid(gtx, func() {
|
||||||
} else {
|
in.Layout(gtx, func() {
|
||||||
th.Button("Disabled").Layout(gtx, disabledButton)
|
for button.Clicked(gtx) {
|
||||||
}
|
enabled = !enabled
|
||||||
},
|
}
|
||||||
func() {
|
th.Button("Click me!").Layout(gtx, button)
|
||||||
for iconButton.Clicked(gtx) {
|
})
|
||||||
}
|
})
|
||||||
th.IconButton(icon).Layout(gtx, iconButton)
|
b3 := buttons.Rigid(gtx, func() {
|
||||||
|
in.Layout(gtx, func() {
|
||||||
|
if enabled {
|
||||||
|
for disabledButton.Clicked(gtx) {
|
||||||
|
}
|
||||||
|
th.Button("Enabled").Layout(gtx, disabledButton)
|
||||||
|
} else {
|
||||||
|
th.Button("Disabled").Layout(gtx, disabledButton)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
buttons.Layout(gtx, b1, b2, b3)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
list.Layout(gtx, len(widgets), func(i int) {
|
list.Layout(gtx, len(widgets), func(i int) {
|
||||||
|
|||||||
Reference in New Issue
Block a user