diff options
author | xengineering <me@xengineering.eu> | 2023-07-09 16:35:10 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2023-07-09 16:35:10 +0200 |
commit | 4152d6e7bfe3d0fd7d099d36311c4a57f4858964 (patch) | |
tree | e7e2222e88764a371ab53791defd989709490e0a | |
parent | 4e90179c2c72f6c73f1db302b24bfa0cf75aada7 (diff) | |
download | limox-4152d6e7bfe3d0fd7d099d36311c4a57f4858964.tar limox-4152d6e7bfe3d0fd7d099d36311c4a57f4858964.tar.zst limox-4152d6e7bfe3d0fd7d099d36311c4a57f4858964.zip |
Add second view for roster
This prepares the contact list / roster view.
-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) |