Detect swipes in Flutter!

GestureDetector(
onTap: () {
print('Widget Tapped');
},
child: Container(),
),
onHorizontalDragUpdate: (details) {
if (details.delta.direction > 0) {
Navigator.of(context).push(MaterialPageRoute(builder: (context) => Page2()));
}
},
onVerticalDragUpdate: (details) {},
onHorizontalDragUpdate: (details) {
if (details.delta.direction > 0) {
Navigator.of(context).push(MaterialPageRoute(builder: (context) => Page2()));
}
},
onVerticalDragUpdate: (details) {},
onHorizontalDragUpdate: (details) {
if (details.delta.direction <= 0) {
Navigator.pop(context);
}
},

Don’t forget to connect with me on:

Don’t stop, until you are breathing!💙
- Abhishek Doshi

--

--

--

Google Developer Expert — Dart, Flutter & Firebase 💙💛

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Crio Winter Of Doing Stage1 Exprience

Append/Concat/Join/Merge/ — Demystified

5 Principles For Greater Living in 2021

The Last Inefficient Marketplace

A guide to connecting to EC2 Instances with secret keys

Modeling Environments with Linkerd Ingress (Part 3/3)

Extending Katib

Using JIRA to Solve Agile Problems

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abhishek Doshi

Abhishek Doshi

Google Developer Expert — Dart, Flutter & Firebase 💙💛

More from Medium

Flutter Freezed — The complete Crashcourse

Flutter Navigation with AutoRoute

Creating a Flutter Project Template

How To Remove Debug Mode Tag In Flutter Application?