首页 > 解决方案 > 手势检测器在 3 指滑动时抛出异常

问题描述

我正在使用一个设置为三指滑动时截取屏幕截图的 mi 设备。因此,在我的应用程序中,当我Draggable用三个手指滑动屏幕上的按钮时,mi 会接管手势并截取屏幕截图,我的应用程序会引发异常,导致按钮卡在 UI 中的某个位置。

那么关于如何处理异常的任何想法?

异常日志:

D/ViewRootImpl( 8546): cancle motionEvent because of threeGesture detecting
D/ViewRootImpl( 8546): cancle motionEvent because of threeGesture detecting
D/ViewRootImpl( 8546): cancle motionEvent because of threeGesture detecting
E/flutter ( 8546): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
E/flutter ( 8546): 'package:flutter/src/gestures/converter.dart': Failed assertion: line 250 pos 18: 'state.down': is not true.
E/flutter ( 8546): #0 _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:40:39)
E/flutter ( 8546): #1 _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:36:5)
E/flutter ( 8546): #2 PointerEventConverter.expand (package:flutter/src/gestures/converter.dart:250:18)
E/flutter ( 8546): #3 _SyncIterator.moveNext (dart:core/runtime/libcore_patch.dart:151:12)
E/flutter ( 8546): #4 ListQueue.addAll (dart:collection/queue.dart:715:25)
E/flutter ( 8546): #5 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:83:27)
E/flutter ( 8546): #6 _invoke1 (dart:ui/hooks.dart:168:13)
E/flutter ( 8546): #7 _dispatchPointerDataPacket (dart:ui/hooks.dart:122:5)
D/ViewRootImpl( 8546): cancle motionEvent because of threeGesture detecting
I/chatty ( 8546): uid=10232(org.chimple.jamaica) identical 7 lines
D/ViewRootImpl( 8546): cancle motionEvent because of threeGesture detecting

标签: flutter

解决方案


推荐阅读