Wrap PopupMenuButton in SafeArea to prevent overlap on status bar#55489
Wrap PopupMenuButton in SafeArea to prevent overlap on status bar#55489arthurdenner wants to merge 1 commit into
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Piinks
left a comment
There was a problem hiding this comment.
Hi @arthurdenner thanks for the contribution!
Can you first provide the code you are using to create the screenshots you provided? I am curious that your proposed behavior seems variable across platforms, and it is not clear why. For example, the alignment of the proposed 'few items' example looks very different from iOS to Android. I would think they would produce the same alignment based on the images.
|
@Piinks, both examples are based on The difference you pointed wasn't introduced by this PR because the position is calculated here, way before those widgets, but you couldn't notice so much before since the |
Thanks for clarifying and providing the code! @shihaohong went ahead (and saved us a bunch of time! 🎉 ) checking this against the tests it would undergo during the roll to the dev channel (See Rolling to the dev channel), and it looks like this will be a breaking change. Breaking Changes require a few more steps in order to land, which are laid out in that wiki link. This change will probably need to be phased, with an initial opt-in flag to prevent breaking developers. It will also need tests. It looks like the current framework tests don't check the alignment, so this is awesome that our coverage will be better here! Check out the wiki links I provided and let me know if you need any guidance on proceeding with this change. :) |
|
@arthurdenner would you like to move forward with this change? |
|
Sorry, but unfortunately I can't - forgot to reply here, thanks for the ping. Breaking changes usually take some time and I'm not so familiar with the inner bits of the framework. Last time I tried to implement a breaking change here, it took many days and the PR ended up being closed. 😕 I'd rather leave the changes to someone more experienced with the inner bits and with more time to deal with the interaction. I'd just kindly ask you to update the labels on the linked issue because it's currently tagged as |
|
Hi @Piinks, I would like to proceed with this change based on this pull request. I'm thinking of comparing the status bar height and the first |
Hey @JuYeong0413 thanks for working on a solution for this! I recently wrote a test like this to check safe area, here I included Let me know if this helps in your test writing! Thanks! :) |
|
Thank you for your kind guidance @Piinks! Here are the tests I wrote:
I've tried for several days, but cannot figure out why these tests are giving the same result although the |
|
@JuYeong0413 do you have an open PR with these changes? It may be easier to discuss there. Feel free to ping me on a PR for review. :) |
Description
Currently, if one use a
PopupMenuButton, the widget won't respect the status bar of the device. This is due to the usage ofMediaQuery.removePaddingin one of the inner widgets. Replacing this with aSafeAreasolves the issue. See screenshots below.Android
iOS
Related Issues
Closes #19954.
Tests
All current tests are passing - some of them assert positioning.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.