Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tsukinoko-kun/fyneflow
Dialog flow for fyne v2
https://github.com/tsukinoko-kun/fyneflow
fyne golang golang-library gui ui-library
Last synced: about 1 month ago
JSON representation
Dialog flow for fyne v2
- Host: GitHub
- URL: https://github.com/tsukinoko-kun/fyneflow
- Owner: tsukinoko-kun
- License: mit
- Created: 2024-01-22T15:32:42.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-08-25T16:09:34.000Z (4 months ago)
- Last Synced: 2024-08-26T11:53:24.408Z (4 months ago)
- Topics: fyne, golang, golang-library, gui, ui-library
- Language: Go
- Homepage:
- Size: 42 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fyneflow
Dialog flow for fyne v2
This library manages the content state of a `fyne.Window`
## Install
```bash
go get -u github.com/tsukinoko-kun/fyneflow
```## Usage
```go
package mainimport (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
"github.com/tsukinoko-kun/fyneflow"
)const (
FlowKeyA = iota
FlowKeyB
)func main() {
a := app.New()
w := a.NewWindow("Flow Test")// wrap the fyne.Window using a flow
// the generic type is the type for the flow keys
flow := fyneflow.NewFlow(w)
defer flow.Close()// add an item to the flow with the key A
flow.Set(FlowKeyA, func(flow *fyneflow.Flow) fyne.CanvasObject {
// use flow shared data of key "txt"
return container.NewVBox(
widget.NewLabel("I am A"),
widget.NewButton("Go to B", func() {
// swich to flow item with key B
if err := flow.GoTo(FlowKeyB); err != nil {
panic(err)
}
}),
)
})// add an item to the flow with the key B
flow.Set(FlowKeyB, func(flow *fyneflow.Flow) fyne.CanvasObject {
// use flow shared data of key "txt"
return container.NewVBox(
widget.NewLabel("I am B"),
widget.NewButton("Go to A", func() {
// swich to flow item with key A
if err := flow.GoTo(FlowKeyA); err != nil {
panic(err)
}
}),
)
})// display the window
w.ShowAndRun()
}
```