Skip to content

Data binding, storage repositories and animation take Fyne to the next level!

Compare
Choose a tag to compare
@andydotxyz andydotxyz released this 25 Jan 10:01
· 4154 commits to master since this release

The v2.0.0 release of Fyne marks a big step in the development of the project. It was a chance to step back, see what was working well and what could be improved - and then make the changes in a way that had not been possible whilst maintaining 1.0 compatibility. As a result there are some breaking changes to point the APIs in a better direction for the future. Additionally this means that the import path has now changed to fyne.io/fyne/v2 following the go module convention.

This release also sees the introduction of data binding (that keeps widgets in sync with a data source), storage repositories (allowing developers to connect different types of file stores to our APIs), animation (to give some motion to elements of an application) and a new theme API (that allows more flexible theming of standard components).

The full list of changes follow. Before upgrading an existing project please be sure to read the upgrading doc for information about relevant changes.

Changes that are not backward compatible

The import path is now fyne.io/fyne/v2 - be sure to update all files when you are ready to make the update.

  • Coordinate system to float32

    • Size and Position units were changed from int to float32
    • Text.TextSize moved to float32 and fyne.MeasureText now takes a float32 size parameter
    • Removed Size.Union (use Size.Max instead)
    • Added fyne.Delta for difference-based X, Y float32 representation
    • DraggedEvent.DraggedX and DraggedY (int, int) to DraggedEvent.Dragged (Delta)
    • ScrollEvent.DeltaX and DeltaY (int, int) moved to ScrollEvent.Scrolled (Delta)
  • Theme API update

    • fyne.Theme moved to fyne.LegacyTheme and can be load to a new theme using theme.FromLegacy
    • A new, more flexible, Theme interface has been created that we encourage developers to use
  • The second parameter of theme.NewThemedResource was removed, it was previously ignored

  • The desktop.Cursor definition was renamed desktop.StandardCursor to make way for custom cursors

  • Button Style and HideShadow were removed, use Importance

  • iOS apps preferences will be lost in this upgrade as we move to more advanced storage

  • Dialogs no longer show when created, unless using the ShowXxx convenience methods

  • Entry widget now contains scrolling so should no longer be wrapped in a scroll container

  • Removed deprecated types including:

    • dialog.FileIcon (now widget.FileIcon)
    • widget.Radio (now widget.RadioGroup)
    • widget.AccordionContainer (now widget.Accordion)
    • layout.NewFixedGridLayout() (now layout.NewGridWrapLayout())
    • widget.ScrollContainer (now container.Scroll)
    • widget.SplitContainer (now container.Spilt)
    • widget.Group (replaced by widget.Card)
    • widget.Box (now container.NewH/VBox, with Children field moved to Objects)
    • widget.TabContainer and widget.AppTabs (now container.AppTabs)
  • Many deprecated fields have been removed, replacements listed in API docs 1.4

Added

  • Data binding API to connect data sources to widgets and sync data
    • Add preferences data binding and Preferences.AddChangeListener
    • Add bind support to Check, Entry, Label, List, ProgressBar and Slider widgets
  • Animation API for handling smooth element transitions
    • Add animations to buttons, tabs and entry cursor
  • Storage repository API for connecting custom file sources
    • Add storage functions Copy, Delete and Move for URI
    • Add CanRead, CanWrite and CanList to storage APIs
  • New Theme API for easier customisation of apps
    • Add ability for custom themes to support light/dark preference
    • Support for custom icons in theme definition
    • New theme.FromLegacy helper to use old theme API definitions
  • Add fyne.Vector for managing x/y float32 coordinates
  • Add MouseButtonTertiary for middle mouse button events on desktop
  • Add canvas.ImageScaleFastest for faster, less precise, scaling
  • Add new dialog.Form that will phase out dialog.Entry
  • Add keyboard control for main menu
  • Add Scroll.OnScrolled event for seeing changes in scroll container
  • Add TextStyle and OnSubmitted to Entry widget
  • Add support for HintText and showing validation errors in Form widget
  • Added basic support for tab character in Entry, Label and TextGrid

Changed

  • Coordinate system is now float32 - see breaking changes above
  • ScrollEvent and DragEvent moved to Delta from (int, int)
  • Change bundled resources to use more efficient string storage
  • Left and Right mouse buttons on Desktop are being moved to MouseButtonPrimary and MouseButtonSecondary
  • Many optimisations and widget performance enhancements
  • Moving to new container.New() and container.NewWithoutLayout() constructors (replacing fyne.NewContainer and fyne.NewContainerWithoutLayout)
  • Moving storage APIs OpenFileFromURI, SaveFileToURI and ListerForURI to Reader, Writer and List functions

Fixed

  • Validating a widget in widget.Form before renderer was created could cause a panic
  • Added file and folder support for mobile simulation support (#1470)
  • Appending options to a disabled widget.RadioGroup shows them as enabled (#1697)
  • Toggling toolbar icons does not refresh (#1809)
  • Black screen when slide up application on iPhone (#1610)
  • Properly align Label in FormItem (#1531)
  • Mobile dropdowns are too low (#1771)
  • Cursor does not go down to next line with wrapping (#1737)
  • Entry: while adding text beyond visible reagion there is no auto-scroll (#912)