Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[webview_flutter] Added Android implementation of PlatformWebViewWidget #6686

Merged

Conversation

mvanbeusekom
Copy link
Contributor

@mvanbeusekom mvanbeusekom commented Nov 9, 2022

Adds the Android implementation of the PlatformWebViewWidget to the v4 Android implementation.

Part of issue flutter/flutter#94051

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.
  • [ x] I read and followed the [relevant style guides] and ran [the auto-formatter]. (Unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the [CLA].
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes].
  • I updated CHANGELOG.md to add a description of the change, [following repository CHANGELOG style].
  • 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.

@github-actions github-actions bot added p: webview_flutter Edits files for a webview_flutter plugin platform-android labels Nov 9, 2022
@mvanbeusekom mvanbeusekom marked this pull request as ready for review November 22, 2022 08:40
@mvanbeusekom mvanbeusekom force-pushed the v4_webview_android_webview_widget branch from 01c3845 to fb9203b Compare November 22, 2022 08:41

@override
Widget build(BuildContext context) {
return AndroidView(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this still uses VirtualDisplay. This should use the TLHC implementation with PlatformViewLink and PlatformViewsService.initSurfaceAndroidView:
https://github.com/flutter/plugins/blob/main/packages/webview_flutter/webview_flutter_android/lib/webview_surface_android.dart#L47

Copy link
Contributor

@bparrishMines bparrishMines left a comment

Choose a reason for hiding this comment

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

LGTM with a nit.

It looks like the analyze check is still failing for packages/webview_flutter/webview_flutter_android/lib/src/v4/src/android_webview_controller.dart. It took me a few tries to figure it out since you have to make it work with the current Flutter version and the 2 previous stable versions.

This combination might work:

import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';

And remove foundation and gestures.

@@ -7,7 +7,7 @@ publish_to: none

environment:
sdk: ">=2.17.0 <3.0.0"
flutter: ">=3.0.0"
flutter: ">=3.3.0"
Copy link
Contributor

@bparrishMines bparrishMines Nov 29, 2022

Choose a reason for hiding this comment

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

I debugged the error from the legacy analyze test and it looks like this is the culprit. Updating this version also requires you to update the minimum Flutter version of webview_flutter to 3.3.0.

@mvanbeusekom mvanbeusekom merged commit ab1878c into flutter:v4_webview Dec 7, 2022
@mvanbeusekom mvanbeusekom deleted the v4_webview_android_webview_widget branch December 7, 2022 19:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p: webview_flutter Edits files for a webview_flutter plugin platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants