@@ 16,6 16,7 @@ import (
"gioui.org/io/system"
"gioui.org/layout"
"gioui.org/op"
+ "gioui.org/op/clip"
"gioui.org/op/paint"
"gioui.org/text"
"gioui.org/unit"
@@ 24,7 25,9 @@ import (
"github.com/skip2/go-qrcode"
- _ "gioui.org/font/gofont"
+ xlayout "eliasnaur.com/giox/layout"
+
+ "gioui.org/font/gofont"
)
type fill color.RGBA
@@ 34,6 37,7 @@ var (
)
func init() {
+ gofont.Register()
theme = material.NewTheme()
theme.Color.Primary = rgb(0x1b5e20)
//theme.TextSize = unit.Sp(20)
@@ 78,9 82,7 @@ func NewApp() *App {
func runUI() {
a := NewApp()
w := app.NewWindow()
- gtx := &layout.Context{
- Queue: w.Queue(),
- }
+ gtx := layout.NewContext(w.Queue())
for {
select {
case e := <-a.wallet.events:
@@ 106,7 108,7 @@ func runUI() {
}
func (a *App) Layout(gtx *layout.Context) {
- layout.Format(gtx, "stack(southeast, r(max(_)), r(inset(16dp, _)))",
+ xlayout.Format(gtx, "stack(southeast, r(max(_)), r(inset(16dp, _)))",
func() {
a.layoutMain(gtx)
},
@@ 118,10 120,10 @@ func (a *App) Layout(gtx *layout.Context) {
},
)
if a.showQR {
- layout.Format(gtx, "center(inset(16dp, _))",
+ xlayout.Format(gtx, "center(inset(16dp, _))",
func() {
Corners(unit.Dp(10)).Layout(gtx, func() {
- layout.Format(gtx, "stack(center, r(_), e(min(inset(16dp, south(_)))))",
+ xlayout.Format(gtx, "stack(center, r(_), e(min(inset(16dp, south(_)))))",
func() {
sz := gtx.Constraints.Width.Constrain(gtx.Px(unit.Dp(500)))
a.addrQR.Add(gtx.Ops)
@@ 156,7 158,7 @@ func (a *App) layoutMain(gtx *layout.Context) {
r(_)
)
`
- layout.Format(gtx, f,
+ xlayout.Format(gtx, f,
func() {
fill(rgb(0x1b5e20)).Layout(gtx)
},
@@ 211,7 213,7 @@ func (a *App) layoutTrans(gtx *layout.Context) {
r(_)
)
)`
- layout.Format(gtx, f,
+ xlayout.Format(gtx, f,
func() {
tim := theme.Body1(t.FormatTime())
tim.Color = alpha(a, tim.Color)
@@ 261,7 263,7 @@ func (c Corners) Layout(gtx *layout.Context, w layout.Widget) {
var stack op.StackOp
stack.Push(gtx.Ops)
rrect(gtx.Ops, float32(sz.X), float32(sz.Y), rr, rr, rr, rr)
- macro.Add(gtx.Ops)
+ macro.Add()
stack.Pop()
}
@@ 288,7 290,7 @@ func (f fill) Layout(gtx *layout.Context) {
func rrect(ops *op.Ops, width, height, se, sw, nw, ne float32) {
w, h := float32(width), float32(height)
const c = 0.55228475 // 4*(sqrt(2)-1)/3
- var b paint.Path
+ var b clip.Path
b.Begin(ops)
b.Move(f32.Point{X: w, Y: h - se})
b.Cube(f32.Point{X: 0, Y: se * c}, f32.Point{X: -se + se*c, Y: se}, f32.Point{X: -se, Y: se}) // SE