Data binding, storage repositories and animation take Fyne to the next level!
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 andfyne.MeasureText
now takes a float32 size parameter- Removed
Size.Union
(useSize.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 tofyne.LegacyTheme
and can be load to a new theme usingtheme.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
andHideShadow
were removed, useImportance
-
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
(nowwidget.FileIcon
)widget.Radio
(nowwidget.RadioGroup
)widget.AccordionContainer
(nowwidget.Accordion
)layout.NewFixedGridLayout()
(nowlayout.NewGridWrapLayout()
)widget.ScrollContainer
(nowcontainer.Scroll
)widget.SplitContainer
(nowcontainer.Spilt
)widget.Group
(replaced bywidget.Card
)widget.Box
(nowcontainer.NewH/VBox
, withChildren
field moved toObjects
)widget.TabContainer
andwidget.AppTabs
(nowcontainer.AppTabs
)
-
Many deprecated fields have been removed, replacements listed in API docs 1.4
- for specific information you can browse https://developer.fyne.io/api/v1.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
andSlider
widgets
- Add preferences data binding and
- 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
andMove
forURI
- Add
CanRead
,CanWrite
andCanList
to storage APIs
- Add storage functions
- 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 outdialog.Entry
- Add keyboard control for main menu
- Add
Scroll.OnScrolled
event for seeing changes in scroll container - Add
TextStyle
andOnSubmitted
toEntry
widget - Add support for
HintText
and showing validation errors inForm
widget - Added basic support for tab character in
Entry
,Label
andTextGrid
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
andMouseButtonSecondary
- Many optimisations and widget performance enhancements
- Moving to new
container.New()
andcontainer.NewWithoutLayout()
constructors (replacingfyne.NewContainer
andfyne.NewContainerWithoutLayout
) - Moving storage APIs
OpenFileFromURI
,SaveFileToURI
andListerForURI
toReader
,Writer
andList
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)