update: cleanup and refactoring

This commit is contained in:
Nishant Srivastava
2018-01-19 04:07:07 +05:30
parent f257e0898d
commit ee49612fca
6 changed files with 8 additions and 16 deletions

View File

@ -1,15 +1,14 @@
import 'package:flutter/material.dart';
import './AboutPage.dart';
import './HomePage.dart';
import 'package:handling_routes/screens/about.dart';
import 'package:handling_routes/screens/home.dart';
void main() {
runApp(new MaterialApp(
home: new HomePage(),
home: new HomePage(), // home has implicit route set at '/'
// Setup routes
routes: <String, WidgetBuilder>{
// Set named routes
"/about": (BuildContext context) => new AboutPage(),
AboutPage.routeName: (BuildContext context) => new AboutPage(),
},
));
}

View File

@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
class AboutPage extends StatelessWidget {
static const String routeName = "/about";
@override
Widget build(BuildContext context) {
return new Scaffold(

View File

@ -1,9 +0,0 @@
import 'package:flutter/material.dart';
import 'package:navigation_drawer/screens/account.dart';
import 'package:navigation_drawer/screens/home.dart';
import 'package:navigation_drawer/screens/settings.dart';
class NavDrawer {
}

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
class AccountScreen extends StatelessWidget {
static String routeName = "/account";
static const String routeName = "/account";
@override
Widget build(BuildContext context) {

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
class SettingsScreen extends StatelessWidget {
static String routeName = "/settings";
static const String routeName = "/settings";
@override
Widget build(BuildContext context) {