This repository holds community extensions for the Fyne toolkit.
This is in early development and more information will appear soon.
Community contributed layouts.
import "fyne.io/x/fyne/layout"
Community contributed widgets.
import "fyne.io/x/fyne/widget"
A widget that will run animated gifs.
gif, err := NewAnimatedGif(storage.NewFileURI("./testdata/gif/earth.gif"))
gif.Start()
An extension of widget.Tree for displaying a file system hierarchy.
tree := widget.NewFileTree(storage.NewFileURI("~")) // Start from home directory
tree.Filter = storage.NewExtensionFileFilter([]string{".txt"}) // Filter files
tree.Sorter = func(u1, u2 fyne.URI) bool {
return u1.String() < u2.String() // Sort alphabetically
}
An extension of widget.Entry for displaying a popup menu for completion. The "up" and "down" keys on the keyboard are used to navigate through the menu, the "Enter" key is used to confirm the selection. The options can also be selected with the mouse. The "Escape" key closes the selection list.
entry := widget.NewCompletionEntry([]string{})
// When the use typed text, complete the list.
entry.OnChanged = func(s string) {
// completion start for text length >= 3
if len(s) < 3 {
entry.HideCompletion()
return
}
// Make a search on wikipedia
resp, err := http.Get(
"https://en.wikipedia.org/w/api.php?action=opensearch&search=" + entry.Text,
)
if err != nil {
entry.HideCompletion()
return
}
// Get the list of possible completion
var results [][]string
json.NewDecoder(resp.Body).Decode(&results)
// no results
if len(results) == 0 {
entry.HideCompletion()
return
}
// then show them
entry.SetOptions(results[1])
entry.ShowCompletion()
}
A skeuomorphic widget simulating a 7-segment "hex" display. Supports setting digits by value, as well as directly controlling which segments are on or off.
Check out the demo for an example of usage.
h := widget.NewHexWidget()
// show the value 'F' on the display
h.Set(0xf)
Community contributed validators.
import fyne.io/x/fyne/data/validation
A validator for validating passwords. Uses https://github.com/wagslane/go-password-validator for validation using an entropy system.
pw := validation.NewPassword(70) // Minimum password entropy allowed defined as 70.