Skip to content

Instantly share code, notes, and snippets.

@dolanor
Created December 16, 2019 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dolanor/e5f23896be3261a44bc634b468197e7e to your computer and use it in GitHub Desktop.
Save dolanor/e5f23896be3261a44bc634b468197e7e to your computer and use it in GitHub Desktop.
package main
import (
"gioui.org/app"
"gioui.org/font/gofont"
"gioui.org/io/system"
"gioui.org/layout"
"gioui.org/widget"
"gioui.org/widget/material"
)
func main() {
go func() {
gofont.Register()
w := app.NewWindow()
th := material.NewTheme()
gtx := layout.NewContext(w.Queue())
var button widget.Button
for e := range w.Events() {
if e, ok := e.(system.FrameEvent); ok {
gtx.Reset(e.Config, e.Size)
layout.Flex{Axis: layout.Vertical}.Layout(gtx,
layout.Rigid(func() {
th.Button("🗑").Layout(gtx, &button)
}),
)
e.Frame(gtx.Ops)
}
}
}()
app.Main()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment