How to detect mouse wheel scrolling in flutter web?

安稳与你 提交于 2021-02-08 13:25:13

问题


How can you detect mouse wheel scroll in flutter web? It seems like it would be in a gesture detector but I don't see it in there. How do list views detect mouse scroll?


回答1:


Wrap your ListView (or any other scroll view) with Listener and listen for PointerScrollEvent:

Listener(
  onPointerSignal: (pointerSignal){
    if(pointerSignal is PointerScrollEvent){
      // do something when scrolled
      print('Scrolled');
    }
  },
  child: ... //your scrollview here
)


来源:https://stackoverflow.com/questions/60716259/how-to-detect-mouse-wheel-scrolling-in-flutter-web

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!