Created
March 1, 2018 15:02
-
-
Save anilcancakir/cc235d280ae850bbc841491a0715df9c to your computer and use it in GitHub Desktop.
Main 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'; | |
| // Import fluro package. | |
| import 'package:fluro/fluro.dart'; | |
| // Import my pages. | |
| import 'package:app/pages/about.page.dart'; | |
| import 'package:app/pages/home.page.dart'; | |
| import 'package:app/pages/splash.page.dart'; | |
| void main() { | |
| // Create the router. | |
| Router router = new Router(); | |
| // Define our splash page. | |
| router.define('splash', handler: new Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) { | |
| return new SplashPage(); | |
| })); | |
| // Define our home page. | |
| router.define('home', handler: new Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) { | |
| return new HomePage(); | |
| })); | |
| // Define our about page. | |
| router.define('about', handler: new Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) { | |
| return new AboutPage(); | |
| })); | |
| // Run app from splash page! | |
| runApp(new MaterialApp( | |
| title: 'App', | |
| home: new SplashPage(), | |
| onGenerateRoute: router.generator // Use our Fluro routers for this app. | |
| )); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment