-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SetMinSize()
on anything with a MinSize()
#1581
Comments
The Minimum size of any widget is defined as the size which it cannot be smaller than. This is essetial for laying out complex layouts whilst allowing users to resize windows up or down. Whhen you change the MinSize of an item it cannot become smaller. This is a big problem when scaling down to small screen sizes, like for mobile devices. Table cells and items of List and Tree are special - they are sized based on the template MinSize. Instead of using your desired MinSize hack you should set an indicative template value instead:
That is how they are designed. For all elements their actual size is set by the container as a result of various calculations. |
Right, but this also is the issue of |
Developers choose the layouts in containers as well as the widgets that get put in them - so can you apply a layout that expands the component you would like to be larger? Without more concrete example or description of what cannot be done with the current design it is difficult to provide a more constructive solution, sorry. |
@andydotxyz there is an inconsistency here: func (l *listRenderer) MinSize() fyne.Size {
return l.scroller.MinSize()
}
func (t *tableRenderer) MinSize() fyne.Size {
return t.cellSize
}
func (r *treeRenderer) MinSize() (min fyne.Size) {
min = r.scroller.MinSize()
min = min.Max(r.tree.branchMinSize)
min = min.Max(r.tree.leafMinSize)
return
} I think Tree does it correctly |
There will be some inconsistency, but you're right these have deviated too far. Possible changes:
That will fix up the inconsistency I think. |
^ Agreed, at least that would make them usable in a compact layout. Currently, |
Looking into this further @stuartmscott, I think that I have re-run the image tests requesting that tables be minimum size, and they come out as expected... |
data := [][]string{
{"Foo", "Bar", "Baz"},
{"Foo", "Bar", "Baz"},
{"Foo", "Bar", "Baz"},
}
table := widget.NewTable(
func() (int, int) { return len(data), len(data[0]) },
func() fyne.CanvasObject {
return widget.NewLabel("@@@")
},
func(tci widget.TableCellID, f fyne.CanvasObject) {
f.(*widget.Label).SetText(data[tci.Row][tci.Col])
},
)
tc := container.NewAppTabs(
container.NewTabItem("Table Issue",
container.NewVBox(
widget.NewCard("Title", "Subtitle", table),
),
),
)
w.SetContent(tc) The issue pops up once you put Reducing Variables, without the
w.SetContent(
container.NewVBox(
widget.NewCard("Title", "Subtitle", table),
),
) Only a
w.SetContent(
container.NewVBox(
table,
),
) Only a
w.SetContent(
widget.NewCard("Title", "Subtitle", table),
) |
@AlbinoGeek thanks for sharing this code @andydotxyz, @okratitan the collections should all return |
Aha! Thanks @AlbinoGeek looks like this is a Card MinSize/Layout bug! |
The bug reported is now fixed on |
Just noticed that |
the correct baseline is only true as long as you don't expand the height of the text I think? |
SetMinSize is required for Text and Image because the driver will discover the minimum size when it actually renders (due to font loading or image parsing). |
Gitcha! I can then say this is now fixed, save for the vertical baseline issue [covered elsewhere]. |
Resurrecting this issue because entries in dialogs are sized weirdly. This is how a
The password entry is too small, and there's no SetMinSize() to correctly size it. But it gets even worse when the text label is longer: |
@ivoras Please don’t resurrect old issues that have been closed. It is better to open a new issue or a discussion depending on the context. In this case however, there is a |
Is your feature request related to a problem? Please describe:
Currently, I find myself "extending" widgets literally only to override the
MinSize()
Examples include
List
andTable
when used in any compacting layout.Is it possible to construct a solution with the existing API?
Perhaps I don't understand this question.
Describe the solution you'd like to see:
The text was updated successfully, but these errors were encountered: