-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix for 3848 - FlexLayout doesn't measure content #6085
Conversation
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
I'm not sure the build error is caused by my changes:
How do I check? |
The tests got rerun and everything succeeded this time. |
Do you think you can add a unit test for this? |
@rmarinho I'm on holiday this week, but next week I'll look at the unit tests for StackLayoutManager and see if I can base them on that. |
3c249f7
to
def5751
Compare
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just marking this red so we don't forget to add a test. Just had an issue right now that appeared after a few merges because we did not have a test in a critical path. I am becoming more like Stephane and feeling test-greedy.
@mattleibow I'm working on the tests, but have managed to completely bork my VS setup trying to get the latest Maui source to run. I think you've seen my call for help discussion. This implementation is running in my own project, but as a new class called NogginFlexLayout, so I'm happy it works, but does need formal tests in place. There were no tests for FlexLayout before so I've based them on the StackLayout ones. |
This all looks good, so rather than hold things up waiting for tests, I'm going to go ahead and merge this. @nogginbox If you want to PR the tests later when you have a working dev environment again, that would be great; otherwise, I'll add some myself when I've got a moment. |
Started unit tests on this draft PR #6800 |
Is FlexLayout sizing only fixed for Windows or should it work in Android in RC3 as well? |
This fix should work in all OS versions as there is no OS specific code in it. I did not test in Android though. If the layout is correct on the first draw and only breaks when the size changes, then that sounds like a different issue. |
This is my page
It's the other way around, it doesn't calculate size correctly on the first draw. First image is Android(Android 11 Api 30), second is Windows. |
If it draws fine after a redraw then it seems like a different bug. It seems like the Measure method I fixed is not being called at all, or the things it is trying to measure do not have size yet. Either way I think it needs a new bug ticket. No one will be tracking comments on a fixed PR. |
Description of Change
I've fixed
FlexLayoutManager.Measure
so that it measures its children's frames to work out the bounding box of the content. The current implementation ignores the children completely.This code sample behaves as expected and is sized correctly based on the content:
The implementation was inspired and informed by StackLayoutManager.Measure.
Issues Fixed