Created
April 23, 2018 18:11
-
-
Save tmenyhart/8b2effb175398f91098de38a005627f3 to your computer and use it in GitHub Desktop.
Flutter Kickstart - Navigation, material page route
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'package:flutter_example/widgets/details_screen_widget.dart'; | |
| class ListScreenWidget extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return new Center( | |
| child: new Column( | |
| mainAxisAlignment: MainAxisAlignment.center, | |
| children: <Widget>[ | |
| new Text('List Screen!'), | |
| new RaisedButton( | |
| onPressed: () => _navigateToDetailsScreen(context), | |
| child: new Text('Navigate to ListScreen!'), | |
| ), | |
| new RaisedButton( | |
| onPressed: () => Navigator.of(context).pop(), | |
| child: new Text('Back to HomeScreen!'), | |
| ) | |
| ], | |
| ), | |
| ); | |
| } | |
| void _navigateToDetailsScreen(BuildContext context) { | |
| Navigator.push( | |
| context, | |
| new MaterialPageRoute( | |
| builder: (context) => new DetailsScreen(), | |
| ), | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment