fyne-io / fyne-x Goto Github PK
View Code? Open in Web Editor NEWCommunity extensions to the cross platform GUI in Go based on Material Design
License: Other
Community extensions to the cross platform GUI in Go based on Material Design
License: Other
I think it would be a great idea to create a sort of demo application (in cmd/demo
perhaps) to showcase most of, if not all, of the useful additions that this project provides over the regular fyne packages. Something like fyne_demo
is what I am imagining. This is much better than adding a new project to the cmd/
folder for each widget.
This is not on top of my priority list at the moment so I'm opening it here so that anyone that wants to work on it can do so :)
The gorilla websocket library does not support webassembly. It would be nice to use https://github.com/nhooyr/websocket to have support for it. It would require test to make sure it also work with gopherjs, if it doesn't a follow up story should be created and some logic could be added to switch between libraries depending on the platform.
Neither of the import paths produce the correct meta tags:
Code | Meta | URL |
---|---|---|
404 | missing | https://fyne.io/fyne/x/layout?go-get=1 |
404 | missing | https://fyne.io/fyne/x/widget?go-get=1 |
404 | missing | https://fyne.io/fyne/x?go-get=1 |
301 | missing | https://fyne.io/fyne?go-get=1 |
The URL https://fyne.io/fyne/x?go-get=1
should have the following:
<meta name="go-import" content="import-prefix git github.com/fyne-io/fyne-x">
As per documentation:
https://golang.org/cmd/go/#hdr-Remote_import_paths
This is needed to fix the govet CI test, and merge PRs.
Similar to the work done in #87, it would be nice to have a kind of preconfigured dialog for showing settings. This is inspired by the components that libadwaita provides to make sure that apps a consistent in design even in more larger-grained components like settings and so on. https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/widget-gallery.html#preferences-dialog
I have been experiencing a bug with Fyne-X regarding the completion widget. I am utilizing Fynes app tab to display a completion entry. It seems once text is entered in the completion widget, then going to another tab for a few minutes (presumably for how long it takes Go's garbage collection to clean up), then switching back to the tab with the completion entry in it, it causes my application to panic with this stack trace:
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0xa8 pc=0x7ff67f1f08c0]
goroutine 20 [running, locked to thread]:
fyne.io/x/fyne/widget.(*CompletionEntry).maxSize(0xc00161c900)
C:/Users/kinlougn/go/pkg/mod/fyne.io/x/[email protected]/widget/completionentry.go:98 +0
Upon going to this section of the completionentry.go file, it seems I can resolve the issue by adding this right after we populate the cnv variable:
if cnv == nil {
return fyne.NewSize(0, 0)
}
In my opinion, it seems like Go's garbage collection is cleaning up something it shouldn't, and when I switch back to the app tab with the completion entry, it tries to reference it but it's no longer there, causing the application to panic.
Is it possible to make selected day in calendar with another text color?
I set files := xWidget.NewFileTree(app.Storage().RootURI())
..., maybe it is not bug(in this case i am sorry), but when create, err := e.app.Storage().Create(strings.Join([]string{entry.Text, ".cl"}, ""))
create dir "Document", why do not xWidget
look there?
files.go
create, err := e.app.Storage().Create(strings.Join([]string{entry.Text, ".cl"}, ""))
....
files := xWidget.NewFileTree(ed.app.Storage().RootURI())
fyne.io/fyne/v2 v2.4.4
1.22.0
Pop!_OS 22.04 LTS x86_64
it is same code as fyne-io/fyne#4668, but probably different problem, so I was create next issues ...
I have been using the calendar widget successfully for the past year.
Today (31 May 2024) when I click the upper right chevron to move to the next month, it goes straight to July. If I then use the upper left chevron to go back a month it then goes to June.
I have not noticed this behaviour before and have a feeling that it is related to being the last day of the month.
It seems the responsive layout breaks the TextWordWrap of widget.Label.
If I build the example cmd with go 1.18.1 on MacOS (ARM) it does not wrap the text if the window gets smaller. It only wraps the text where there is an \n in the code.
The following code results in a thin blank bar with no content.
type customtree struct {
xwidget.FileTree
}
func NewCustomTree(root fyne.URI) *customtree {
tree := &customtree{}
tree.ExtendBaseWidget(tree)
tree.Root = root.String()
return tree
}
Moving this on from fyne-io/fyne#916. We should be supporting the restriction of input types in things such as entry on mobile where you might want to only allow number inputs for examples.
Unfortunately, widget.Filetree is very slow in the Linux root directory. Is there a possibility to make it faster ? It barely responds to scrolling movements.
Regards,
Lennart
Out of index error on fast input
Steps to reproduce the behaviour:
Type four letters e.g "edin" quickly (difficult to get it to crash consistently)
OR press the "simulate fast typing" button. This gives the same error as typing quickly
See error
panic: runtime error: index out of range [3] with length 1
goroutine 18 [running, locked to thread]:
fyne.io/x/fyne/widget.newNavigableList.func3(0x7ff7e1196dd8?, {0x7ff7e1196150?, 0xc0000c48c0?})
C:/Users/Del/go/pkg/mod/fyne.io/x/[email protected]/widget/completionentry.go:145 +0xf7
fyne.io/fyne/v2/widget.(*listLayout).setupListItem(0xc0000a81e0, 0xc00038ea10, 0x3)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/widget/list.go:411 +0x9b
fyne.io/fyne/v2/widget.(*listLayout).updateList(0xc0000a81e0, 0x1)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/widget/list.go:456 +0x418
fyne.io/fyne/v2/widget.(*listLayout).Layout(0x41600000000000f8?, {0x0?, 0xc0004295f8?, 0x7ff7e0ab5fb9?}, {0xecc1d0?, 0xc0?})
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/widget/list.go:369 +0x1e
fyne.io/fyne/v2/internal/driver/common.updateLayout({0x7ff7e1195970?, 0xc00019a0c0?})
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/common/canvas.go:512 +0x70
fyne.io/fyne/v2/internal/driver/common.(*Canvas).EnsureMinSize.func1(0xc001002ac0)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/common/canvas.go:97 +0x235
fyne.io/fyne/v2/internal/driver/common.(*Canvas).walkTree.func2({0x7ff7e1195c70?, 0xc000e05300?}, {0xc000e05300?, 0xf542999ad?})
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/common/canvas.go:433 +0xae
fyne.io/fyne/v2/internal/driver.walkObjectTree({0x7ff7e1195c70, 0xc000e05300}, 0x0, {0x7ff7e1196150, 0xc000d788c0}, {0xe1366c00?, 0x7ff7?}, {0x429838?, 0xc0?}, {0xe0aaaa6a?, ...}, ...)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/util.go:197 +0x370
fyne.io/fyne/v2/internal/driver.walkObjectTree.func1(...)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/util.go:176
fyne.io/fyne/v2/internal/driver.walkObjectTree({0x7ff7e1196150, 0xc000d788c0}, 0x0, {0x7ff7e11963f0, 0xc000136e00}, {0xe0943be9?, 0x7ff7?}, {0x429888?, 0xd5000000?}, {0x0?, ...}, ...)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/util.go:190 +0x41d
fyne.io/fyne/v2/internal/driver.walkObjectTree.func1(...)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/util.go:176
fyne.io/fyne/v2/internal/driver.walkObjectTree({0x7ff7e11963f0, 0xc000136e00}, 0x0, {0x7ff7e1195970, 0xc00019a0c0}, {0xe1366c00?, 0x7ff7?}, {0x4299c8?, 0xc0?}, {0xe0aaaa6a?, ...}, ...)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/util.go:190 +0x41d
fyne.io/fyne/v2/internal/driver.walkObjectTree.func1(...)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/util.go:176
fyne.io/fyne/v2/internal/driver.walkObjectTree({0x7ff7e1195970, 0xc00019a0c0}, 0x0, {0x7ff7e1195eb0, 0xc00038e3f0}, {0xe1366c00?, 0x7ff7?}, {0x429a90?, 0xc0?}, {0xe0aaaa6a?, ...}, ...)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/util.go:190 +0x41d
fyne.io/fyne/v2/internal/driver.walkObjectTree.func1(...)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/util.go:176
fyne.io/fyne/v2/internal/driver.walkObjectTree({0x7ff7e1195eb0, 0xc00038e3f0}, 0x0, {0x7ff7e1196630, 0xc000198000}, {0xe1366c00?, 0x7ff7?}, {0x429b58?, 0xc0?}, {0xe0aaaa6a?, ...}, ...)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/util.go:190 +0x41d
fyne.io/fyne/v2/internal/driver.walkObjectTree.func1(...)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/util.go:176
fyne.io/fyne/v2/internal/driver.walkObjectTree({0x7ff7e1196630, 0xc000198000}, 0x0, {0x7ff7e1196210, 0xc0000b2a00}, {0x429b80?, 0xc0?}, {0x429bc0?, 0xc0?}, {0xe0acb7b0?, ...}, ...)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/util.go:190 +0x41d
fyne.io/fyne/v2/internal/driver.walkObjectTree.func1(...)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/util.go:176
fyne.io/fyne/v2/internal/driver.walkObjectTree({0x7ff7e1196210, 0xc0000b2a00}, 0x0, {0x0, 0x0}, {0x429c70?, 0xc0?}, {0x429c78?, 0x0?}, {0xe0c60ae6?, ...}, ...)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/util.go:190 +0x41d
fyne.io/fyne/v2/internal/driver.WalkVisibleObjectTree({0x7ff7e1196210?, 0xc0000b2a00?}, 0x7ff7e1194370?, 0xc00004e3c0?)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/util.go:134 +0x4c
fyne.io/fyne/v2/internal/driver/common.(*Canvas).walkTree(0x7ff7e0c3a2a4?, 0xc0000251a0, 0x0, 0xc000429df0)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/common/canvas.go:439 +0x165
fyne.io/fyne/v2/internal/driver/common.(*Canvas).WalkTrees(0xc0000ba000, 0x7ff7e0944467?, 0x0?)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/common/canvas.go:360 +0xd9
fyne.io/fyne/v2/internal/driver/common.(*Canvas).EnsureMinSize(0xc0000ba000)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/common/canvas.go:102 +0xf1
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).repaintWindow.func1()
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/glfw/loop.go:166 +0x35
fyne.io/fyne/v2/internal/driver/glfw.(*window).RunWithContext(0xc0000b4000, 0xc000429ea0)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/glfw/window.go:1329 +0x4f
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).repaintWindow(0xc000429f90?, 0xc000429f18?)
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/glfw/loop.go:165 +0x4a
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).startDrawThread.func1()
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/glfw/loop.go:228 +0x33a
created by fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).startDrawThread
C:/Users/Del/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/glfw/loop.go:192 +0xca
exit status 2```
### Screenshot
![auto](https://user-images.githubusercontent.com/45520351/170705661-8eea228e-db06-4d22-ad56-cfc604ccb26d.png)
### Example code:
```package main
import (
"strings"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
xWidget "fyne.io/x/fyne/widget"
"github.com/tidwall/cities"
)
func main() {
a := app.New()
w := a.NewWindow("Entry Completion")
entry := xWidget.NewCompletionEntry([]string{})
// When the use typed text, complete the list.
cardTexts := []string{}
entry.OnChanged = func(s string) {
results := []cities.City{}
for _, value := range cities.Cities {
if len(value.City) < len(s) {
continue
}
if strings.EqualFold(s, value.City[:len(s)]) {
results = append(results, value)
}
}
if len(results) == 0 {
entry.HideCompletion()
return
}
cardTexts = []string{}
for _, r := range results {
s := r.City
cardTexts = append(cardTexts, s)
}
entry.SetOptions(cardTexts)
entry.ShowCompletion()
}
button := widget.NewButton("Simulate fast typing", func() {
for {
entry.SetText("")
entry.SetText(entry.Text + "edin")
}
})
w.SetContent(container.NewVBox(button, entry))
w.Resize(fyne.NewSize(700, 500))
w.ShowAndRun()
}
In some cases an analogue of Split container that could handle more than two widgets inside would improve user experience. My use case is explained below.
I am writing an application with a three-pane window (i.e., the widgets are organized into three columns). Users should be able to change the sizes of the three columns. Currently I organize the window as a sequence of two HSplit containers:
hsplit(hsplit(COLUMN1, COLUMN2), COLUMN3)
This works, but the two "splitter" widgets that appear between the columns do not have the same behavior and this leads to an inconsistent user interface. Moving the first splitter preserves the size of the third column and changes only the sizes of the first two columns. But moving the second splitter, which visually is between COLUMN2
and COLUMN3
, changes the sizes of all three columns:
As a user, given such an interface I would certainly expect the two splitter widgets to behave in the same way. It would be nice to have a way to build this using standard fyne containers.
For completeness, here's the code for the minimal example:
package main
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
)
func main() {
application := app.NewWithID("three-way-split")
window := application.NewWindow("Three-way-split")
label1 := widget.NewLabel("First")
label2 := widget.NewLabel("Second")
label3 := widget.NewLabel("Third")
split1 := container.NewHSplit(label1, label2)
split2 := container.NewHSplit(split1, label3)
window.SetContent(split2)
window.Resize(fyne.NewSize(float32(400), float32(100)))
window.ShowAndRun()
}
Yes, it's possible to write an alternative Split container that could handle an arbitrary list of subordinate widgets. It shouldn't be very difficult, but I didn't do this since my goal of making three resizable columns was reached.
A new container, for example called SplitN
, with APIs like
container.NewHSplitN(objects []fyne.CanvasObject)
and similarly container.NewVSplitN
func (s *SplitN) SetWeights (weights []float32)
: after computing the minimal sizes for each object in the split container, divide the remaining free space available in the container among widgets according to the float values in the weights
slice. Negative or zero weights should hide the corresponding widget. Positive weights do not have to sum to one, only their ratios matter.As the following code shows, the text in CompletionEntry cannot be edited.
package main
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/widget"
x "fyne.io/x/fyne/widget"
)
var data = []string{"a", "string", "list"}
var option = []string{"option1", "option2", "option3"}
func main() {
myApp := app.New()
myWindow := myApp.NewWindow("List Widget")
list := widget.NewList(
func() int {
return len(data)
},
func() fyne.CanvasObject {
return x.NewCompletionEntry(option)
},
func(i widget.ListItemID, o fyne.CanvasObject) {
e := o.(*x.CompletionEntry)
e.SetText(data[i])
e.OnChanged = func(s string) {
e.ShowCompletion()
}
})
myWindow.SetContent(list)
myWindow.ShowAndRun()
}
fyneApp.Settings().SetTheme(theme.DarkTheme())
myApp.App = fyneApp
myApp.CurrentShemeDark = true
This code seems to work only if the system setting is in 'dark' mode.
As a user of the fyne framework who wants to use some widgets or features from fyne-x
I will have to deal with package naming conflicts a lot. Both fyne
and fyne-x
modules have a package widgets
and a package layout
.
I made a basic widget with one node and compiled it without issues using fyne-cross. However, the app crashes without an error message on Android v10.
My apologies for not providing any logs, however I was not able to extract any. And this is my first time developing Android app using Golang, not sure how to start debugging the issue in a way to reveal more information and make this ticket more useful...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.