mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
example: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -98,7 +98,7 @@ var button widget.Button
|
||||
|
||||
func draw(gtx *layout.Context, th *material.Theme) {
|
||||
layout.Center.Layout(gtx, func() {
|
||||
th.Button("Button").Layout(gtx, &button)
|
||||
material.Button(th, "Button").Layout(gtx, &button)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ module gioui.org/example
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
gioui.org v0.0.0-20200429080307-4bde9fbcaa2d
|
||||
gioui.org v0.0.0-20200503110304-060cff257f1d
|
||||
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-20200429080307-4bde9fbcaa2d h1:mCIOi978xzjyQD5og9H5LxGJA+ZW+fDzkidNuCKCPDo=
|
||||
gioui.org v0.0.0-20200429080307-4bde9fbcaa2d/go.mod h1:AHI9rFr6AEEHCb8EPVtb/p5M+NMJRKH58IOp8O3Je04=
|
||||
gioui.org v0.0.0-20200503110304-060cff257f1d h1:wG4S7JnaiBYGgVk7hFa61sHrxcz6iI8Y9twYOHTLBzg=
|
||||
gioui.org v0.0.0-20200503110304-060cff257f1d/go.mod h1:AHI9rFr6AEEHCb8EPVtb/p5M+NMJRKH58IOp8O3Je04=
|
||||
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=
|
||||
|
||||
+12
-12
@@ -35,7 +35,7 @@ import (
|
||||
|
||||
type UI struct {
|
||||
fab *widget.Button
|
||||
fabIcon *material.Icon
|
||||
fabIcon *widget.Icon
|
||||
usersList *layout.List
|
||||
users []*user
|
||||
userClicks []gesture.Click
|
||||
@@ -85,7 +85,7 @@ func newUI(fetchCommits func(string)) *UI {
|
||||
SingleLine: true,
|
||||
}
|
||||
var err error
|
||||
u.fabIcon, err = material.NewIcon(icons.ContentSend)
|
||||
u.fabIcon, err = widget.NewIcon(icons.ContentSend)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@@ -123,7 +123,7 @@ func (u *UI) layoutTimings(gtx *layout.Context) {
|
||||
layout.NE.Layout(gtx, func() {
|
||||
layout.Inset{Top: unit.Dp(16)}.Layout(gtx, func() {
|
||||
txt := fmt.Sprintf("m: %d %s", mallocs, u.profile.Timings)
|
||||
lbl := theme.Caption(txt)
|
||||
lbl := material.Caption(theme, txt)
|
||||
lbl.Font.Variant = "Mono"
|
||||
lbl.Layout(gtx)
|
||||
})
|
||||
@@ -169,7 +169,7 @@ func (up *userPage) Layout(gtx *layout.Context) {
|
||||
func (up *userPage) commit(gtx *layout.Context, index int) {
|
||||
u := up.user
|
||||
msg := up.commits[index].GetMessage()
|
||||
label := theme.Caption(msg)
|
||||
label := material.Caption(theme, msg)
|
||||
in := layout.Inset{Top: unit.Dp(16), Right: unit.Dp(8), Left: unit.Dp(8)}
|
||||
in.Layout(gtx, func() {
|
||||
layout.Flex{Axis: layout.Horizontal}.Layout(gtx,
|
||||
@@ -201,14 +201,14 @@ func (u *UI) layoutUsers(gtx *layout.Context) {
|
||||
sz := gtx.Px(unit.Dp(200))
|
||||
cs := gtx.Constraints
|
||||
gtx.Constraints = layout.RigidConstraints(cs.Constrain(image.Point{X: sz, Y: sz}))
|
||||
theme.Editor("Hint").Layout(gtx, u.edit)
|
||||
material.Editor(theme, "Hint").Layout(gtx, u.edit)
|
||||
})
|
||||
}),
|
||||
layout.Rigid(func() {
|
||||
gtx.Constraints.Width.Min = gtx.Constraints.Width.Max
|
||||
in := layout.Inset{Bottom: unit.Dp(16), Left: unit.Dp(16), Right: unit.Dp(16)}
|
||||
in.Layout(gtx, func() {
|
||||
e := theme.Editor("Hint")
|
||||
e := material.Editor(theme, "Hint")
|
||||
e.TextSize = unit.Sp(14)
|
||||
e.Font.Style = text.Italic
|
||||
e.Layout(gtx, u.edit2)
|
||||
@@ -223,7 +223,7 @@ func (u *UI) layoutUsers(gtx *layout.Context) {
|
||||
layout.Stacked(func() {
|
||||
in := layout.Inset{Top: unit.Dp(16), Right: unit.Dp(8), Bottom: unit.Dp(8), Left: unit.Dp(8)}
|
||||
in.Layout(gtx, func() {
|
||||
lbl := theme.Caption("GOPHERS")
|
||||
lbl := material.Caption(theme, "GOPHERS")
|
||||
lbl.Color = rgb(0x888888)
|
||||
lbl.Layout(gtx)
|
||||
})
|
||||
@@ -241,7 +241,7 @@ func (u *UI) layoutUsers(gtx *layout.Context) {
|
||||
in.Layout(gtx, func() {
|
||||
for u.fab.Clicked(gtx) {
|
||||
}
|
||||
theme.IconButton(u.fabIcon).Layout(gtx, u.fab)
|
||||
material.IconButton(theme, u.fabIcon).Layout(gtx, u.fab)
|
||||
})
|
||||
}),
|
||||
)
|
||||
@@ -279,13 +279,13 @@ func (u *UI) user(gtx *layout.Context, index int) {
|
||||
layout.Rigid(func() {
|
||||
baseline().Layout(gtx,
|
||||
layout.Rigid(func() {
|
||||
theme.Body1(user.name).Layout(gtx)
|
||||
material.Body1(theme, user.name).Layout(gtx)
|
||||
}),
|
||||
layout.Flexed(1, func() {
|
||||
gtx.Constraints.Width.Min = gtx.Constraints.Width.Max
|
||||
layout.E.Layout(gtx, func() {
|
||||
layout.Inset{Left: unit.Dp(2)}.Layout(gtx, func() {
|
||||
theme.Caption("3 hours ago").Layout(gtx)
|
||||
material.Caption(theme, "3 hours ago").Layout(gtx)
|
||||
})
|
||||
})
|
||||
}),
|
||||
@@ -294,7 +294,7 @@ func (u *UI) user(gtx *layout.Context, index int) {
|
||||
layout.Rigid(func() {
|
||||
in := layout.Inset{Top: unit.Dp(4)}
|
||||
in.Layout(gtx, func() {
|
||||
lbl := theme.Caption(user.company)
|
||||
lbl := material.Caption(theme, user.company)
|
||||
lbl.Color = rgb(0xbbbbbb)
|
||||
lbl.Layout(gtx)
|
||||
})
|
||||
@@ -315,7 +315,7 @@ func (u *user) layoutAvatar(gtx *layout.Context) {
|
||||
draw.ApproxBiLinear.Scale(img, img.Bounds(), u.avatar, u.avatar.Bounds(), draw.Src, nil)
|
||||
u.avatarOp = paint.NewImageOp(img)
|
||||
}
|
||||
img := theme.Image(u.avatarOp)
|
||||
img := widget.Image{Src: u.avatarOp}
|
||||
img.Scale = float32(sz) / float32(gtx.Px(unit.Dp(float32(sz))))
|
||||
img.Layout(gtx)
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ func loop(w *app.Window) error {
|
||||
return e.Err
|
||||
case system.FrameEvent:
|
||||
gtx.Reset(e.Config, e.Size)
|
||||
l := th.H1("Hello, Gio")
|
||||
l := material.H1(th, "Hello, Gio")
|
||||
maroon := color.RGBA{127, 0, 0, 255}
|
||||
l.Color = maroon
|
||||
l.Alignment = text.Middle
|
||||
|
||||
+15
-16
@@ -43,7 +43,7 @@ type iconAndTextButton struct {
|
||||
func main() {
|
||||
flag.Parse()
|
||||
editor.SetText(longText)
|
||||
ic, err := material.NewIcon(icons.ContentAdd)
|
||||
ic, err := widget.NewIcon(icons.ContentAdd)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@@ -140,12 +140,12 @@ var (
|
||||
progressIncrementer chan int
|
||||
green = true
|
||||
topLabel = "Hello, Gio"
|
||||
icon *material.Icon
|
||||
icon *widget.Icon
|
||||
checkbox = new(widget.CheckBox)
|
||||
)
|
||||
|
||||
func (b iconAndTextButton) Layout(gtx *layout.Context, button *widget.Button, icon *material.Icon, word string) {
|
||||
b.theme.ButtonLayout().Layout(gtx, button, func() {
|
||||
func (b iconAndTextButton) Layout(gtx *layout.Context, button *widget.Button, icon *widget.Icon, word string) {
|
||||
material.ButtonLayout(b.theme).Layout(gtx, button, func() {
|
||||
iconAndLabel := layout.Flex{Axis: layout.Horizontal, Alignment: layout.Middle}
|
||||
textIconSpacer := unit.Dp(5)
|
||||
|
||||
@@ -174,14 +174,14 @@ func (b iconAndTextButton) Layout(gtx *layout.Context, button *widget.Button, ic
|
||||
func kitchen(gtx *layout.Context, th *material.Theme) {
|
||||
widgets := []func(){
|
||||
func() {
|
||||
th.H3(topLabel).Layout(gtx)
|
||||
material.H3(th, topLabel).Layout(gtx)
|
||||
},
|
||||
func() {
|
||||
gtx.Constraints.Height.Max = gtx.Px(unit.Dp(200))
|
||||
th.Editor("Hint").Layout(gtx, editor)
|
||||
material.Editor(th, "Hint").Layout(gtx, editor)
|
||||
},
|
||||
func() {
|
||||
e := th.Editor("Hint")
|
||||
e := material.Editor(th, "Hint")
|
||||
e.Font.Style = text.Italic
|
||||
e.Layout(gtx, lineEditor)
|
||||
for _, e := range lineEditor.Events(gtx) {
|
||||
@@ -196,7 +196,7 @@ func kitchen(gtx *layout.Context, th *material.Theme) {
|
||||
layout.Flex{Alignment: layout.Middle}.Layout(gtx,
|
||||
layout.Rigid(func() {
|
||||
in.Layout(gtx, func() {
|
||||
th.IconButton(icon).Layout(gtx, iconButton)
|
||||
material.IconButton(th, icon).Layout(gtx, iconButton)
|
||||
})
|
||||
}),
|
||||
layout.Rigid(func() {
|
||||
@@ -209,13 +209,12 @@ func kitchen(gtx *layout.Context, th *material.Theme) {
|
||||
for button.Clicked(gtx) {
|
||||
green = !green
|
||||
}
|
||||
th.Button("Click me!").Layout(gtx, button)
|
||||
material.Button(th, "Click me!").Layout(gtx, button)
|
||||
})
|
||||
}),
|
||||
layout.Rigid(func() {
|
||||
in.Layout(gtx, func() {
|
||||
var btn material.Button
|
||||
btn = th.Button("Green button")
|
||||
btn := material.Button(th, "Green button")
|
||||
if green {
|
||||
btn.Background = color.RGBA{A: 0xff, R: 0x9e, G: 0x9d, B: 0x24}
|
||||
}
|
||||
@@ -225,21 +224,21 @@ func kitchen(gtx *layout.Context, th *material.Theme) {
|
||||
)
|
||||
},
|
||||
func() {
|
||||
th.ProgressBar().Layout(gtx, progress)
|
||||
material.ProgressBar(th).Layout(gtx, progress)
|
||||
},
|
||||
func() {
|
||||
th.CheckBox("Checkbox").Layout(gtx, checkbox)
|
||||
material.CheckBox(th, "Checkbox").Layout(gtx, checkbox)
|
||||
},
|
||||
func() {
|
||||
layout.Flex{}.Layout(gtx,
|
||||
layout.Rigid(func() {
|
||||
th.RadioButton("r1", "RadioButton1").Layout(gtx, radioButtonsGroup)
|
||||
material.RadioButton(th, "r1", "RadioButton1").Layout(gtx, radioButtonsGroup)
|
||||
}),
|
||||
layout.Rigid(func() {
|
||||
th.RadioButton("r2", "RadioButton2").Layout(gtx, radioButtonsGroup)
|
||||
material.RadioButton(th, "r2", "RadioButton2").Layout(gtx, radioButtonsGroup)
|
||||
}),
|
||||
layout.Rigid(func() {
|
||||
th.RadioButton("r3", "RadioButton3").Layout(gtx, radioButtonsGroup)
|
||||
material.RadioButton(th, "r3", "RadioButton3").Layout(gtx, radioButtonsGroup)
|
||||
}),
|
||||
)
|
||||
},
|
||||
|
||||
@@ -79,7 +79,7 @@ func drawTabs(gtx *layout.Context, th *material.Theme) {
|
||||
var tabWidth int
|
||||
layout.Stack{Alignment: layout.S}.Layout(gtx,
|
||||
layout.Stacked(func() {
|
||||
tabBtn := th.Button(t.Title)
|
||||
tabBtn := material.Button(th, t.Title)
|
||||
tabBtn.Background = color.RGBA{} // No background.
|
||||
tabBtn.CornerRadius = unit.Value{} // No corners.
|
||||
tabBtn.Color = color.RGBA{A: 0xff} // Black text.
|
||||
@@ -108,7 +108,7 @@ func drawTabs(gtx *layout.Context, th *material.Theme) {
|
||||
}),
|
||||
layout.Flexed(1, func() {
|
||||
layout.Center.Layout(gtx, func() {
|
||||
th.H1(fmt.Sprintf("Tab content #%d", tabs.selected)).Layout(gtx)
|
||||
material.H1(th, fmt.Sprintf("Tab content #%d", tabs.selected)).Layout(gtx)
|
||||
})
|
||||
}),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user