我知道对于向下滑动检测有onVerticalDragDown
,但是对于向上滑动检测,onVerticalDragUp
小部件中没有GestureDetector
参数。
答案 0 :(得分:1)
您正在寻找GestureDetector类中的 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()一起使用。