flutter - Get notification when user pauses dragging
问题描述
is there a way to get notified when user stops dragging over the screen (using GestureDetector
) when the finger is still on the screen? After lifting the finger I do get DragEndDetails
event. What I need is sort of "user paused scrolling". Current behaviour is: while moving the finger I do get DragUpdateDetails
but when I stop dragging (finger on the screen, drag velocity is 0) neither DragUpdateDetails nor DragEndDetails are fired.
Cheers.
解决方案
当您收到拖动更新事件时,您可以设置一个计时器(例如 1 秒)。
如果在此期间没有发生拖动更新(或仅发生最小拖动),则触发您的回调。否则,如果有明显的移动,重新启动计时器...
当拖动被取消或手指被移除或小部件被释放时,取消定时器。
推荐阅读
- javascript - 无法读取未定义的“fn”属性?
- javascript - 使用 onBlur 隐藏表单,但这与提交按钮有冲突
- git - 是否可以从我的 GitHub 个人资料中隐藏某些活动?
- flutter - 颤振有任何与 android spinner 等效的小部件吗?
- google-cloud-dataflow - 如何使用 Apache Beam Direct 运行器通过 GOOGLE_APPLICATION_CREDENTIALS 进行身份验证
- python - 添加不同大小的熊猫数据帧的值
- hadoop - 在 hive 现有故事中添加新列
- c - 如何在我的 C 编译器代码中包含(导入)安装库(MPI)?
- sql - 使用 SQL Server 获取表中所有日期范围的所有日期
- c# - 网络核心错误当前上下文中不存在名称“Ok”