JonasWanke/swipeable_page_route

v0.2.1 does not swipe from left

aqwert opened this issue · 7 comments

Upgrading to v0.2.1 stopped the left swiping of pages to work. Using v0.1.6 with no other changes it works like a charm,

Only thing I changed (besides the version) was to go from onlySwipeFromEdge: true to canOnlySwipeFromEdge: true

Flutter doctor:
[✓] Flutter (Channel stable, 2.0.1, on Mac OS X 10.15.5 19F101 darwin-x64, locale en-NZ)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.54.1)
[✓] Connected device (2 available)

Could you please add some code that reproduces the problem? The example app included in this project demonstrates the canOnlySwipeFromEdge parameter and works fine.

Ideally I will be able to do this. It is on my project at work and would require tracking down why it does not work. Could be down to the routing logic I have. When I have time I will look into it more

I am experiencing the same issue and tracked down the issue that's causing this bug, and it's "WillPopScope" if it is present it will not work.

return WillPopScope(
onWillPop: () async {
return true;
},
child: Scaffold(),
},

Hopefully you can recreate this issue!

@MarekBeers That seems to be the expected behavior: flutter/flutter#14203 discusses that swiping back does not work when using WillPopScope, even if its callback returns true. This package only extends CupertinoPageRoute to allow swiping back from anywhere on the page.

Ooo okay because in version 0.1.6 this plugin worked with WillPopScope.
But thanks anyway!

That's interesting; I can try to investigate that but I'm currently in the process of writing my bachelor's thesis, so it likely won't be until July.

Mystery solved! I added WillPopScope to correct Android back button behavior and now I can't swipe to go back on iOS.

Working around it by setting onWillPop to null when I don't need it. In some cases that is straightforward, and probably what I should have been doing in the first place:

Old:

onWillPop: () async { if (editing) { ... } } : null

New:

onWillPop: editing ? () async { ... } : null

in others, where I really only used it to control Android back button behavior, this works:

onWillPop: defaultTargetPlatform == TargetPlatform.android ? () async { ... } : null,