app: start building up a layout
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2022-05-21 01:18:06 +02:00
parent 9d29017860
commit 3839735dc8
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

@ -4,7 +4,10 @@
package xkcdreader package xkcdreader
import ( import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app" "fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/layout"
"fyne.io/fyne/v2/widget" "fyne.io/fyne/v2/widget"
"git.dotya.ml/wanderer/go-xkcdreader/cmd" "git.dotya.ml/wanderer/go-xkcdreader/cmd"
) )
@ -16,12 +19,16 @@ func RunApp() {
a := app.New() a := app.New()
w := a.NewWindow(cmd.GetAppName()) w := a.NewWindow(cmd.GetAppName())
w.SetContent(makeGreeting()) centered := container.New(layout.NewHBoxLayout(), layout.NewSpacer(), makeGreeting(), layout.NewSpacer())
w.SetContent(container.New(layout.NewVBoxLayout(), centered))
w.Resize(fyne.NewSize(400, 400))
w.ShowAndRun() w.ShowAndRun()
} }
// makeGreeting creates a greeting label // makeGreeting creates a greeting label
func makeGreeting() *widget.Label { func makeGreeting() *widget.Label {
return widget.NewLabel(appGreeting) w := widget.NewLabel(appGreeting)
w.TextStyle.Monospace = true
return w
} }