This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[webview_flutter] Fix iOS WebView ignoring SafeArea widget and iOS 13 WebView scroll indicator showing at random location. #2343
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
great |
cyanglaz
changed the title
[webview_flutter] Fix iOS 13 WebView scroll indicator showing at random location.
[webview_flutter] Fix iOS WebView ignoring SafeArea widget and iOS 13 WebView scroll indicator showing at random location.
Dec 26, 2019
Can we test this somehow? |
@amirh There are 2 tests we can do.
|
… into webview_scrollbar_issue
@bparrishMines This fixes a nasty UI bug on iOS 13. Do you mind taking a look? |
amirh
approved these changes
Jan 10, 2020
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
FlutterSu
pushed a commit
to FlutterSu/flutter-plugins
that referenced
this pull request
Nov 20, 2020
… WebView scroll indicator showing at random location. (flutter#2343)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The WKWebView defaults to have
contentInsetAdjustmentBehavior
as automatic. Which means it adjusts its content inset while there is a safe area(notch) on the screen. In Flutter, we use SafeArea widget to handle the safe area. With this default behavior, even without the SafeArea widget, the content is pushed down (portrait mode), which results a bad UI looks like flutter/flutter#25274. This creates an inconsistency with WebView widget and other flutter widgets, the developers might have a hard time figuring out what caused the issue.By setting
contentInsetAdjustmentBehavior
false, we always ask flutter to handle the content inset and makes the WebView more consistent with flutter's behavior.Note: This change might result your WebView content inset pull up if when running your app on an iOS device with a notch (Which is intended). Wrapping around the WebView with a SafeArea widget will resolve the issue.
On iOS 13, the
automaticallyAdjustsScrollIndicatorInsets
is introduced. To match with our setting forcontentInsetAdjustmentBehavior, we will set
automaticallyAdjustsScrollIndicatorInsets` to false. This will also fix flutter/flutter#41592Related Issues
flutter/flutter#41592
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
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?