mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 09:55:40 +00:00
apps: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ module gioui.org/apps
|
|||||||
go 1.13
|
go 1.13
|
||||||
|
|
||||||
require (
|
require (
|
||||||
gioui.org v0.0.0-20191005092226-b4a52d301013
|
gioui.org v0.0.0-20191005202732-2097c6475da9
|
||||||
github.com/google/go-github/v24 v24.0.1
|
github.com/google/go-github/v24 v24.0.1
|
||||||
golang.org/x/exp v0.0.0-20190627132806-fd42eb6b336f
|
golang.org/x/exp v0.0.0-20190627132806-fd42eb6b336f
|
||||||
golang.org/x/image v0.0.0-20190703141733-d6a02ce849c9
|
golang.org/x/image v0.0.0-20190703141733-d6a02ce849c9
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
gioui.org v0.0.0-20191005092226-b4a52d301013 h1:G4Mf6/6BEmE2j6poDpANVdWZ5+JM3wzgR55OqvVIo7k=
|
gioui.org v0.0.0-20191005202732-2097c6475da9 h1:ussyIS8IC0ekvvIdaltbV1MsHfCCDt4W5HICqRNEQvk=
|
||||||
gioui.org v0.0.0-20191005092226-b4a52d301013/go.mod h1:+CEjc9B//HrBfWsQOVxjCyih7HGIj3Pww1xFHVDZyyk=
|
gioui.org v0.0.0-20191005202732-2097c6475da9/go.mod h1:+CEjc9B//HrBfWsQOVxjCyih7HGIj3Pww1xFHVDZyyk=
|
||||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
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 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
|||||||
+26
-15
@@ -42,7 +42,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type UI struct {
|
type UI struct {
|
||||||
faces shape.Faces
|
family *shape.Family
|
||||||
|
mono *shape.Family
|
||||||
fab *ActionButton
|
fab *ActionButton
|
||||||
usersList *layout.List
|
usersList *layout.List
|
||||||
users []*user
|
users []*user
|
||||||
@@ -58,7 +59,7 @@ type UI struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type userPage struct {
|
type userPage struct {
|
||||||
faces shape.Faces
|
family *shape.Family
|
||||||
user *user
|
user *user
|
||||||
commitsList *layout.List
|
commitsList *layout.List
|
||||||
commits []*github.Commit
|
commits []*github.Commit
|
||||||
@@ -123,6 +124,14 @@ func init() {
|
|||||||
func newUI(fetchCommits func(string)) *UI {
|
func newUI(fetchCommits func(string)) *UI {
|
||||||
u := &UI{
|
u := &UI{
|
||||||
fetchCommits: fetchCommits,
|
fetchCommits: fetchCommits,
|
||||||
|
family: &shape.Family{
|
||||||
|
Regular: fonts.regular,
|
||||||
|
Italic: fonts.italic,
|
||||||
|
Bold: fonts.bold,
|
||||||
|
},
|
||||||
|
mono: &shape.Family{
|
||||||
|
Regular: fonts.mono,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
u.usersList = &layout.List{
|
u.usersList = &layout.List{
|
||||||
Axis: layout.Vertical,
|
Axis: layout.Vertical,
|
||||||
@@ -132,7 +141,10 @@ func newUI(fetchCommits func(string)) *UI {
|
|||||||
icons: []*icon{},
|
icons: []*icon{},
|
||||||
}
|
}
|
||||||
u.edit2 = &text.Editor{
|
u.edit2 = &text.Editor{
|
||||||
Face: u.faces.For(fonts.italic),
|
Family: u.family,
|
||||||
|
Face: text.Face{
|
||||||
|
Style: text.Italic,
|
||||||
|
},
|
||||||
Size: unit.Sp(14),
|
Size: unit.Sp(14),
|
||||||
//Alignment: text.End,
|
//Alignment: text.End,
|
||||||
SingleLine: true,
|
SingleLine: true,
|
||||||
@@ -142,7 +154,7 @@ func newUI(fetchCommits func(string)) *UI {
|
|||||||
}
|
}
|
||||||
u.edit2.SetText("Single line editor. Edit me!")
|
u.edit2.SetText("Single line editor. Edit me!")
|
||||||
u.edit = &text.Editor{
|
u.edit = &text.Editor{
|
||||||
Face: u.faces.For(fonts.regular),
|
Family: u.family,
|
||||||
Size: unit.Sp(16),
|
Size: unit.Sp(16),
|
||||||
Material: theme.text,
|
Material: theme.text,
|
||||||
//Alignment: text.End,
|
//Alignment: text.End,
|
||||||
@@ -185,13 +197,12 @@ func (u *UI) layoutTimings(gtx *layout.Context) {
|
|||||||
layout.Align(layout.NE).Layout(gtx, func() {
|
layout.Align(layout.NE).Layout(gtx, func() {
|
||||||
layout.Inset{Top: unit.Dp(16)}.Layout(gtx, func() {
|
layout.Inset{Top: unit.Dp(16)}.Layout(gtx, func() {
|
||||||
txt := fmt.Sprintf("m: %d %s", mallocs, u.profile.Timings)
|
txt := fmt.Sprintf("m: %d %s", mallocs, u.profile.Timings)
|
||||||
text.Label{Material: theme.text, Face: u.faces.For(fonts.mono), Size: unit.Sp(10), Text: txt}.Layout(gtx)
|
text.Label{Material: theme.text, Size: unit.Sp(10), Text: txt}.Layout(gtx, u.mono)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UI) Layout(gtx *layout.Context) {
|
func (u *UI) Layout(gtx *layout.Context) {
|
||||||
u.faces.Reset()
|
|
||||||
for i := range u.userClicks {
|
for i := range u.userClicks {
|
||||||
click := &u.userClicks[i]
|
click := &u.userClicks[i]
|
||||||
for _, e := range click.Events(gtx) {
|
for _, e := range click.Events(gtx) {
|
||||||
@@ -210,7 +221,7 @@ func (u *UI) Layout(gtx *layout.Context) {
|
|||||||
|
|
||||||
func (u *UI) newUserPage(user *user) *userPage {
|
func (u *UI) newUserPage(user *user) *userPage {
|
||||||
up := &userPage{
|
up := &userPage{
|
||||||
faces: u.faces,
|
family: u.family,
|
||||||
user: user,
|
user: user,
|
||||||
commitsList: &layout.List{Axis: layout.Vertical},
|
commitsList: &layout.List{Axis: layout.Vertical},
|
||||||
}
|
}
|
||||||
@@ -231,7 +242,7 @@ func (up *userPage) Layout(gtx *layout.Context) {
|
|||||||
func (up *userPage) commit(gtx *layout.Context, index int) {
|
func (up *userPage) commit(gtx *layout.Context, index int) {
|
||||||
u := up.user
|
u := up.user
|
||||||
msg := up.commits[index].GetMessage()
|
msg := up.commits[index].GetMessage()
|
||||||
label := text.Label{Material: theme.text, Face: up.faces.For(fonts.regular), Size: unit.Sp(12), Text: msg}
|
label := text.Label{Material: theme.text, Size: unit.Sp(12), Text: msg}
|
||||||
in := layout.Inset{Top: unit.Dp(16), Right: unit.Dp(8), Left: unit.Dp(8)}
|
in := layout.Inset{Top: unit.Dp(16), Right: unit.Dp(8), Left: unit.Dp(8)}
|
||||||
in.Layout(gtx, func() {
|
in.Layout(gtx, func() {
|
||||||
f := (&layout.Flex{Axis: layout.Horizontal}).Init(gtx)
|
f := (&layout.Flex{Axis: layout.Horizontal}).Init(gtx)
|
||||||
@@ -246,7 +257,7 @@ func (up *userPage) commit(gtx *layout.Context, index int) {
|
|||||||
c2 := f.Flexible(1, func() {
|
c2 := f.Flexible(1, func() {
|
||||||
gtx.Constraints.Width.Min = gtx.Constraints.Width.Max
|
gtx.Constraints.Width.Min = gtx.Constraints.Width.Max
|
||||||
layout.Inset{Left: unit.Dp(8)}.Layout(gtx, func() {
|
layout.Inset{Left: unit.Dp(8)}.Layout(gtx, func() {
|
||||||
label.Layout(gtx)
|
label.Layout(gtx, up.family)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
f.Layout(c1, c2)
|
f.Layout(c1, c2)
|
||||||
@@ -293,8 +304,8 @@ func (u *UI) layoutUsers(gtx *layout.Context) {
|
|||||||
grey := colorMaterial(gtx.Ops, rgb(0x888888))
|
grey := colorMaterial(gtx.Ops, rgb(0x888888))
|
||||||
in := layout.Inset{Top: unit.Dp(16), Right: unit.Dp(8), Bottom: unit.Dp(8), Left: unit.Dp(8)}
|
in := layout.Inset{Top: unit.Dp(16), Right: unit.Dp(8), Bottom: unit.Dp(8), Left: unit.Dp(8)}
|
||||||
in.Layout(gtx, func() {
|
in.Layout(gtx, func() {
|
||||||
lbl := text.Label{Material: grey, Face: u.faces.For(fonts.regular), Size: unit.Sp(11), Text: "GOPHERS"}
|
lbl := text.Label{Material: grey, Size: unit.Sp(11), Text: "GOPHERS"}
|
||||||
lbl.Layout(gtx)
|
lbl.Layout(gtx, u.family)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
c1 := s.Expand(func() {
|
c1 := s.Expand(func() {
|
||||||
@@ -360,14 +371,14 @@ func (u *UI) user(gtx *layout.Context, index int) {
|
|||||||
f := baseline()
|
f := baseline()
|
||||||
f.Init(gtx)
|
f.Init(gtx)
|
||||||
c1 := f.Rigid(func() {
|
c1 := f.Rigid(func() {
|
||||||
text.Label{Material: theme.text, Face: u.faces.For(fonts.regular), Size: unit.Sp(13), Text: user.name}.Layout(gtx)
|
text.Label{Material: theme.text, Size: unit.Sp(13), Text: user.name}.Layout(gtx, u.family)
|
||||||
})
|
})
|
||||||
c2 := f.Flexible(1, func() {
|
c2 := f.Flexible(1, func() {
|
||||||
gtx.Constraints.Width.Min = gtx.Constraints.Width.Max
|
gtx.Constraints.Width.Min = gtx.Constraints.Width.Max
|
||||||
layout.Align(layout.E).Layout(gtx, func() {
|
layout.Align(layout.E).Layout(gtx, func() {
|
||||||
layout.Inset{Left: unit.Dp(2)}.Layout(gtx, func() {
|
layout.Inset{Left: unit.Dp(2)}.Layout(gtx, func() {
|
||||||
lbl := text.Label{Material: theme.text, Face: u.faces.For(fonts.regular), Size: unit.Sp(10), Text: "3 hours ago"}
|
lbl := text.Label{Material: theme.text, Size: unit.Sp(10), Text: "3 hours ago"}
|
||||||
lbl.Layout(gtx)
|
lbl.Layout(gtx, u.family)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -376,7 +387,7 @@ func (u *UI) user(gtx *layout.Context, index int) {
|
|||||||
c2 := f.Rigid(func() {
|
c2 := f.Rigid(func() {
|
||||||
in := layout.Inset{Top: unit.Dp(4)}
|
in := layout.Inset{Top: unit.Dp(4)}
|
||||||
in.Layout(gtx, func() {
|
in.Layout(gtx, func() {
|
||||||
text.Label{Material: theme.tertText, Face: u.faces.For(fonts.regular), Size: unit.Sp(12), Text: user.company}.Layout(gtx)
|
text.Label{Material: theme.tertText, Size: unit.Sp(12), Text: user.company}.Layout(gtx, u.family)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
f.Layout(c1, c2)
|
f.Layout(c1, c2)
|
||||||
|
|||||||
+4
-4
@@ -35,9 +35,10 @@ func loop(w *app.Window) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic("failed to load font")
|
panic("failed to load font")
|
||||||
}
|
}
|
||||||
var faces shape.Faces
|
family := &shape.Family{
|
||||||
|
Regular: regular,
|
||||||
|
}
|
||||||
maroon := color.RGBA{127, 0, 0, 255}
|
maroon := color.RGBA{127, 0, 0, 255}
|
||||||
face := faces.For(regular)
|
|
||||||
message := "Hello, Gio"
|
message := "Hello, Gio"
|
||||||
gtx := &layout.Context{
|
gtx := &layout.Context{
|
||||||
Queue: w.Queue(),
|
Queue: w.Queue(),
|
||||||
@@ -49,12 +50,11 @@ func loop(w *app.Window) error {
|
|||||||
return e.Err
|
return e.Err
|
||||||
case app.UpdateEvent:
|
case app.UpdateEvent:
|
||||||
gtx.Reset(&e.Config, e.Size)
|
gtx.Reset(&e.Config, e.Size)
|
||||||
faces.Reset()
|
|
||||||
var material op.MacroOp
|
var material op.MacroOp
|
||||||
material.Record(gtx.Ops)
|
material.Record(gtx.Ops)
|
||||||
paint.ColorOp{Color: maroon}.Add(gtx.Ops)
|
paint.ColorOp{Color: maroon}.Add(gtx.Ops)
|
||||||
material.Stop()
|
material.Stop()
|
||||||
text.Label{Material: material, Face: face, Size: unit.Sp(72), Alignment: text.Middle, Text: message}.Layout(gtx)
|
text.Label{Material: material, Size: unit.Sp(72), Alignment: text.Middle, Text: message}.Layout(gtx, family)
|
||||||
w.Update(gtx.Ops)
|
w.Update(gtx.Ops)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user