-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheditor.go
More file actions
37 lines (34 loc) · 749 Bytes
/
editor.go
File metadata and controls
37 lines (34 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"gioui.org/app"
"gioui.org/io/system"
"gioui.org/layout"
"gioui.org/op"
"gioui.org/unit"
"gioui.org/widget"
"gioui.org/widget/material"
"gioui.org/font/gofont"
)
func main() {
go func() {
w := app.NewWindow()
th := material.NewTheme(gofont.Collection())
// START INIT OMIT
editor := new(widget.Editor)
editor.SetText("Hello, Gophers! Edit me.")
// END INIT OMIT
var ops op.Ops
for e := range w.Events() {
if e, ok := e.(system.FrameEvent); ok {
gtx := layout.NewContext(&ops, e) // HLdraw
// START OMIT
ed := material.Editor(th, editor, "Hint")
ed.TextSize = unit.Sp(52)
ed.Layout(gtx)
// END OMIT
e.Frame(gtx.Ops) // HLdraw
}
} // HLeventloop
}()
app.Main()
}