From 958dab045b88f6b2079e4d9ada7232cac93d0ad8 Mon Sep 17 00:00:00 2001 From: andreymosin Date: Tue, 9 Nov 2021 14:17:58 +0100 Subject: [PATCH 1/2] update webview --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index d315e3e..d68e803 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,7 +13,7 @@ dependencies: sdk: flutter dogma: ^0.0.1 flutter_android: ^0.8.0 - webview_flutter: ^0.3.22 + webview_flutter: ^2.3.0 dev_dependencies: flutter_test: sdk: flutter From 85ed08458f6d051e763b09806ee4216bcf99a26c Mon Sep 17 00:00:00 2001 From: Vu Luong Trieu Date: Thu, 17 Feb 2022 14:24:47 +0700 Subject: [PATCH 2/2] Add gestureRecognizers. --- lib/src/model_viewer.dart | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/src/model_viewer.dart b/lib/src/model_viewer.dart index 5f67e84..7dfcde3 100644 --- a/lib/src/model_viewer.dart +++ b/lib/src/model_viewer.dart @@ -6,6 +6,8 @@ import 'dart:io' show File, HttpRequest, HttpServer, HttpStatus, InternetAddress, Platform; import 'dart:typed_data' show Uint8List; +import 'package:flutter/foundation.dart'; +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart' show rootBundle; import 'package:flutter_android/android_content.dart' as android_content; @@ -28,7 +30,8 @@ class ModelViewer extends StatefulWidget { this.autoRotateDelay, this.autoPlay, this.cameraControls, - this.iosSrc}) + this.iosSrc, + this.gestureRecognizers}) : super(key: key); /// The background color for the model viewer. @@ -84,6 +87,17 @@ class ModelViewer extends StatefulWidget { /// The URL to a USDZ model which will be used on supported iOS 12+ devices /// via AR Quick Look. final String iosSrc; + + /// Which gestures should be consumed by the web view. + /// + /// It is possible for other gesture recognizers to be competing with the web view on pointer + /// events, e.g if the web view is inside a [ListView] the [ListView] will want to handle + /// vertical drags. The web view will claim gestures that are recognized by any of the + /// recognizers on this list. + /// + /// When this set is empty or null, the web view will only handle pointer events for gestures that + /// were not claimed by any other gesture recognizer. + final Set> gestureRecognizers; @override State createState() => _ModelViewerState(); @@ -122,6 +136,7 @@ class _ModelViewerState extends State { initialUrl: null, javascriptMode: JavascriptMode.unrestricted, initialMediaPlaybackPolicy: AutoMediaPlaybackPolicy.always_allow, + gestureRecognizers: widget.gestureRecognizers, onWebViewCreated: (final WebViewController webViewController) async { _controller.complete(webViewController); final host = _proxy.address.address;