Creating the layout base

This commit is contained in:
Marcel Otte 2022-03-07 23:24:02 +01:00
parent 9e1d9fb20b
commit a738650ca1
2 changed files with 47 additions and 2 deletions

View File

@ -2,13 +2,24 @@ package main
import (
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/widget"
"github.com/qwc/backive"
backiveui "github.com/qwc/backive/ui"
)
var (
config backive.Configuration
database backive.Database
)
func main() {
database.Load()
config.Load()
app := app.New()
w := app.NewWindow("Hello World!")
backiveui.Init(app, w, config, database)
w.SetContent(widget.NewLabel("Hello World!"))
//w.SetContent(widget.NewLabel("Hello World!"))
w.ShowAndRun()
}

34
ui/ui_main.go Normal file
View File

@ -0,0 +1,34 @@
package ui
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/layout"
"fyne.io/fyne/v2/widget"
"github.com/qwc/backive"
)
var (
app fyne.App
window fyne.Window
config backive.Configuration
db backive.Database
accord *widget.Accordion
center *fyne.Container
)
func Init(a fyne.App, w fyne.Window, c backive.Configuration, d backive.Database) {
app = a
window = w
config = c
db = d
SetupLayout()
}
func SetupLayout() {
accord = widget.NewAccordion()
center := container.NewMax()
content := container.New(layout.NewBorderLayout(nil, nil, accord, nil), accord, center)
window.SetContent(content)
}