mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
example/kitchen: add Float/Slider
Signed-off-by: Gordon Klaus <gordon.klaus@gmail.com>
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ module gioui.org/cmd
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
gioui.org v0.0.0-20200621204156-878131189b10
|
||||
gioui.org v0.0.0-20200622101735-5368743478e0
|
||||
github.com/chromedp/cdproto v0.0.0-20191114225735-6626966fbae4
|
||||
github.com/chromedp/chromedp v0.5.2
|
||||
golang.org/x/image v0.0.0-20200618115811-c13761719519
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
gioui.org v0.0.0-20200621204156-878131189b10 h1:Q/opU7X7OKFShwOaV1A44KYJA6oGvs1d5o6aAo/tmy8=
|
||||
gioui.org v0.0.0-20200621204156-878131189b10/go.mod h1:jiUwifN9cRl/zmco43aAqh0aV+s9GbhG13KcD+gEpkU=
|
||||
gioui.org v0.0.0-20200622101735-5368743478e0 h1:9P/XQRVLD9C/BhavG9VarW0jJJF86PlOCivbLJE4cTk=
|
||||
gioui.org v0.0.0-20200622101735-5368743478e0/go.mod h1:jiUwifN9cRl/zmco43aAqh0aV+s9GbhG13KcD+gEpkU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/chromedp/cdproto v0.0.0-20191114225735-6626966fbae4 h1:QD3KxSJ59L2lxG6MXBjNHxiQO2RmxTQ3XcK+wO44WOg=
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ module gioui.org/example
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
gioui.org v0.0.0-20200621204156-878131189b10
|
||||
gioui.org v0.0.0-20200622101735-5368743478e0
|
||||
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72
|
||||
github.com/google/go-github/v24 v24.0.1
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
gioui.org v0.0.0-20200621204156-878131189b10 h1:Q/opU7X7OKFShwOaV1A44KYJA6oGvs1d5o6aAo/tmy8=
|
||||
gioui.org v0.0.0-20200621204156-878131189b10/go.mod h1:jiUwifN9cRl/zmco43aAqh0aV+s9GbhG13KcD+gEpkU=
|
||||
gioui.org v0.0.0-20200622101735-5368743478e0 h1:9P/XQRVLD9C/BhavG9VarW0jJJF86PlOCivbLJE4cTk=
|
||||
gioui.org v0.0.0-20200622101735-5368743478e0/go.mod h1:jiUwifN9cRl/zmco43aAqh0aV+s9GbhG13KcD+gEpkU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 h1:SCYMcCJ89LjRGwEa0tRluNRiMjZHalQZrVrvTbPh+qw=
|
||||
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7/go.mod h1:482civXOzJJCPzJ4ZOX/pwvXBWSnzD4OKMdH4ClKGbk=
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"image/png"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
@@ -67,7 +68,7 @@ func main() {
|
||||
}()
|
||||
|
||||
go func() {
|
||||
w := app.NewWindow(app.Size(unit.Dp(800), unit.Dp(650)))
|
||||
w := app.NewWindow(app.Size(unit.Dp(800), unit.Dp(700)))
|
||||
if err := loop(w); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@@ -197,6 +198,7 @@ var (
|
||||
checkbox = new(widget.Bool)
|
||||
swtch = new(widget.Bool)
|
||||
transformTime time.Time
|
||||
float = new(widget.Float)
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -329,6 +331,16 @@ func kitchen(gtx layout.Context, th *material.Theme) layout.Dimensions {
|
||||
layout.Rigid(material.RadioButton(th, radioButtonsGroup, "r3", "RadioButton3").Layout),
|
||||
)
|
||||
},
|
||||
func(gtx C) D {
|
||||
return layout.Flex{Alignment: layout.Middle}.Layout(gtx,
|
||||
layout.Flexed(1, material.Slider(th, float, 0, 2*math.Pi).Layout),
|
||||
layout.Rigid(func(gtx C) D {
|
||||
return layout.UniformInset(unit.Dp(8)).Layout(gtx,
|
||||
material.Body1(th, fmt.Sprintf("%.2f", float.Value)).Layout,
|
||||
)
|
||||
}),
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
return list.Layout(gtx, len(widgets), func(gtx C, i int) D {
|
||||
|
||||
Reference in New Issue
Block a user