diff options
-rw-r--r-- | gui.go | 37 |
1 files changed, 30 insertions, 7 deletions
@@ -11,6 +11,36 @@ import ( ) func (l *Limox) draw(e system.FrameEvent) { + switch l.State { + case Connected: + l.rosterView(e) + default: + l.mainView(e) + } +} + +func (l *Limox) rosterView(e system.FrameEvent) { + gtx := layout.NewContext(&l.Operations, e) + + flex := layout.Flex{ + Axis: layout.Vertical, + Spacing: layout.SpaceStart, + } + + flex.Layout(gtx, + layout.Rigid( + func(gtx layout.Context) layout.Dimensions { + btn := material.Button(l.Theme, &l.DisconnectButton, + "Disconnect") + return btn.Layout(gtx) + }, + ), + ) + + e.Frame(gtx.Ops) +} + +func (l *Limox) mainView(e system.FrameEvent) { gtx := layout.NewContext(&l.Operations, e) flex := layout.Flex{ @@ -49,13 +79,6 @@ func (l *Limox) draw(e system.FrameEvent) { return btn.Layout(gtx) }, ), - layout.Rigid( - func(gtx layout.Context) layout.Dimensions { - btn := material.Button(l.Theme, &l.DisconnectButton, - "Disconnect") - return btn.Layout(gtx) - }, - ), ) e.Frame(gtx.Ops) |