From c22306093256bbfc420b62e9ec8f49c4c81f24ab Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Thu, 4 Mar 2021 17:47:43 -0800 Subject: [PATCH] More checks --- .../example/integration_test/webview_flutter_test.dart | 6 ++++-- packages/webview_flutter/lib/webview_flutter.dart | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/webview_flutter/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/example/integration_test/webview_flutter_test.dart index beabe579de23..1602eef2415a 100644 --- a/packages/webview_flutter/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/example/integration_test/webview_flutter_test.dart @@ -823,7 +823,7 @@ void main() { }); }); - group('$SurfaceAndroidWebView', () { + group('SurfaceAndroidWebView', () { setUpAll(() { WebView.platform = SurfaceAndroidWebView(); }); @@ -902,6 +902,8 @@ void main() { testWidgets('inputs are scrolled into view when focused', (WidgetTester tester) async { + expect(Platform.isAndroid, isTrue); + final String scrollTestPage = ''' @@ -1004,7 +1006,7 @@ void main() { viewportRectRelativeToViewport['right'], isTrue); }); - }, skip: !Platform.isAndroid); + }, skip: Platform.isAndroid ? false : 'Platform isn\'t Android'); group('NavigationDelegate', () { final String blankPage = ""; diff --git a/packages/webview_flutter/lib/webview_flutter.dart b/packages/webview_flutter/lib/webview_flutter.dart index 22dd00e485c4..56315b6692a5 100644 --- a/packages/webview_flutter/lib/webview_flutter.dart +++ b/packages/webview_flutter/lib/webview_flutter.dart @@ -3,6 +3,7 @@ // found in the LICENSE file. import 'dart:async'; +import 'dart:io'; import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; @@ -85,6 +86,7 @@ class SurfaceAndroidWebView extends AndroidWebView { Set>? gestureRecognizers, required WebViewPlatformCallbacksHandler webViewPlatformCallbacksHandler, }) { + assert(Platform.isAndroid); assert(webViewPlatformCallbacksHandler != null); return PlatformViewLink( viewType: 'plugins.flutter.io/webview',