go-xkcdreader/xkcdreader/app.go
surtur 3839735dc8
All checks were successful
continuous-integration/drone/push Build is passing
app: start building up a layout
2022-05-21 01:18:06 +02:00

35 lines
847 B
Go

// Copyright 2022 wanderer <a_mirre at utb dot cz>
// SPDX-License-Identifier: GPL-3.0-or-later
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"
)
const appGreeting = "welcome to go-xkcdreader"
// RunApp performs sets up and runs the main application
func RunApp() {
a := app.New()
w := a.NewWindow(cmd.GetAppName())
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 {
w := widget.NewLabel(appGreeting)
w.TextStyle.Monospace = true
return w
}