From 3839735dc867be5ae298bc7d12321431a8eea512 Mon Sep 17 00:00:00 2001 From: surtur Date: Sat, 21 May 2022 01:18:06 +0200 Subject: [PATCH] app: start building up a layout --- xkcdreader/app.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xkcdreader/app.go b/xkcdreader/app.go index c7d1104..ac308b2 100644 --- a/xkcdreader/app.go +++ b/xkcdreader/app.go @@ -4,7 +4,10 @@ package xkcdreader import ( + "fyne.io/fyne/v2" "fyne.io/fyne/v2/app" + "fyne.io/fyne/v2/container" + "fyne.io/fyne/v2/layout" "fyne.io/fyne/v2/widget" "git.dotya.ml/wanderer/go-xkcdreader/cmd" ) @@ -16,12 +19,16 @@ func RunApp() { a := app.New() 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() } // makeGreeting creates a greeting label func makeGreeting() *widget.Label { - return widget.NewLabel(appGreeting) + w := widget.NewLabel(appGreeting) + w.TextStyle.Monospace = true + return w }