-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: platform-viewsEmbedding Android/iOS views in Flutter appsEmbedding Android/iOS views in Flutter appsp: webviewThe WebView pluginThe WebView pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallywaiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
Description
The following assertion was thrown while routing a pointer event:
'package:flutter/src/services/platform_views.dart': Failed assertion: line 320 pos 15: 'downTime != null': is not true.
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=BUG.md
When the exception was thrown, this was the stack:
#2 new AndroidMotionEvent (package:flutter/src/services/platform_views.dart:320:15)
#3 _MotionEventsDispatcher.dispatchPointerEvent (package:flutter/src/rendering/platform_view.dart:633:51)
#4 _MotionEventsDispatcher.handlePointerEvent (package:flutter/src/rendering/platform_view.dart:577:5)
#5 _PlatformViewGestureRecognizer.handleEvent (package:flutter/src/rendering/platform_view.dart:511:7)
#6 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:76:12)
...
Event: PointerCancelEvent#df5cb(position: Offset(0.0, 0.0), localPosition: Offset(0.0, -348.3), pointer: 41, kind: touch, down: false, pressure: 0.0)
To reproduce:
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('First Route'),
),
body: ListView(
children: <Widget>[
SizedBox(
height: 500,
child: WebView(
initialUrl: 'https://flutter.io',
javascriptMode: JavascriptMode.unrestricted,
gestureRecognizers: {
Factory<PlatformViewVerticalGestureRecognizer>(
() => PlatformViewVerticalGestureRecognizer()
..onUpdate = (_) {},
),
},
),
),
DropdownButton(
items: [
DropdownMenuItem(
child: Text('first'),
),
DropdownMenuItem(
child: Text('second'),
)
],
onChanged: (value) {},
)
],
),
),
);
}
}
class PlatformViewVerticalGestureRecognizer
extends VerticalDragGestureRecognizer {
PlatformViewVerticalGestureRecognizer({PointerDeviceKind kind})
: super(kind: kind);
Offset _dragDistance = Offset.zero;
@override
void addPointer(PointerEvent event) {
startTrackingPointer(event.pointer);
}
@override
void handleEvent(PointerEvent event) {
_dragDistance = _dragDistance + event.delta;
if (event is PointerMoveEvent) {
final double dy = _dragDistance.dy.abs();
final double dx = _dragDistance.dx.abs();
if (dy > dx && dy > kTouchSlop) {
// vertical drag - accept
resolve(GestureDisposition.accepted);
_dragDistance = Offset.zero;
} else if (dx > kTouchSlop && dx > dy) {
resolve(GestureDisposition.accepted);
// horizontal drag - stop tracking
stopTrackingPointer(event.pointer);
_dragDistance = Offset.zero;
}
}
}
@override
String get debugDescription => 'horizontal drag (platform view)';
@override
void didStopTrackingLastPointer(int pointer) {}
}```
Reproduction steps:
1- Use 2 fingers to pinch on the webview portion, as if you're zooming in/out (zoom doesn't work on Android so it will not react).
2- tap on the dropdown button while you are still pinching with 2 fingers on the webview.
Tested on OnePlus 5T, Android 8.1
NickalasB, DCrow, cmehrabian and ashbin
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: platform-viewsEmbedding Android/iOS views in Flutter appsEmbedding Android/iOS views in Flutter appsp: webviewThe WebView pluginThe WebView pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallywaiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds