~eliasnaur/gio

223f8fd40ae44216f4941e1f4b7fa7131518fc71 — Elias Naur 14 days ago 6ef1ff7
example/kitchen: bump gio version

Add explicit inset to ButtonLayout.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
3 files changed, 25 insertions(+), 23 deletions(-)

M example/go.mod
M example/go.sum
M example/kitchen/kitchen.go
M example/go.mod => example/go.mod +1 -1
@@ 3,7 3,7 @@ module gioui.org/example
go 1.13

require (
	gioui.org v0.0.0-20200626142042-6a9a87046221
	gioui.org v0.0.0-20200630184435-6ef1ff7cfbfb
	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

M example/go.sum => example/go.sum +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-20200626142042-6a9a87046221 h1:E3YNhsdzdBYXX3ewLaOnQsDDPsTnsohh40JX+1jwXfY=
gioui.org v0.0.0-20200626142042-6a9a87046221/go.mod h1:jiUwifN9cRl/zmco43aAqh0aV+s9GbhG13KcD+gEpkU=
gioui.org v0.0.0-20200630184435-6ef1ff7cfbfb h1:+jJBzbEtW03w0+fAfhPCwmN0/8xN1CJ94lbfV2eSKhs=
gioui.org v0.0.0-20200630184435-6ef1ff7cfbfb/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=

M example/kitchen/kitchen.go => example/kitchen/kitchen.go +22 -20
@@ 209,32 209,34 @@ type (

func (b iconAndTextButton) Layout(gtx layout.Context) layout.Dimensions {
	return material.ButtonLayout(b.theme, b.button).Layout(gtx, func(gtx C) D {
		iconAndLabel := layout.Flex{Axis: layout.Horizontal, Alignment: layout.Middle}
		textIconSpacer := unit.Dp(5)
		return layout.UniformInset(unit.Dp(12)).Layout(gtx, func(gtx C) D {
			iconAndLabel := layout.Flex{Axis: layout.Horizontal, Alignment: layout.Middle}
			textIconSpacer := unit.Dp(5)

		layIcon := layout.Rigid(func(gtx C) D {
			return layout.Inset{Right: textIconSpacer}.Layout(gtx, func(gtx C) D {
				var d D
				if icon != nil {
					size := gtx.Px(unit.Dp(56)) - 2*gtx.Px(unit.Dp(16))
					b.icon.Layout(gtx, unit.Px(float32(size)))
					d = layout.Dimensions{
						Size: image.Point{X: size, Y: size},
			layIcon := layout.Rigid(func(gtx C) D {
				return layout.Inset{Right: textIconSpacer}.Layout(gtx, func(gtx C) D {
					var d D
					if icon != nil {
						size := gtx.Px(unit.Dp(56)) - 2*gtx.Px(unit.Dp(16))
						b.icon.Layout(gtx, unit.Px(float32(size)))
						d = layout.Dimensions{
							Size: image.Point{X: size, Y: size},
						}
					}
				}
				return d
					return d
				})
			})
		})

		layLabel := layout.Rigid(func(gtx C) D {
			return layout.Inset{Left: textIconSpacer}.Layout(gtx, func(gtx C) D {
				l := material.Body1(b.theme, b.word)
				l.Color = b.theme.Color.InvText
				return l.Layout(gtx)
			layLabel := layout.Rigid(func(gtx C) D {
				return layout.Inset{Left: textIconSpacer}.Layout(gtx, func(gtx C) D {
					l := material.Body1(b.theme, b.word)
					l.Color = b.theme.Color.InvText
					return l.Layout(gtx)
				})
			})
		})

		return iconAndLabel.Layout(gtx, layIcon, layLabel)
			return iconAndLabel.Layout(gtx, layIcon, layLabel)
		})
	})
}