package ui import ( t_ui "icdb/pkg/types/ui" "gioui.org/app" "gioui.org/layout" "gioui.org/op" "gioui.org/unit" "gioui.org/widget/material" ) var currentView t_ui.UIView = t_ui.UIViewMain // run takes a window as parameter and runs the UI on it. func run(window *app.Window) error { theme := material.NewTheme() var ops op.Ops for { switch e := window.Event().(type) { case app.DestroyEvent: return e.Err case app.FrameEvent: gtx := app.NewContext(&ops, e) margins := layout.Inset{ Top: unit.Dp(10), Bottom: unit.Dp(10), Left: unit.Dp(10), Right: unit.Dp(10), } margins.Layout(gtx, func(gtx layout.Context) layout.Dimensions { return layout.Flex{ Axis: layout.Horizontal, }.Layout(gtx, layout.Rigid(renderSidebar(theme)), layout.Flexed(1, renderView(theme)), ) }) e.Frame(gtx.Ops) } } }