mcrovero / rubber

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

onTap event instead of defaulting to _onVerticalDragDown when tapping the RubberBottomSheet #35

Open guillaumeprevost opened 5 years ago

guillaumeprevost commented 5 years ago

Is your feature request related to a problem? Please describe. When the RubberBottomSheet is tapped, we need it to have a different behaviour than the default one (in our case, expanding to be higher instead of collapsing to its smallest size), which is currently impossible because tapping is interpreted as a _onVerticalDragDown event by the plugin.

Describe the solution you'd like Adding an Function _onTap property to the Widget, enabling executing a user-defined method when tapping instead of _onVerticalDragDown. This onTap could be optional and call _onVerticalDragDown as a default behaviour, so that existing code relying on it would continue working as before.

Describe alternatives you've considered Not many alternatives possible from outside the plugin. We have tried wrapping the header and/or the content into a GestureDetector to handle the onTap event before it reaches the RubberBottomSheet. but that would also intercept any drag events, making it pointless to use a bottom sheet at all. Similarly also considered putting it behind an transparent overlay (possibly using a Stack widget), but it would have the same effect.

guillaumeprevost commented 5 years ago

Have you had time to look into this issue?

mcrovero commented 5 years ago

Check the latest commit, it should fix the issue. I've added the onTap parameter to the RubberBottomSheet widget. Let me know :)