Sam Cromer
Sam Cromer

Reputation: 2213

Swipe up to navigate to home screen in flutter

We are wanting to implement a "swipe up" feature in our flutter application to navigate to our home screen, we were thinking of having a horizontal line at the bottom of all screens to indicate its there. I am not sure how to implement the gesture detector for this feature.

I have this code in place, it works at times but I think my container needs to be bigger to read the swipe. I'm using this package: "swipedetector 1.2.0".

In emulator mode with a mouse swiping it doesnt work very often but in tablet mode with my Surface it works well. Is there a better way to do this?

SwipeDetector(
         onSwipeUp: () {
           setState(() {

           });
           Navigator.of(context).push(new MaterialPageRoute(builder: (BuildContext context) => new MemberProfile())
            ); },
         child: Container(
             margin: EdgeInsets.only(left: 30.0,top: 100.0, bottom: 30.0, right:30.0),
              child: Row(
             mainAxisAlignment: MainAxisAlignment.end,
               children: <Widget> [ 
                 Text('HELLO SWIPE ME....'),

Upvotes: 2

Views: 6607

Answers (1)

ShadowPenguin
ShadowPenguin

Reputation: 106

i think the Library you use has some limitations on how fast you have to swipe by default. However you probably don’t even need the library. In my App, I use this:

GestureDetector(
      onVerticalDragUpdate: (dragUpdateDetails) {
        Navigator.of(context).pop();
      },

Upvotes: 8

Related Questions