dbenitez-bcn / solid_bottom_sheet

Apache License 2.0
58 stars 19 forks source link

Hot to Control bottom sheet with gestures from body? #12

Closed TatsuUkraine closed 4 years ago

TatsuUkraine commented 4 years ago

Question is: How to make the bottom sheet controlled by gestures from the body? I need to wire up behavior like you currently did it for the header but on the body.

dbenitez-bcn commented 4 years ago

Currently, there is no way provided by the package to do this behaviour. However, you can try to wrap your body code inside a GestureDetector and set a callback for onVerticalDragUpdate property. This callback should call the hide/show method of your SolidController to hide or show your body.

If it doesn't work for you, I can try to add a property named "canDragOnBody" or something like this to enable this behaviour on the body, but I'm afraid that if you have an scrollable element inside the body you are not going to be able to scroll it because you will be always hiding the bottom sheet.

TatsuUkraine commented 4 years ago

However, you can try to wrap your body code inside a GestureDetector and set a callback for onVerticalDragUpdate property.

I was thinking about this, but I to drag (update sheet height) based on drag delta. The suggested approach won't change hight, it will hide sheet.

If it doesn't work for you, I can try to add a property named "canDragOnBody" or something like this to enable this behaviour on the body, but I'm afraid that if you have an scrollable element inside the body you are not going to be able to scroll it because you will be always hiding the bottom sheet.

true, but the issue is going to be the opposite. Since scroll widget doesn't pass any gesture event bubble up to GestureDetector.

What if extend Controller? For example, add there ability to update height (or value from 0 till 1, that will be delta against maxHeight). In that way it will be possible to manage bottom sheet visibility from outside of your package

TatsuUkraine commented 4 years ago

For example, add there ability to update height (or value from 0 till 1, that will be delta against maxHeight). In that way it will be possible to manage bottom sheet visibility from outside of your package

0 is equal to minHeight, 1 - to maxHeight. So your current show/hide methods in controller will update controller value to 1 or 0 (to remain back capability).

TatsuUkraine commented 4 years ago

Or, maybe other option. Add flag like scrollableBody so when it's true, you will handle drag stuff, when body will be scrolled to edges (it probably also will require to add scroll params to your widget, to pass them down to scrollable body)

dbenitez-bcn commented 4 years ago

What if extend Controller? For example, add there ability to update height (or value from 0 till 1, that will be delta against maxHeight). In that way it will be possible to manage bottom sheet visibility from outside of your package

I like this idea. I will try to see if it can fix this issue.

dbenitez-bcn commented 4 years ago

I will be working on this feature in the next couple of days. If everything goes fine this feature will be available for the 0.1.8 version.

dbenitez-bcn commented 4 years ago

Version 0.1.8 released RIGHT NOW! Added draggableBody boolean to enable the same header drag behaviour on the body widget. Update your package and let me know if it solves your issue. I'm closing this issue tomorrow. Thanks for your support!

TatsuUkraine commented 4 years ago

thank you a lot! I will try it as soon as I get back to my task with a persistent bottom sheet