-
Notifications
You must be signed in to change notification settings - Fork 5
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
Aligned BoxLayout #1
base: main
Are you sure you want to change the base?
Conversation
…extBaselineable and Expander object and removing old approach for expanded aligned boxes, added demo screenshot
@andydotxyz I have updated the proposal. Unfortunately, I have realized we cannot split the I have updated the implementation too (it is a new link added in this proposal), now it effectively implement the baseline alignment for the cross axis :). I need to polish somethings, but in essence is that. You can see a screenshot of the mini demo I created in this document. |
@andydotxyz
// For a VBoxLayout this will pack objects into a single column where each item
// is full width but the height is the minimum required.
Note: Basically, if you have 3 objects and you want to expand just two of them (one should remain at its min size), how could it be accomplished currently? 1. First proposal:
2. Second proposal: |
I don't agree that these cannot have alignment. Yes each cell is a common size, but the layout can arrange it's children as appropriate. |
Here I am confused again - you pose the problem of how to have 2 expanded items in a layout, but both proposals talk about alignment. These need to be addressed separately, as has been discussed on two calls now. I agree that the arrangement:
is not currently possible with standard layouts. So we could solve that with one proposal. I do not agree that adding baseline alignment relies on the above, and I also don't agree that it is exclusive to the Box layout. We will code like that for the arrangement of proper rich text as part of Text Refactor as well. We cannot continue to pursue these as part of the same proposal - the requirements are very blurred and it is impossible to truly understand the ramifications of such changes. |
Yes, but the alignment in a Grid is different from a Box. In boxes, you are aligning the children against one axis. However, in Grids (if they have alignment), they need to arrange their children in both axis. So how user should specify the alignment?
|
Agree, but now I am lost, I don't know how to propose alignment for other layouts (specially because of the reasons I mentioned above). Could you give me ideas of how it should look like for other layouts? |
By reducing to a clear scope I think that it is easy to answer. If the issue is around adding baseline alignment then it is quite clear how a grid would apply that - all items on a row would want have vertical alignment behaviour like the box discussion earlier. |
This is a good question, the naming does not make it clear. If we consider vertical vs horizontal axis then it is pretty straight forward to discuss. |
So GridWithColumns and GridWithRows would have only vertical alignment, while in Boxes, VBox would have horizontal alignment and HBox vertical alignment? New constructors for Grid container should be then: GridWithColumnsAligned(verticalAlign, cols, ...objects)
GridWithRowsAligned(verticalAlign, rows, ...objects) ? |
Ok then |
That isn't what was in my mind. If you are looking to address vertical and horizontal alignment then grid would support both, whereas Box has one (or the other, depending on vertical vs horizontal). It probably comes down to what types of alignment this is trying to address, baseline only operates horizontally of course. |
If this is done, NewGridWithColumnsAligned(horizontalAlignment, verticalAlignment, cols, ...objects)
NewGridWithRowsAligned(horizontalAlignment, verticalAlignment, rows, ...objects) They don't seem like great constructors 😕, any ideas what it should look like?
Well, originally this was just for BoxLayout and for it CrossAlignment was ideally, but now I am not sure. Maybe |
Modifications to Grid would be no bigger than Box - both would have to reduce the space available to force alignment. Comparing the horizontal box and a row of a grid you can see that for vertical placement they are the same (except the box picks the least space that all widgets require, whereas grid uses a portion of available). Both algorithms expand and would need to be adjusted to support alignment because currently they position uniformly to the same height. |
Got it. So |
That's bit what I was meaning - the grid wrap and border also have items that pack items next to each other in a row that could require alignmment. Basically if you start looking to add alignment into layout algorithms it pretty much hits every one of them. |
As I said before, I think Border has a specific purpose and it already does its job (the problem is -IMHO- that it is overused for other things). GridWrap should have alignment only if we decide other Grids would have it too.
I don't think those layouts should have alignment. They already do their jobs.
Yes, that's why I proposed this as a feature for only BoxLayouts (specially because they are the only layouts that does not expand by default).
Standard widget sizes should remain as they are now (unless they have some problems like the button and the entry iirc), however limiting everything to that size, you are limiting also the appearance for custom widgets.
Yes, absolutely that is one of the widgets that need baseline alignment, but it could use it internally without problems (I mean it wouldn't depend on this directly). |
I return to my thought that alignment and expansion should be separated. Box would have to take more space to align, but would no longer expand the child elements. This result is the same as a layout that expands but would require each element take a little less space to be able to align. The outcome is gaps in what was otherwise a uniform fill. |
Sorry, I don't understand what are you trying to say. |
I am trying to find new illustrations to show that expansion and alignment are separate issues. |
I am aware they are separate issues, but because the Expanded objects and Non-Expanded objects are commonly used together, they cannot be worked separately IMHO. Most of the popular cross platform frameworks for developing apps have mixed the alignment with the expansion feature in their layouts: Flutter, Ionic, React, etc. I understand your point, but I think that way would limit other kind of alignments and doesn't have clean way to expand objects in Boxes while aligning them too. So not sure about the future of this proposal, because we have two possibilities with problems:
|
It was discussed on the call again today, it was generally agreed that by standardising widget definition to include a standard baseline we can solve many of the common use-cases without any new API. Therefore we suggested leaving this proposal to one side and may revisit it after 2.1 and the various text enhancements to see what still needs to be addressed. |
That's fine. But just to clarify, (as I said before) this proposal is not against the standardization. The only goal of this proposal is to be able to align widgets with different sizes (mainly heights) to have widgets like the one discussed in fyne-io/fyne#1701 but as you pointed me out in that moment it is not recommended currently because Fyne does not have a way to align widgets in the cross axis, so this proposal wanted to solve that.
Great! I am very excited about that proposal 🤩. But I would like (if it is possible) that the function in charge for measuring the distance to the baseline is public (if it is implemented). |
That one issue can be resolved in the form layout. |
The aim of this proposal is to add cross axis alignment options for boxLayouts (HBox and VBox) that would allow them to be able to organize widgets with different cross axis sizes.
Expandable
feature and then the addition of aExpanded
container is optional. The filealigned_boxlayout.md
contains more detailed information about this proposal.