Skip to content

Instantly share code, notes, and snippets.

@anilcancakir
Created March 1, 2018 14:44
Show Gist options
  • Select an option

  • Save anilcancakir/a62291607aad8cb9d4331d2581563511 to your computer and use it in GitHub Desktop.

Select an option

Save anilcancakir/a62291607aad8cb9d4331d2581563511 to your computer and use it in GitHub Desktop.
HomePage class for my routing story.
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