apps/gophers: update to new layout.Align

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-09-24 20:35:32 +02:00
parent 2f878fe154
commit b928ee65f7
3 changed files with 8 additions and 12 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ module gioui.org/apps
go 1.13
require (
gioui.org/ui v0.0.0-20190924170607-ce9bcee62baa
gioui.org/ui v0.0.0-20190924183214-2f878fe154d1
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
+2 -2
View File
@@ -1,6 +1,6 @@
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
gioui.org/ui v0.0.0-20190924170607-ce9bcee62baa h1:UnTUUkrSJzS9bncaNAf6AhjBfrdSz/0q/nFq5AgPw2U=
gioui.org/ui v0.0.0-20190924170607-ce9bcee62baa/go.mod h1:PssKPKlqVIeyaed+0w492Xc2NgX5M3n6oZKOAj5rxoE=
gioui.org/ui v0.0.0-20190924183214-2f878fe154d1 h1:9R7EDPuwyF9dFfGLC6vZ9mL86eYIGlEBwzkHHo0/Ze0=
gioui.org/ui v0.0.0-20190924183214-2f878fe154d1/go.mod h1:PssKPKlqVIeyaed+0w492Xc2NgX5M3n6oZKOAj5rxoE=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+5 -9
View File
@@ -186,8 +186,7 @@ func (u *UI) layoutTimings(c ui.Config, q input.Queue, ops *ui.Ops, ctx *layout.
runtime.ReadMemStats(&mstats)
mallocs := mstats.Mallocs - u.lastMallocs
u.lastMallocs = mstats.Mallocs
al := layout.Align{Alignment: layout.NE}
al.Layout(ops, ctx, func() {
layout.Align(layout.NE).Layout(ops, ctx, func() {
layout.Inset{Top: ui.Dp(16)}.Layout(c, ops, ctx, func() {
txt := fmt.Sprintf("m: %d %s", mallocs, u.profile.Timings)
text.Label{Material: theme.text, Face: u.face(fonts.mono, 10), Text: txt}.Layout(ops, ctx)
@@ -261,8 +260,7 @@ func (up *userPage) commit(c ui.Config, ops *ui.Ops, ctx *layout.Context, index
func (u *UI) layoutUsers(c ui.Config, q input.Queue, ops *ui.Ops, ctx *layout.Context) {
st := (&layout.Stack{}).Init(ops, ctx)
c2 := st.Rigid(func() {
al := layout.Align{Alignment: layout.SE}
al.Layout(ops, ctx, func() {
layout.Align(layout.SE).Layout(ops, ctx, func() {
in := layout.UniformInset(ui.Dp(16))
in.Layout(c, ops, ctx, func() {
u.fab.Layout(c, q, ops, ctx)
@@ -370,11 +368,9 @@ func (u *UI) user(c ui.Config, ops *ui.Ops, ctx *layout.Context, index int) {
})
c2 := f.Flexible(1, func() {
ctx.Constraints.Width.Min = ctx.Constraints.Width.Max
al := layout.Align{Alignment: layout.E}
in := layout.Inset{Left: ui.Dp(2)}
lbl := text.Label{Material: theme.text, Face: u.face(fonts.regular, 10), Text: "3 hours ago"}
al.Layout(ops, ctx, func() {
in.Layout(c, ops, ctx, func() {
layout.Align(layout.E).Layout(ops, ctx, func() {
layout.Inset{Left: ui.Dp(2)}.Layout(c, ops, ctx, func() {
lbl := text.Label{Material: theme.text, Face: u.face(fonts.regular, 10), Text: "3 hours ago"}
lbl.Layout(ops, ctx)
})
})