Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Simplify SafeArea test for maintainBottomViewPadding to ensure maintainBottomViewPadding is always respected #97646

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

Merged

Conversation

joellurcook
Copy link
Contributor

@joellurcook joellurcook commented Feb 2, 2022

Recent flutter engine changes enable iOS MediaQuery bottom viewInsets and padding to be !=0 simultaneously (see flutter/engine#29281).
This condition resulted in SafeArea maintainBottomViewPadding being ignored during keyboard animation.
This commit forces use of viewPadding.bottom when maintainBottomViewPadding is true.

Before After
https://user-images.githubusercontent.com/55881597/152152622-1f9c8400-ca6b-4ea5-b58c-cff7c7b806d9.mp4 https://user-images.githubusercontent.com/55881597/152152697-75ecfeaf-1ea5-4eb0-a224-f4cefa8744d8.mp4

This fixes the following issue:
fixes #97609.

No changes to existing tests.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Recent flutter engine changes enable iOS MediaQuery bottom viewInsets and padding to be !=0 simultaneously. This condition resulted in maintainBottomViewPadding being ignored.
This commit forces use of viewPadding.bottom when maintainBottomViewPadding is true.
Resolves issue flutter#97609.
@flutter-dashboard flutter-dashboard bot added the framework flutter/packages/flutter repository. See also f: labels. label Feb 2, 2022
@joellurcook
Copy link
Contributor Author

I offer the following justification for the much-simplified condition concerning bottom padding:

Assuming maintainBottomViewPadding is true and knowing that padding is calculated...

  • If viewInsets >= viewPadding (padding = 0), we should use viewPadding (this was the case previously)
  • If 0 < viewInsets < viewPadding (padding = viewPadding - viewInsets), we should use viewPadding (this represents animating keyboard, and fixes the graphical glitch)
  • If viewInsets == 0 (padding = viewPadding), there is no difference between padding and viewPadding

In all cases, it is valid to use viewPadding when maintainBottomViewPadding is true. This is also semantically aligned with the property name itself, which does not imply conditional behaviour based on viewInsets/padding.

Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @joellurcook, thanks for the contribution! Just a few nits below per the style guide. Thanks for fixing this!

@Piinks Piinks added a: quality A truly polished experience a: fidelity Matching the OEM platforms better labels Feb 17, 2022
@goderbauer goderbauer requested a review from Piinks February 23, 2022 23:00
@joellurcook
Copy link
Contributor Author

I assume the failing checks are unrelated to the PR content - is there a simple way to prod the checks to be performed again?

Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flutter_LGTM

The failing checks are unrelated to your PR, if you rebase to update with the latest from the master branch, they should pass. Thanks again!

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fluttergithubbot fluttergithubbot merged commit 95d1fab into flutter:master Mar 3, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 3, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 3, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 3, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 3, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 3, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 3, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 11, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 11, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 11, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 11, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 11, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 11, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 11, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 11, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 12, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: fidelity Matching the OEM platforms better a: quality A truly polished experience framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[IOS] SafeArea maintainBottomViewPadding is not respected when keyboard viewInsets are animated
4 participants