Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect mouse wheel scrolling in flutter web?

Tags:

flutter-web

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?

like image 751
phimath Avatar asked Mar 17 '20 04:03

phimath


1 Answers

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
)
like image 149
royarg Avatar answered Sep 18 '22 16:09

royarg