-
Notifications
You must be signed in to change notification settings - Fork 29.8k
[Flutter] Use the correct place for the system navigation bar color adjustment #68102
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
[Flutter] Use the correct place for the system navigation bar color adjustment #68102
Conversation
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.
info: bottom padding shouldn't be divided by _window.devicePixelRatio because everywhere we use native pixels. We should just divide the top padding by two so we get the status bar center.
Before this calculations worked correctly only on 2x screens.
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.
info: I couldn't use view_test.dart file because TestRenderingFlutterBinding it is used there. Those tests uses TestWidgetsFlutterBinding.
Different types of bindings can't be used in the same file.
|
Thanks for this PR. Does this PR also fixes the issues mentioned in #66429 (comment)? |
|
@pedromassango yes it fixes the issue :) |
|
I see some CI failures on this PR:
Can you guys help me solve those problems? |
|
Those failing tests are probably unrelated to the changes so don’t worry about them. They will get fixed once the fix lands into master and you rebase your branch. I would suggest you to verify and add then into Relates issues section so they will also get closed automatically. This avoid having opened issues that were fixed already. |
07cd7dc to
30118d4
Compare
|
⬆️ FYI: I've just rebased my change to the current master branch and now all tests passes! |
|
Since you branched from master when there was an analysis failure, you'll need to pull in the fixes to your local branch. |
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.
Not sure if this is necessary, doesn't each testWidgets get its own binding/render tree? @goderbauer
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.
@jonahwilliams Looks like it's necessary, testWidgets doesn't clear those values by itself.
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.
Explanations make sense, could you leave a detailed comment in the code here?
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.
Can you look at the updated?
30118d4 to
126e792
Compare
126e792 to
2c22116
Compare
goderbauer
left a comment
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
Description
Use the correct place for the system navigation bar color adjustment
Before the fix: the center of the screen were used to adjust navigation bar color.
After the fix: the center of the bottom navigation bar is used to adjust navigation bar color.
For more you can read the following issue: #66429
For example code that shows differences before and after the change you can use https://github.com/jacek-marchwicki/flutter-insets-bug2
Keep in mind, that
window.paddingisn't calculated correctly for translucent navigation bar on Android (issue: #63761) and this is not fixed by the PR.If you have further questions related to this PR, I'm happy to try answering all of them.
Related Issues
Tests
I added the following tests:
Checklist
///). NOT NEEDflutter analyze --flutter-repo) does not report any problems on my PR. (I'll wait for the CI build to pass, because unchanged master branch analyze execution is failing on my computer. But I got success on stable branch)Breaking Change
Did any tests fail when you ran them? Please read [Handling breaking changes].