mcrovero / rubber

An elastic material bottom sheet implementation for Flutter.
BSD 2-Clause "Simplified" License
562 stars 88 forks source link

GestureDetector in ListView is not working #5

Closed JohannesKaufmann closed 5 years ago

JohannesKaufmann commented 5 years ago

Describe the bug I have a ListView with items similar to the scroll example (which is now working really great by the way πŸ‘). Every item is wrapped in a GestureDetector that is listening for onTap.

There are currently three problems:

Expected behavior I expect that "normal" interactions like onTap are handled by the widgets inside of the modal.

mcrovero commented 5 years ago

Thanks, really appreciated! Check the latest version, it should be fixed.

JohannesKaufmann commented 5 years ago

Great, that was fast! Taps are now properly recognized and the warning is not appearing anymore.

But as soon as it's "expanded" and an item is tapped, it is jumping: The list is animated to a position further up and then animated back to the "expanded" position.

I have two detectors:

What's weird is that when the TapGestureRecognizer detects a onTap the list is not jumping. It only happens with the GestureDetector (it's probably due to it's size). And when the sheet is not fully expanded that jumping does not appear at all.

mcrovero commented 5 years ago

I can't reproduce the error, could you please share the skeleton of your widgets?

JohannesKaufmann commented 5 years ago

I just another look at my code. I still had a _controller.launchTo(AnimationState.half_expanded); in the onTap. Sorry that was my fault πŸ˜‚.

So the bug is actually that launchTo only works for animating upwards (collapsed -> half_expanded -> expanded). And not the other way around (for example collapsing it again). Sorry for wasting your time...

mcrovero commented 5 years ago

No problem πŸ˜„ Thanks for your help!

LcTwisk commented 5 years ago

I'm facing the same problem where taps are not always recognised by the GestureDetector that's used inside a ListView. I'm currently on: rubber: ^0.3.2

I'll prepare an example project so you can reproduce it ;)