akshathjain / sliding_up_panel

A draggable Flutter widget that makes implementing a SlidingUpPanel much easier!
https://pub.dartlang.org/packages/sliding_up_panel
Other
1.36k stars 377 forks source link

Prevent vertical dragging when touching a specific child widget #305

Open jpcarreira opened 2 years ago

jpcarreira commented 2 years ago

I've been using SlidingUpPanel for a while and, so far, whenever I had the need to stop the vertical drag I would just set the isDragable to false. However, now I have a use case where the panelBuilder builds a given widget that, amongst its children, has a ListView with horizontally-scrollable content and what I'm trying to achieve is preventing the sliding up panel moving up or down when I'm scrolling left or right through that list view.

Is there any easy way of achieving this? I've tried the obvious toggle of isDraggable when a couple of callbacks that detect that horizontal scroll are triggered but that doesn't work as the entire sliding_up_panel is rebuilt when setting isDragable. Also tried a CustomGestureRecognizer on that child widget to prevent vertical swipes of going up but had no success too. Any tips?

nbonamy commented 1 year ago

+1

jpcarreira commented 1 year ago

@nbonamy feel free to take a look at this fork, we've made it work for us.

cer-cer commented 1 year ago

@jpcarreira can you explain how to implement it? i need embed a mapview in this controller, and need to zoom in/out which conflict with this controller...

jpcarreira commented 1 year ago

@jpcarreira can you explain how to implement it? i need embed a mapview in this controller, and need to zoom in/out which conflict with this controller...

Please check the fork, the code I did change on that fork isn't a significant change. It's hard to recall exactly what I did, it's been a few months since I've implemented it.

iosifnicolae2 commented 7 months ago

wouldn't be possible to have this fix backported to the main repo?

iosifnicolae2 commented 7 months ago

@jpcarreira can you explain how to implement it? i need embed a mapview in this controller, and need to zoom in/out which conflict with this controller...

I'm using something like this:

SlidingUpPanel(
    ....
    gestureSlidingEnabled: gestureSlidingEnabled,
)
Listener(
    behavior: HitTestBehavior.translucent,
    onPointerDown: (PointerDownEvent details){
      developer.log("onPointerDown");
      gestureSlidingEnabled = false; // you might need to use setState..
    },
    onPointerUp: (PointerUpEvent details){
      developer.log("onPointerUp");
      gestureSlidingEnabled = true; // you might need to use setState..
    },
    child: Swiper(...)
)
furkancetintass commented 6 months ago

same issue