-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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 viewInset.bottom and viewPadding.bottom… #21730
Conversation
… for pre android api 30 devices
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. |
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
1 similar comment
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
The pr is ready for review. @GaryQian can you review this? |
This does indeed look like it brings the behavior in line with what is described in https://api.flutter.dev/flutter/widgets/MediaQueryData-class.html. Thanks for the catch. |
The change will also need to be replicated in the equivalent code in |
This PR also needs tests. The best place to put it would probably be in |
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.
See comments above :)
Okay thanks for the review. :) I will look into it this afternoon |
I updated all the files based on your feedback. Regarding the tests, I think that the tests that the available tests should cover my pr, so I only updated them to expect the correct bottomPadding values. Unfortunately I am struggling, getting the engine compiled and running the tests on my windows pc, so I could not check if my changes to the test file are correct. Would you like to do that? :) If you don't have enough time, I would try to things working on my side, but I don't know how long this will take |
I may be able to find some time to look at the tests later this week. In the meantime, it should be possible to look at the pre-submit check logs for details on why tests failed. The relevant tests will generally finish running/fail about 10 min after pushing. You should make sure the tests are changed only for the tests specified for API 29 or below. |
Thats very nice of you. :) |
The android tests seem to be working now. |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
1 similar comment
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
This needs to be rebased on ToT as the failing presubmit has been fixed on master. Also @GaryQian, can you take another look and LGTM please. Thanks. |
Rebase from master
Okay I rebased it :) |
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.
LGTM! Thanks for getting the tests done, and I apologize for not getting to it last week. In any case, thank you for the contribution!
This pull request was opened against a branch other than main. Since Flutter pull requests should not normally be opened against branches other than main, I have changed the base to main. If this was intended, you may modify the base back to master. See the Release Process for information about how other branches get updated. Reviewers: Use caution before merging pull requests to branches other than main, unless this is an intentional hotfix/cherrypick. |
1 similar comment
This pull request was opened against a branch other than main. Since Flutter pull requests should not normally be opened against branches other than main, I have changed the base to main. If this was intended, you may modify the base back to master. See the Release Process for information about how other branches get updated. Reviewers: Use caution before merging pull requests to branches other than main, unless this is an intentional hotfix/cherrypick. |
… for pre android api 30 devices, to enable edge-to-edge navigation on android 10.
Description
Currently the flutter engine sets the bottom inset for the navigation bar into
viewInset.bottom
andviewpadding.bottom
is always 0 on pre api 30 devices.If you are using edge-to-edge on api 30 everything works perfectly fine, but on api 29, which is supporting edge-to-edge, we get some issues:
The
padding.bottom
value is calculated like this:max(0, (viewPadding.bottom - viewInset.bottom))
But if
viewPadding.bottom
is 0 andviewInset.bottom
contains the system navigation bar height, the resultingpadding.bottom
will be 0.So for example the
BottomNavigationBar
widget will not apply bottom padding to have its content on over and not behind the system navigation bar.Related Issues
Tests
I added the following tests:
Replace this with a list of the tests that you added as part of this PR. A
change in behaviour with no test covering it will likely get reverted
accidentally sooner or later. PRs must include tests for all
changed/updated/fixed behaviors. See testing the engine for instructions on
writing and running engine tests.
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.Reviewer Checklist
Breaking Change
Did any tests fail when you ran them? Please read handling breaking changes.