1

I've got a ListView in which all the elements are wrapped with a GestureDetector. It seems onTap doesn't fire whilst the ListView is scrolled and is animating. It only fires when the list is perfectly still/doesn't move...

ListView.separated( itemCount: count, physics: BouncingScrollPhysics(), separatorBuilder: (context, _) => VSpace.xxl, itemBuilder: (ctx, idx) => GestureDetector( onTap: () { // DO somethihng }, child: SomeChild(idx), ), ) 

I vaguely remember seeing a GitHub issue about this some months ago but I can't find it.

1 Answer 1

1

That's the expected behavior.

if the page is scrolling and you tap on the screen it stops the scrolling behavior first and then if you tapped on an item it will fire the gesture detector's onTap.

you can try in any other app and you will see this behavior, Facebook, Instagram, etc...

Sign up to request clarification or add additional context in comments.

1 Comment

Good point. Strangely, in my case, the first press pauses the scrolling more than stoping it. It ends up needing 2-3 touches for it to fully stop and register the tap. But yes, you're totally on point

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.