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
Render of widgets implementing layout.SpacerObject look bad #4731
Comments
The objects you are building are not spacers though... (spacers are the blank area between elements packed into a box). |
I think that could be a brilliant addition to the layout functionality for VBox and HBox. FYI: I've been using ordinary spacer with VBox and HBox, but I tried out the interface on buttons for the first time as I needed expanding buttons on each side of a label, and there is no layout that provide that behaviour. |
Quick idea: In addition to let all widgets, the standard fyne or your own, implement Something like a function leftButton := widget.NewButton("I am greedy, nil)
w.SetContent(container.NewHBox(
layout.NewSpacerObject(leftButton),
widget.NewLabel("Middle"),
layout.NewSpacer(),
)) |
I see how that could feel like a nice shorthand but it actually goes against how the standard layouts and constructors work. There are wrappers in the fyne-x repo where the design principles are less strict - it could probably be added there. |
Checklist
Describe the bug
Widgets implementing the
layout.SpacerObject
interface seem to be rendered badly.Documentation for the interface state "any object" can be used for spacing.
(In my case I wanted an expanding button on each side of a label i a Horizontal box. It was "increase zoom" and "decrease zoom" around a "current zoom" label.)
How to reproduce
Make a widget implement the
layout.SpacerObject
interface and insert into Vertical or Horizontal box.(In the code example below and in the the screen shot there is no "tapping"-events at all on the buttons on the empty areas to left and right of the "middle" button.)
Screenshots
Example code
Fyne version
fyne cli version: v2.4.4
Go compiler version
go version go1.22.1 darwin/arm64
Operating system and version
macOS Sonoma Version 14.2.1 (23C71)
Additional Information
No response
The text was updated successfully, but these errors were encountered: