如何检测手势检测器中的向上滑动?
How to detect swipes up in Gesture Detector?
我知道向下滑动检测有 onVerticalDragDown
但向上滑动检测 GestureDetector
小部件中没有 onVerticalDragUp
参数。
您正在 GestureDetector class.
中寻找 onPanUpdate 方法
GestureDetector(onPanUpdate: (details) {
if (details.delta.dx > 0)
print("Dragging in +X direction");
else
print("Dragging in -X direction");
if (details.delta.dy > 0)
print("Dragging in +Y direction");
else
print("Dragging in -Y direction");
});
注意:不要将此方法与您已经在使用的方法 (onVerticalDragDown) 或 onVerticalDragUpdate() 一起使用。
我知道向下滑动检测有 onVerticalDragDown
但向上滑动检测 GestureDetector
小部件中没有 onVerticalDragUp
参数。
您正在 GestureDetector class.
中寻找 onPanUpdate 方法GestureDetector(onPanUpdate: (details) {
if (details.delta.dx > 0)
print("Dragging in +X direction");
else
print("Dragging in -X direction");
if (details.delta.dy > 0)
print("Dragging in +Y direction");
else
print("Dragging in -Y direction");
});
注意:不要将此方法与您已经在使用的方法 (onVerticalDragDown) 或 onVerticalDragUpdate() 一起使用。