From 169b73033d8a9d420bc96d7a25fc977079ee7d71 Mon Sep 17 00:00:00 2001 From: Martyn Date: Sun, 12 Dec 2021 12:10:26 +0100 Subject: [PATCH] Consistency is key --- examples/floatingControlsLayout/main.go | 35 +++++++++++++++++++ ...Container.go => floatingControlsLayout.go} | 0 2 files changed, 35 insertions(+) create mode 100644 examples/floatingControlsLayout/main.go rename pkg/layouts/{floatingControlsContainer.go => floatingControlsLayout.go} (100%) diff --git a/examples/floatingControlsLayout/main.go b/examples/floatingControlsLayout/main.go new file mode 100644 index 0000000..56b8175 --- /dev/null +++ b/examples/floatingControlsLayout/main.go @@ -0,0 +1,35 @@ +package main + +import ( + "fmt" + "image/color" + + "fyne.io/fyne/v2" + "fyne.io/fyne/v2/app" + "fyne.io/fyne/v2/canvas" + "fyne.io/fyne/v2/container" + "fyne.io/fyne/v2/widget" + "git.martyn.berlin/martyn/fyne-widgets/pkg/layouts" +) + +func main() { + a := app.New() + w := a.NewWindow("FloatingButtons") + + background := canvas.NewRectangle(color.RGBA{255, 0, 0, 128}) + + layout := layouts.NewFloatingControlsLayout() + layout.FloatingControlsLocation = layouts.FloatingControlsCenter + button := widget.NewButton("X", func() { + fmt.Println("button clicked") + layout.FloatingControlsLocation = layout.FloatingControlsLocation + 1 + if layout.FloatingControlsLocation > 8 { + layout.FloatingControlsLocation = 0 + } + w.SetContent(w.Content()) + }) + + w.SetContent(container.New(&layout, background, button)) + w.Resize(fyne.NewSize(100, 100)) + w.ShowAndRun() +} diff --git a/pkg/layouts/floatingControlsContainer.go b/pkg/layouts/floatingControlsLayout.go similarity index 100% rename from pkg/layouts/floatingControlsContainer.go rename to pkg/layouts/floatingControlsLayout.go