I'm trying to detect when a ListView is scrolled so that I can dismiss the keyboard at that time.

Currently, I have my ListView wrapped in a GestureDetector. The onVerticalDragStart of the gesture detector is set to dismiss the keyboard. However, when I intercept the event like this, it is preventing the drag event from bubbling downward to the ListView so I can't actually scroll the view anymore.

I tried setting behavior: HitTestBehavior.translucent on the GestureDetector but for some reason this didn't do what I wanted. How can I achieve this behavior without subclassing ListView?

Solution 1: Abhi Agarwal

Instead of wrapping the ListView in a GestureDetector, why don't you just add a listener (via the method addListener) to a ScrollController (assuming you already aren't using one) that calls a VoidCallback every time the state changes?

Solution 2: Collin Jackson

I would wrap the ListView in a NotificationListener instead of a GestureDetector.