GithubHelp home page GithubHelp logo

fyne-io / fyne-x Goto Github PK

View Code? Open in Web Editor NEW
225.0 225.0 58.0 3.25 MB

Community extensions to the cross platform GUI in Go based on Material Design

License: Other

Go 100.00%
fyne go golang gui hacktoberfest

fyne-x's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fyne-x's Issues

Create a demo application

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 :)

Import Paths

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.

How to setting button background color?

I have question about to change button background color.

  • I can not found any demo about the it.
  • I only find these.
  • (1) "type ButtonStyle"
  • (2) ButtonStyle determines the behaviour and rendering of a button.
  • I hope you can resolve my confuse , thank you so much.

Completion entry causes crashing

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.

bad fileroot even hought setting

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

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?

How to reproduce

  1. go to https://github.com/MatejMagat305/fyneCL
  2. download it
  3. run multiple go run .
  4. debug on 48th line in file files.go

Screenshots

path

Example code

	create, err := e.app.Storage().Create(strings.Join([]string{entry.Text, ".cl"}, ""))

....        

	files := xWidget.NewFileTree(ed.app.Storage().RootURI())

Fyne version

fyne.io/fyne/v2 v2.4.4

Go compiler version

1.22.0

Operating system and version

Pop!_OS 22.04 LTS x86_64

Additional Information

it is same code as fyne-io/fyne#4668, but probably different problem, so I was create next issues ...

Month Skipped

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.

Responsive breaks TextWrapWord of widget.Label

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.

Cannot Extend widget.Filetree

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
}

widget.Filetree is very slow

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

CompletionEntry crash on fast input

Describe the bug:

Out of index error on fast input

To Reproduce:

Steps to reproduce the behaviour:

  1. 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

  2. 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()

}

Device (please complete the following information):

  • OS: Windows
  • Version: 10
  • Go version: go1.18.1
  • Fyne version: v2.1.4

Three-way split containers

Checklist

  • I have searched the issue tracker for open issues that relate to the same feature, before opening a new one.
  • This issue only relates to a single feature. I will open new issues for any other features.

Is your feature request related to a problem?

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:

three-way-split.webm

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()
}

Is it possible to construct a solution with the existing API?

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.

Describe the solution you'd like to see.

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.

CompletionEntry cannot type word when SetText is called in widget.List

As the following code shows, the text in CompletionEntry cannot be edited.

Screenshots

ๅ›พ็‰‡

Steps to reproduce the behaviour:

  • Run the code below
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()
}

Conflicting package names

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.

Diagrams Add-on Crashes on Android

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...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.