diff --git a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md index eb4fb0a75d4..cd473ca83f2 100644 --- a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 4.10.7 + +* Replaces use of deprecated Color.value. + ## 4.10.6 * Updates to Pigeon 26. diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart index 38952bf2d75..c1968af7729 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart @@ -648,7 +648,7 @@ class AndroidWebViewController extends PlatformWebViewController { @override Future setBackgroundColor(Color color) => - _webView.setBackgroundColor(color.value); + _webView.setBackgroundColor(color.toARGB32()); @override Future setJavaScriptMode(JavaScriptMode javaScriptMode) => _webView diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/legacy/webview_android_widget.dart b/packages/webview_flutter/webview_flutter_android/lib/src/legacy/webview_android_widget.dart index 3eb236a36c8..937b8bc4e1a 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/legacy/webview_android_widget.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/legacy/webview_android_widget.dart @@ -451,7 +451,7 @@ class WebViewAndroidPlatformController extends WebViewPlatformController { final Color? backgroundColor = creationParams.backgroundColor; if (backgroundColor != null) { - webView.setBackgroundColor(backgroundColor.value); + webView.setBackgroundColor(backgroundColor.toARGB32()); } addJavascriptChannels(creationParams.javascriptChannelNames); diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/legacy/webview_surface_android.dart b/packages/webview_flutter/webview_flutter_android/lib/src/legacy/webview_surface_android.dart index 2fa6015cc1d..048a1d0b5ad 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/legacy/webview_surface_android.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/legacy/webview_surface_android.dart @@ -67,7 +67,7 @@ class SurfaceAndroidWebView extends AndroidWebView { // AndroidViewSurface. This switches the WebView to Hybrid // Composition when the background color is not 100% opaque. hybridComposition: - backgroundColor != null && backgroundColor.opacity < 1.0, + backgroundColor != null && backgroundColor.a < 1.0, id: params.id, viewType: 'plugins.flutter.io/webview', // WebView content is not affected by the Android view's layout direction, diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index 23975074a07..52df6dadf7c 100644 --- a/packages/webview_flutter/webview_flutter_android/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_android description: A Flutter plugin that provides a WebView widget on Android. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 4.10.6 +version: 4.10.7 environment: sdk: ^3.9.0 diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart index 837a184f62e..c97d7fe3143 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart @@ -1868,7 +1868,7 @@ void main() { await controller.setBackgroundColor(Colors.blue); - verify(mockWebView.setBackgroundColor(Colors.blue.value)).called(1); + verify(mockWebView.setBackgroundColor(Colors.blue.toARGB32())).called(1); }); test('setJavaScriptMode', () async { diff --git a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md index 026e71c1b1f..cf2e0271881 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.23.4 + +* Replaces use of deprecated Color.value. + ## 3.23.3 * Updates to Pigeon 26. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/legacy/web_kit_webview_widget.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/legacy/web_kit_webview_widget.dart index 323bf719cde..c18f651cef5 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/legacy/web_kit_webview_widget.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/legacy/web_kit_webview_widget.dart @@ -242,9 +242,11 @@ class WebKitWebViewPlatformController extends WebViewPlatformController { if (params.backgroundColor != null) { unawaited(webView.setOpaque(false)); - unawaited(webView.setBackgroundColor(Colors.transparent.value)); + unawaited(webView.setBackgroundColor(Colors.transparent.toARGB32())); unawaited( - webView.scrollView.setBackgroundColor(params.backgroundColor?.value), + webView.scrollView.setBackgroundColor( + params.backgroundColor?.toARGB32(), + ), ); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart index ae4be03d9a5..3344f88681c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart @@ -651,9 +651,9 @@ class WebKitWebViewController extends PlatformWebViewController { Future setBackgroundColor(Color color) { return Future.wait(>[ _webView.setOpaque(false), - _webView.setBackgroundColor(Colors.transparent.value), + _webView.setBackgroundColor(Colors.transparent.toARGB32()), // This method must be called last. - _webView.scrollView.setBackgroundColor(color.value), + _webView.scrollView.setBackgroundColor(color.toARGB32()), ]); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart index becb15b79a1..51b6e680a32 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart @@ -602,6 +602,9 @@ abstract class WKWebsiteDataStore extends NSObject { ) abstract class UIView extends NSObject { /// The view’s background color. + // TODO(bparrishMines): Using an int here is lossy, and should be replaced + // with a full color representation. See + // https://github.com/flutter/flutter/issues/178870. void setBackgroundColor(int? value); /// A Boolean value that determines whether the view is opaque. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml index b2293914dd3..f78dd2266be 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_wkwebview description: A Flutter plugin that provides a WebView widget based on Apple's WKWebView control. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_wkwebview issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 3.23.3 +version: 3.23.4 environment: sdk: ^3.9.0 diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart index fcfe1f03ab8..ce50c82f63e 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart @@ -240,8 +240,8 @@ void main() { ); verify(mocks.webView.setOpaque(false)); - verify(mocks.webView.setBackgroundColor(Colors.transparent.value)); - verify(mocks.scrollView.setBackgroundColor(Colors.red.value)); + verify(mocks.webView.setBackgroundColor(Colors.transparent.toARGB32())); + verify(mocks.scrollView.setBackgroundColor(Colors.red.toARGB32())); debugDefaultTargetPlatformOverride = null; }); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart index 37c04010f4f..968fbf798d3 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart @@ -841,8 +841,8 @@ void main() { // UIScrollView.setBackgroundColor must be called last. verifyInOrder([ mockWebView.setOpaque(false), - mockWebView.setBackgroundColor(Colors.transparent.value), - mockScrollView.setBackgroundColor(Colors.red.value), + mockWebView.setBackgroundColor(Colors.transparent.toARGB32()), + mockScrollView.setBackgroundColor(Colors.red.toARGB32()), ]); debugDefaultTargetPlatformOverride = null;