Closed pengboboer closed 1 year ago
@akshathjain
I found the following code which manages the gesture slide:
// handles the sliding gesture
void _onGestureSlide(double dy) {
// only slide the panel if scrolling is not enabled
if (!_scrollingEnabled) {
if (widget.slideDirection == SlideDirection.UP)
_ac.value -= dy / (widget.maxHeight - widget.minHeight);
else
_ac.value += dy / (widget.maxHeight - widget.minHeight);
}
......
}
I write this part as a method, the name of the new method is: onChildWidgetPointerMove, and then provide it to the outside through PanelController.
Add this code in PanelController:
void onChildWidgetPointerMove(PointerMoveEvent p) {
_panelState!.onChildWidgetPointerMove(p);
}
Wrapping around our Widget:
Listener(
behavior: HitTestBehavior.opaque,
onPointerMove: (p) => panelController.onChildWidgetPointerMove(p),
child:XxxWidget()
)
This solved my problem and it works fine.
This is my demo, if you need it, I hope it can help you.
Describe the bug
When we use panelBuilder to build our view, we can get a ScrollController. Through this ScrollController, we can realize the linkage between the panel and the ListView. When the ListView slides to the top, and then slides down the panel, the panel will be closed. This is expected behavior
There is a view above the ListView, which we can think of as an appbar. When the ListView scrolls a certain distance, I hope that I can slide to close the panel when I touch and pull down the appbar
At present, there is no response to sliding this position. I know that this library may not support this function, but this interaction will greatly affect the user experience.
like this:
The listview has scrolled up a certain distance.
Expected behavior
When the ListView is scrolled to any position, not only in the initial state, I want that I can swipe down to close this panel by touching the appbar in the red area.