~whereswaldon/chipalee

bbaabdfae4c70b20d0a9ddb49732ecc0295b4af1 — Chris Waldon 1 year, 9 months ago 3f8dfb7
main: improve loading UX

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
1 files changed, 16 insertions(+), 2 deletions(-)

M main.go
M main.go => main.go +16 -2
@@ 38,6 38,7 @@ import (
	"gioui.org/op"
	"gioui.org/op/clip"
	"gioui.org/op/paint"
	"gioui.org/unit"
	"gioui.org/widget"
	"gioui.org/widget/material"
	"github.com/fogleman/ease"


@@ 350,8 351,21 @@ func run(w *app.Window) error {
				gtx := layout.NewContext(&ops, event)
				paint.Fill(gtx.Ops, color.NRGBA{A: 100})
				if !audioInit {
					material.Loader(th).Layout(gtx)
					layout.Center.Layout(gtx, material.Body1(th, "Loading...\nYou may need to click here for loading to complete.").Layout)
					layout.Flex{
						Axis:      layout.Vertical,
						Alignment: layout.Middle,
					}.Layout(gtx,
						layout.Rigid(func(gtx layout.Context) layout.Dimensions {
							gtx.Constraints = layout.Exact(image.Point{
								X: gtx.Px(unit.Dp(100)),
								Y: gtx.Px(unit.Dp(100)),
							})
							return material.Loader(th).Layout(gtx)
						}),
						layout.Rigid(func(gtx layout.Context) layout.Dimensions {
							return layout.Center.Layout(gtx, material.Body1(th, "Loading...\nYou may need to click here for loading to complete.").Layout)
						}),
					)
				} else {
					for _, event := range gtx.Events(w) {
						switch event := event.(type) {