-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[webview_flutter_android] Adds support for use of old hybrid composition #6063
Conversation
/// Android. It solves multiple issues related to accessibility and interaction | ||
/// with the [WebView] at the cost of some performance on Android versions below | ||
/// 10. See https://github.com/flutter/flutter/wiki/Hybrid-Composition for more | ||
/// information. |
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.
This is no longer true for this AndroidView
. I moved it to the new one.
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.
I believe the parts about accessibility and interaction are still true, relative to VD?
We should document the known tradeoffs of this relative to the other two here. We should also add that to the README for this package, and/or some Flutter docs page somewhere (and then later we can link to that from the main README).
@@ -59,7 +53,8 @@ class SurfaceAndroidWebView extends AndroidWebView { | |||
// WebView content is not affected by the Android view's layout direction, | |||
// we explicitly set it here so that the widget doesn't require an ambient | |||
// directionality. | |||
layoutDirection: TextDirection.rtl, |
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.
This shouldn't be a breaking change for large majority of people. This value is ignored unless support for this is explicitly added to the AndroidManifest.xml
. For example, it is still ltr
in our example app.
|
||
environment: | ||
sdk: ">=2.14.0 <3.0.0" | ||
flutter: ">=2.8.0" | ||
flutter: ">=3.0.0" |
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.
Required for initExpensiveAndroidView
/// To use this, set [WebView.platform] to an instance of this class. | ||
/// | ||
/// This implementation uses hybrid composition to render the [WebView] on | ||
/// Android. It solves multiple issues related to accessibility and interaction |
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.
Now that we have three options, we need to be clear in each one what we are comparing against. E.g., my understanding is that the new mode (I'm just going to call it Mode3 until we pick a name 🙂 ) doesn't have accessibility issues, and that that's specific to the old VirtualDisplay implementation.
The advantage of this one vs. SurfaceAndroidWebView
AFAIK is transparency support on older versions of Android. Are there other know issue with Mode3 relative to HC?
/// Android. It solves multiple issues related to accessibility and interaction | ||
/// with the [WebView] at the cost of some performance on Android versions below | ||
/// 10. See https://github.com/flutter/flutter/wiki/Hybrid-Composition for more | ||
/// information. |
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.
I believe the parts about accessibility and interaction are still true, relative to VD?
We should document the known tradeoffs of this relative to the other two here. We should also add that to the README for this package, and/or some Flutter docs page somewhere (and then later we can link to that from the main README).
@stuartmorgan This is ready for another review. I switched the implementation to use the expensive android view when the background color is set as transparent. Since background color is a creation param, changes to it are ignored after the webview is already built. |
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.
Looks like this is breaking tests on the API 26 device? But otherwise LG.
(Based on the findings I wrote up in flutter/flutter#107313 we have other problems with webview that I hadn't realized before, but this change will still be an incremental improvement.)
@stuartmorgan I reran the test and it passed. I believe it was just a timeout. If you believe this is good, could you approve the PR? |
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
Adds support for Hybrid Composition to deal with: flutter/flutter#104686
Also fixes: flutter/flutter#102284
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.