fyne-io/developer.fyne.io

First example in https://developer.fyne.io/api/v2.0/ does not compile

Closed this issue · 3 comments

This very first fyne example in the API documentation does not compile because the package widget has no function NewVBox.

    package main

    import "fyne.io/fyne/v2/app"
    import "fyne.io/fyne/v2/widget"

    func main() {
    	a := app.New()
    	w := a.NewWindow("Hello")

    	hello := widget.NewLabel("Hello Fyne!")
    	w.SetContent(widget.NewVBox(
    		hello,
    		widget.NewButton("Hi!", func() {
    			hello.SetText("Welcome :)")
    		}),
    	))

    	w.ShowAndRun()
    }

The fix is to replace widget by container and adding import "fyne.io/fyne/v2/container".

This was fixed over in fyne-io/fyne if I remember correctly, right?

Apparently.