Navigate to new screen with MaterialPageRoute, disable swipe from left to right to return

615 views
Skip to first unread message

Marc Andrew

unread,
May 31, 2018, 8:52:14 AM5/31/18
to Flutter Dev
Hi,

I have the Navigator to open a new screen with MaterialPageRoute.
Everything is working as expected. From the new screen you can use Navigator.pop to return to the previous screen, but you can also swipe from left to right.
I would like to turn off the swipe from left to right. Is that possible?

Thank you,
Marc

Michael Thomsen

unread,
May 31, 2018, 8:54:15 AM5/31/18
to marc4...@gmail.com, Flutter Dev

--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Marc Andrew

unread,
Jun 1, 2018, 3:07:27 PM6/1/18
to Flutter Dev
Hi Michael,

thank you for getting back to me. I wrapped the Scaffold as a child with WillPopScope.
I included onWillPop as well

onWillPop: () async {
     
return false;
   
},

But I'm still able to swipe back. I don't really understand onWillPop.
Not sure what to change there


Thanks,
Marc
Reply all
Reply to author
Forward
0 new messages