本文主要是介绍flutter 检测 滑动开始 和滑动停止,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
主要是要分两个状态进行判断
Listener(onPointerUp: (PointerUpEvent event) {
//手指放开屏幕projectDetailController.setPointerDownStatue(false);},onPointerMove: (PointerMoveEvent event) {
//手指一直按住屏幕projectDetailController.setPointerDownStatue(true);},onPointerDown: (PointerDownEvent event) {
//手指按下屏幕projectDetailController.setPointerDownStatue(true);},child: NotificationListener<ScrollNotification>(onNotification: (ScrollNotification notification) {if (notification is ScrollStartNotification) {//手指一直在屏幕上且处于滑动中 再判断处于滑动状态 if (projectDetailController.isPointerDown.isTrue) {projectDetailController.setScolling(true);}} else if (notification is ScrollEndNotification) {projectDetailController.setScolling(false);}return false;},child: Container(),),
)
这篇关于flutter 检测 滑动开始 和滑动停止的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!