fix the bug of DropdownButton popup widget position error#65605
fix the bug of DropdownButton popup widget position error#65605songfei wants to merge 2 commits intoflutter:masterfrom
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. |
There was a problem hiding this comment.
merged manually this changes into 1.22.0-10.0.pre.269 and it works fine for me
|
@HansMuller @goderbauer Is there any progress? |
|
@songfei This change is missing a test. Can you please add one? |
There was a problem hiding this comment.
This is also missing a test case that shows that everything now works correctly when the Navigator is not in fullscreen mode.
|
|
||
| void _handleTap() { | ||
| final RenderBox overlayBox = Overlay.of(context).context.findRenderObject() as RenderBox; | ||
| final Offset overlayOffset = overlayBox.localToGlobal(Offset.zero); |
There was a problem hiding this comment.
Instead of converting both to the global coordinate system, wouldn't it be enough to convert the itemBox to the coordinate system of the overlay by providing an ancestor argument to localToGlobal?
|
@goderbauer I add 2 test case and fix overlay problem, please review |
|
|
||
| void _handleTap() { | ||
| final RenderBox overlayBox = Overlay.of(context).context.findRenderObject() as RenderBox; | ||
| final Offset overlayOffset = overlayBox.localToGlobal(Offset.zero); |
| ), | ||
| ); | ||
|
|
||
| final Finder buttonFinder = find.byKey(buttonKey).last; |
There was a problem hiding this comment.
Why the .last? There should only be one button with this key.
| ); | ||
|
|
||
| final Finder buttonFinder = find.byKey(buttonKey).last; | ||
| final Finder popupFinder = find.byKey(const ValueKey<String>('c')).last; |
| await tester.pumpWidget( | ||
| MaterialApp( | ||
| home: Scaffold( | ||
| // appBar: AppBar(title: const Text('Example')), |
There was a problem hiding this comment.
commented out code. Either remove or comment in if it is needed.
| final Finder buttonFinder = find.byKey(buttonKey).last; | ||
| final Finder popupFinder = find.byKey(const ValueKey<String>('c')).last; |
|
Looks like there's a merge conflict. Can you rebase this to the latest master and resolve the conflict? Thanks. |
|
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
This PR has not been updated in a while, so I am going to close it for now. If you would like to come back and work on this, feel free to re-open. Thank you! |
Description
This bug will happen when the Navigator is not full screen, the code:
Tests
above code ok
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].