Navigate to a new screen by going to the next screen with the Route.
I’ve also created a template for all of you below and you can use main.dart for your first load screen, then you should learn how to create a LoginPage() / RegisterPage() function page yourself.
main.dart:
routes: { '/login':(BuildContext context) => LoginPage(), '/register': (BuildContext contaxt) => RegisterPage(), },
login.dart:
Widget _showSubmitBtn() { return Padding( padding: EdgeInsets.only(top: 20.0), child: Column(children: [ RaisedButton( child: Text('Submit', style: Theme.of(context) .textTheme .body1 .copyWith(color: Colors.white)), elevation: 8.0, shape: RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(5.0))), color: Theme.of(context).primaryColor, //onPressed: () => print('submit')), onPressed: () => _submit()), FlatButton( child: Text('New user? Register'), //onPressed: () => print('login')) onPressed: () => Navigator.pushReplacementNamed(context, '/register')) ]) ); }