/fyneloader

Dynamic UI builder for the fyne UI toolkit

Primary LanguageGoMIT LicenseMIT

fyne-loader

Overview

fyne-loader is a dynamic UI builder for the fyne UI toolkit, useful for prototyping fyne UIs in a manner that doesn't require re-compiling between every run.

How it works

UI elements may be generated by loading a YAML or JSON file with the Loader type, which returns all loaded elements from the file as a map of names to fyne.CanvasObject instances. To see an example of how this works in code, see ./cmd/example/main.go.

The load functions only return errors when there is a YAML or JSON error that prevents parsing of the file. Otherwise, all errors are reported through a context object; this allows the loader to report all errors encountered, as well as attempt to continue even when errors are present.

Supported Widgets

The current set of supported widgets is:

  • Accordion
  • Button
  • Card
  • Check
  • HBox
  • Label
  • RadioGroup
  • Slider
  • Spacer
  • VBox

Extra widgets which are planned to be supported are:

  • AdaptiveGrid
  • BorderContainer
  • CenterContainer
  • Entry
  • Form
  • Grid
  • GridWrap
  • Hyperlink
  • Icon
  • MaxContainer
  • PaddedContainer
  • ProgressBar
  • ProgressBarInfinite
  • Scroll
  • Select
  • SelectEntry
  • Separator
  • Split
  • Tabs
  • TextGrid
  • Toolbar

Adding New Widgets

New widgets may be added by creating a function which matches the type CreateElementFn and adding it to a loader with (*Loader).RegisterElement. This allows adding any arbitrary element to the loader. The function given should handle both string and map[string]interface{} values.