Closed frmatthew closed 4 years ago
Related to #24 and #70.
Thanks, just read through the threads for #24 and #70. Any chance either this PR or some other mechanism for capturing onTapDown will be implemented?
I put those two refs just to link everything together, I’m actually going to merge this later today because it’s the 3rd request I’ve gotten for it :)
Fantastic. Thanks for the helpful widget!
@frmatthew I found that using onTapDown
was a little too sensitive — the panel would automatically close when the finger first touches the screen. onTap
only causes a close when the user's finger leaves the screen. Maintaining similarity to the Drawer
behavior, I've modified the code a little to look like this:
onVerticalDragEnd: widget.backdropTapClosesPanel ? (DragEndDetails dets){
// only trigger a close if the drag is towards panel close position
if((widget.slideDirection == SlideDirection.UP ? 1 : -1) * dets.velocity.pixelsPerSecond.dy > 0)
_close();
} : null,
onTap: widget.backdropTapClosesPanel ? () => _close() : null,
This allows the user dragging down towards the closed position of the panel to close the panel, as well as taps on the backdrop. This also more closely imitates the Drawer
, which only closes itself once the user's finger leaves the screen.
Nice, thanks.
Right now, the GestureDetector for the backdrop uses onTap for detecting when the panel should be closed. Unfortunately this means that downward swipes in the backdrop--a natural user gesture--don't behave as expected, leaving the panel open still.
By using onTapDown, any gesture, including a swipe and a tap, will effectively close the panel.
Thanks!