mirror of
https://github.com/nisrulz/flutter-examples.git
synced 2025-06-17 13:03:30 +08:00
update: cleanup and refactoring
This commit is contained in:
@ -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(),
|
||||
},
|
||||
));
|
||||
}
|
||||
|
@ -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(
|
@ -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 {
|
||||
|
||||
|
||||
}
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user