cupertino_back_gesture icon indicating copy to clipboard operation
cupertino_back_gesture copied to clipboard

Allow the back gesture to not override any other gesture that is not in the same direction

Open Bricktheworld opened this issue 5 years ago • 3 comments
trafficstars

Basically I have a bunch of dismissible views, but when I use this plugin with the whole page set as the swipe back gesture, I am unable to dismiss my views in the other direction. Would it be possible to make it so that the gesture does not override these (meaning the right to left gesture) and only the left to right gesture?

Thank you! Love the plugin btw

Bricktheworld avatar Mar 27 '20 20:03 Bricktheworld

Honestly I don't have deep understanding how does gesture disambiguation works in Flutter.

The way I've made this package is

  1. Forked CupertinoPageRoute class from Flutter source
  2. Replaced constant back gesture width (20.0) with configurable one

PiN73 avatar Mar 30 '20 17:03 PiN73

Swipe detection in CupertinoPageRoute is implemented this way:

Stack(
  fit: StackFit.passthrough,
  children: <Widget>[
    widget.child,
    PositionedDirectional(
      start: 0.0,
      width: dragAreaWidth,
      top: 0.0,
      bottom: 0.0,
      child: Listener(
        onPointerDown: _handlePointerDown,
        behavior: HitTestBehavior.translucent,
      ),
    ),
  ],
)

e.g. Listener in on top of the page content. So it captures horizontal swipes that occurs on its area.

There exists an issue about CupertinoPageRoute's swipe precedence. OP wants to make Slider draggable from the very left edge of the screen

PiN73 avatar Mar 30 '20 17:03 PiN73

should be fixed on #7

theSharpestTool avatar Oct 19 '20 19:10 theSharpestTool