Comments (7)
The long term plan was to use Cassowary [...]
[Flexbox] why it wouldn’t be appropriate?
Because of the technical debt to pay in years to come. Fyne is still a newborn and currently has no 'default layout engine'. Any that will come will hook up all user base. So if Flexbox will come first, the incentives to keep it will be strong. Assuming Cassowary will be next, Flexbox — even as a wrapper — still will call for maintenance.
Thinking of layout in Constraint terms, while needs a bit of mental switch from other layouting methods, has already proven its merits and advantages both on iOS and Android. I can not asses whether implementing it in Fyne will take twice as much effort as Flex, but even if thrice, it should be well amortized over the first or second maintenance cycle.
Everything that can be done with Flexbox cassowary computed layout can do. But not vice versa. Esp. with layouts where the same message needs to be shown in 40 glyphs of Icelandic or in four of Chinese.
$ 0.02
P.S. With constraints layout engine Fyne might leech on an Android Studio / Xcode allowing Fyne to get on board also designers.
from fyne.
Stage 2 would then be to apply struct tags to the original struct to then enable an auto-builder to create the UI, and do 2way binding to the underlying struct.
type Account struct {
Name string `flex: gridcols=6,label="Name",span=1"
Address string `flex: label="Address",span=2,onchange=ChangeAddress`
Comments string `flex: label="Account Comments",span=5,rows=4`
}
func (m *Account) ChangeAddress(old, new string) error {
fmt.Println("Address was", old, "is now", new)
return nil
}
myAccount := &Account{}
// then
myForm := NewFlexGrid().Build(myAccount) // uses struct tags to auto-build the elements, and 2-way bind them to the model
// can now inject myForm into a dialog, or other widget, etc
from fyne.
Sounds pretty handy. One challenge will be that with the current container setup there will be duplication as the user has to pass items into the layout and the container. Perhaps we can improve that too?
from fyne.
Drive-by note: it's probably worth looking into whether to copy ideas from Flexbox or CSS Grids, or both.
from fyne.
As Fyne is fully scallable I think it would be better to implement constraints based layout (Cassowary), and then steer toward having it as the only layout engine. While its (constraints layout) concepts are somewhat new to the web developers base, its code and algorithms are solid rock. Both Flexbox and CSS Grids layouts have proved to be hard and/or resource hungry if applied in i18n/l10n demanding apps.
$ 0.02
from fyne.
The long term plan was to use Cassowary and rebuild others as helpful wrappers. But if people think flex box would be helpful then it could still work. All of the layout maths in Fyne is scaled dynamically so I can’t see a reason why it wouldn’t be appropriate?
from fyne.
After our conversation yesterday I wondered if adding hints (inspired by the options at the top of this post) to a standard grid layout may meet most use-cases for this request. By adding rowspan or colspan you could easily set up more complicated grids. By keeping it an underlying grid layout you end up with something like the bootstrap grid - define the number of columns and the space will be split equally, with cells filling the defined space.
I feel better about this simple approach than trying to aim for flex-box - I worry that we will fail to meet expectations in so many ways if we try to match the web layouts people are currenly working with.
from fyne.
Related Issues (20)
- Discovered abnormal information while using FileDialog HOT 1
- Example code won't compile on windows HOT 1
- dialog "NewFolderOpen" freezes when scanning a large number of directories. HOT 1
- React Fyne HOT 2
- Add mobile web support
- Sometimes fyne fails to setup dark mode HOT 2
- add a X to just close dialog HOT 1
- How to solve Chinese garbled characters? HOT 1
- Select Does Not Gain Focus When Tapped
- Clicking on empty part of widget.List does not unfocus other widgets
- Calling popUp.Hide() closes all overlays, not just the popup itself. Feature or bug? HOT 1
- container.NewScroll does not support horizontal scroll for widget tree object HOT 5
- fyne does not render text from SVG files. HOT 1
- panic if app.New() is not the first method called. HOT 2
- Support Software Rendering for X11 by allowing to disable GLX HOT 13
- Issue with SetSystemTrayIcon when using jpg format
- Licence has self conflicting wording, possible typo HOT 3
- What means MinSize() of Entry? HOT 5
- Is there a separate window.Run function HOT 2
- Production app running a test app when importing Appearance Screen HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fyne.