Home > Software engineering >  Swipe back in flutter. without any button
Swipe back in flutter. without any button

Time:01-31

How Can I swipe for back in Flutter? not tap back button. Without any button...... Just swipe from left to right. And go to the back page enter image description here

CodePudding user response:

you can wrap your screen widget with gesture detector and on detecting swipe left you can pop the screen like this

GestureDetector(
  onPanUpdate: (details) {
    if (details.delta.dx > 0) {
      Navigator.of(context).pop();
    }
  },
  child: Scaffold(
    body: ///your body
  ),
);

Edit:

The above solution was the one that came to my mind and i got another answer on stack-overflow maybe that one is the correct way to do it here is the answer https://stackoverflow.com/a/55577584/14466860

  • Related