apps/gophers: update to simpler Flex.Flexible method

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-07-11 18:46:58 +02:00
parent 449c2b844a
commit 9f394109cb
2 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ module gioui.org/apps
go 1.12
require (
gioui.org/ui v0.0.0-20190711160716-fe4a61ec890f
gioui.org/ui v0.0.0-20190711164444-449c2b844a40
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
+7 -3
View File
@@ -450,7 +450,8 @@ func (up *userPage) commit(ops *ui.Ops, cs layout.Constraints, index int) layout
dims := widget.Image{Src: u.avatar, Rect: u.avatar.Bounds()}.Layout(c, ops, cs)
dims = cc.End(dims)
c1 := f.End(dims)
cs = f.Flexible(1, layout.Fit)
cs = f.Flexible(1)
cs.Width.Min = cs.Width.Max
in2 := layout.Insets{Left: ui.Dp(8)}
cs = in2.Begin(c, ops, cs)
dims = label.Layout(ops, cs)
@@ -529,7 +530,9 @@ func (a *App) layoutUsers(ops *ui.Ops, cs layout.Constraints) layout.Dimens {
}
c3 := f.End(dims)
dims = a.layoutContributors(ops, f.Flexible(1, layout.Fit))
cs = f.Flexible(1)
cs.Width.Min = cs.Width.Max
dims = a.layoutContributors(ops, cs)
c4 := f.End(dims)
dims = f.Layout(c1, c2, c3, c4)
}
@@ -604,7 +607,8 @@ func (a *App) user(c ui.Config, ops *ui.Ops, cs layout.Constraints, index int) l
cs = f.Rigid()
dims = text.Label{Material: theme.text, Face: a.face(fonts.regular, 13), Text: u.name}.Layout(ops, cs)
c1 := f.End(dims)
cs = f.Flexible(1, layout.Fit)
cs = f.Flexible(1)
cs.Width.Min = cs.Width.Max
al := layout.Align{Alignment: layout.E}
in := layout.Insets{Left: ui.Dp(2)}
cs = in.Begin(c, ops, al.Begin(ops, cs))