~eliasnaur/gio

bde04c68a251b4f77dfe30b02ccbbf5e0e24468e — Elias Naur 2 years ago 25af3e3
apps/gophers: update to Constraint.Exact method

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2 files changed, 6 insertions(+), 5 deletions(-)

M apps/go.mod
M apps/gophers/main.go
M apps/go.mod => apps/go.mod +1 -1
@@ 3,7 3,7 @@ module gioui.org/apps
go 1.12

require (
	gioui.org/ui v0.0.0-20190709140002-b1af8aa75e5e
	gioui.org/ui v0.0.0-20190710091845-25af3e3701de
	github.com/google/go-github/v24 v24.0.1
	golang.org/x/exp v0.0.0-20190627132806-fd42eb6b336f
	golang.org/x/image v0.0.0-20190703141733-d6a02ce849c9

M apps/gophers/main.go => apps/gophers/main.go +5 -4
@@ 448,10 448,10 @@ func (up *userPage) commit(ops *ui.Ops, cs layout.Constraints, index int) layout
	cs = in.Begin(c, ops, cs)
	f := (&layout.Flex{Axis: layout.Horizontal, MainAxisAlignment: layout.Start, CrossAxisAlignment: layout.Start}).Init(ops, cs)
	cs = f.Rigid()
	sz := ui.Dp(48)
	sz := int(c.Dp(48)+.5)
	cc := clipCircle{}
	cs = cc.Begin(ops, cs)
	cs = layout.Sized{Width: sz, Height: sz}.Constrain(c, cs)
	cs = cs.Exact(sz, sz)
	dims := widget.Image{Src: u.avatar, Rect: u.avatar.Bounds(), Scale: 1}.Layout(c, ops, cs)
	dims = cc.End(dims)
	c1 := f.End(dims)


@@ 504,7 504,8 @@ func (a *App) layoutUsers(ops *ui.Ops, cs layout.Constraints) layout.Dimens {
		cs = f.Rigid()
		{
			in := layout.EqualInsets(ui.Dp(16))
			cs = layout.Sized{Height: ui.Dp(200)}.Constrain(c, cs)
			sz := int(c.Dp(200)+.5)
			cs = cs.Exact(sz, sz)
			dims = a.edit.Layout(ops, in.Begin(c, ops, cs))
			dims = in.End(dims)
		}


@@ 598,7 599,7 @@ func (a *App) user(ops *ui.Ops, cs layout.Constraints, c *ui.Config, index int) 
			in := layout.Insets{Right: ui.Dp(8)}
			cc := clipCircle{}
			cs = cc.Begin(ops, in.Begin(c, ops, cs))
			cs = layout.Sized{Width: ui.Dp(48), Height: ui.Dp(48)}.Constrain(c, cs)
			cs = cs.Exact(int(c.Dp(48)+.5), int(c.Dp(48)+.5))
			dims = widget.Image{Src: u.avatar, Rect: u.avatar.Bounds(), Scale: 1}.Layout(c, ops, cs)
			dims = in.End(cc.End(dims))
		}