Created
March 1, 2018 14:44
-
-
Save anilcancakir/a62291607aad8cb9d4331d2581563511 to your computer and use it in GitHub Desktop.
HomePage class for my routing story.
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'; | |
| // Home page... | |
| class HomePage extends StatefulWidget { | |
| @override | |
| State<StatefulWidget> createState() { | |
| return new _HomePageState(); | |
| } | |
| } | |
| class _HomePageState extends State<HomePage> { | |
| @override | |
| Widget build(BuildContext context) { | |
| return new Scaffold( | |
| appBar: new AppBar( | |
| title: new Text('Home') | |
| ), | |
| body: new ListView( | |
| children: <Widget>[ | |
| new RaisedButton( | |
| onPressed: () { | |
| // Replace user page to "splash" page. | |
| Navigator.pushReplacementNamed(context, 'splash'); | |
| }, | |
| child: new Text('Start again.') | |
| ), | |
| new FlatButton( | |
| onPressed: () { | |
| // Redirect to user "about" page. | |
| Navigator.pushNamed(context, 'about'); | |
| }, | |
| child: new Text('About') | |
| ) | |
| ], | |
| ) | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment