diff --git a/ios/Classes/InAppWebView/FlutterWebViewFactory.swift b/ios/Classes/InAppWebView/FlutterWebViewFactory.swift index 74a5b2bf..ce06342e 100755 --- a/ios/Classes/InAppWebView/FlutterWebViewFactory.swift +++ b/ios/Classes/InAppWebView/FlutterWebViewFactory.swift @@ -10,6 +10,7 @@ import Foundation public class FlutterWebViewFactory: NSObject, FlutterPlatformViewFactory { static let VIEW_TYPE_ID = "com.pichillilorenzo/flutter_inappwebview" + static let NON_BLOCKING_VIEW_TYPE_ID = "com.pichillilorenzo/flutter_inappwebview_nonblocking" private var plugin: SwiftFlutterPlugin init(plugin: SwiftFlutterPlugin) { diff --git a/ios/Classes/SwiftFlutterPlugin.swift b/ios/Classes/SwiftFlutterPlugin.swift index 22eaecdc..0cb8e478 100755 --- a/ios/Classes/SwiftFlutterPlugin.swift +++ b/ios/Classes/SwiftFlutterPlugin.swift @@ -44,6 +44,7 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin { self.registrar = registrar registrar.register(FlutterWebViewFactory(plugin: self) as FlutterPlatformViewFactory, withId: FlutterWebViewFactory.VIEW_TYPE_ID) + registrar.register(FlutterWebViewFactory(plugin: self) as FlutterPlatformViewFactory, withId: FlutterWebViewFactory.NON_BLOCKING_VIEW_TYPE_ID, gestureRecognizersBlockingPolicy:FlutterPlatformViewGestureRecognizersBlockingPolicyWaitUntilTouchesEnded) platformUtil = PlatformUtil(plugin: self) inAppBrowserManager = InAppBrowserManager(plugin: self) diff --git a/lib/src/in_app_webview/in_app_webview.dart b/lib/src/in_app_webview/in_app_webview.dart index 64a22036..a2ace2ce 100755 --- a/lib/src/in_app_webview/in_app_webview.dart +++ b/lib/src/in_app_webview/in_app_webview.dart @@ -65,6 +65,8 @@ class InAppWebView extends StatefulWidget implements WebView { ///- iOS final InAppWebViewKeepAlive? keepAlive; + final bool? preventGestureDelay; + ///{@macro flutter_inappwebview.InAppWebView} const InAppWebView({ Key? key, @@ -178,6 +180,7 @@ class InAppWebView extends StatefulWidget implements WebView { this.onContentSizeChanged, this.gestureRecognizers, this.headlessWebView, + this.preventGestureDelay, }) : super(key: key); @override @@ -790,8 +793,11 @@ class _InAppWebViewState extends State { }, ); } else if (Util.isIOS /* || Util.isMacOS*/) { + final viewType = widget.preventGestureDelay == true + ? 'com.pichillilorenzo/flutter_inappwebview_nonblocking' + : 'com.pichillilorenzo/flutter_inappwebview'; return UiKitView( - viewType: 'com.pichillilorenzo/flutter_inappwebview', + viewType: viewType, onPlatformViewCreated: _onPlatformViewCreated, gestureRecognizers: widget.gestureRecognizers, creationParams: {