PiN73 / cupertino_back_gesture

Flutter package to set custom width of iOS back swipe gesture area
BSD 3-Clause "New" or "Revised" License
30 stars 17 forks source link

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

Open Bricktheworld opened 4 years ago

Bricktheworld commented 4 years ago

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

PiN73 commented 4 years ago

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 1) Replaced constant back gesture width (20.0) with configurable one

PiN73 commented 4 years ago

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

theSharpestTool commented 3 years ago

should be fixed on #7