widgets, widgets/material: add RadioButton & Enum

Signed-off-by: Alexander Arin <fralx@yandex.ru>
This commit is contained in:
Alexander Arin
2019-11-06 12:55:19 +03:00
committed by Elias Naur
parent 82e51019e1
commit 089ae31f0c
6 changed files with 198 additions and 73 deletions
+18 -4
View File
@@ -62,10 +62,11 @@ var (
SingleLine: true,
Submit: true,
}
button = new(widget.Button)
greenButton = new(widget.Button)
iconButton = new(widget.Button)
list = &layout.List{
button = new(widget.Button)
greenButton = new(widget.Button)
iconButton = new(widget.Button)
radioButtonsGroup = new(widget.Enum)
list = &layout.List{
Axis: layout.Vertical,
}
green = true
@@ -125,6 +126,19 @@ func kitchen(gtx *layout.Context, th *material.Theme) {
func() {
th.CheckBox("Checkbox").Layout(gtx, checkbox)
},
func() {
group := layout.Flex{}
r1 := group.Rigid(gtx, func() {
th.RadioButton("r1", "RadioButton1").Layout(gtx, radioButtonsGroup)
})
r2 := group.Rigid(gtx, func() {
th.RadioButton("r2", "RadioButton2").Layout(gtx, radioButtonsGroup)
})
r3 := group.Rigid(gtx, func() {
th.RadioButton("r3", "RadioButton3").Layout(gtx, radioButtonsGroup)
})
group.Layout(gtx, r1, r2, r3)
},
}
list.Layout(gtx, len(widgets), func(i int) {
layout.UniformInset(unit.Dp(16)).Layout(gtx, widgets[i])