Home > Net >  How to add password when navigating to new page
How to add password when navigating to new page

Time:06-27

I was wondering if it's possible to add something like a password when going to a new screen?

Example: Having a string 'Adwa", if the string is correct, navigates, else dont.

CodePudding user response:

You can try this conditioning to navigate through different pages,

RaisedButton(
                  child: Text('check'),
                  onPressed: () async {
    if (condition) {

      // navigate to the desired route

      Navigator.pushNamed(context, 'page1');

    } else if (condition) {

      // navigate to the desired route

      Navigator.pushNamed(context, 'page2');
    }
  },
 )

  • Related