mirror of
https://github.com/nisrulz/flutter-examples.git
synced 2025-11-08 12:39:17 +00:00
🚧 remove new keyword to get inline with dart 2 code standard.
This commit is contained in:
@@ -3,12 +3,12 @@ import 'package:handling_routes/screens/about.dart';
|
||||
import 'package:handling_routes/screens/home.dart';
|
||||
|
||||
void main() {
|
||||
runApp(new MaterialApp(
|
||||
home: new HomePage(), // home has implicit route set at '/'
|
||||
runApp(MaterialApp(
|
||||
home: HomePage(), // home has implicit route set at '/'
|
||||
// Setup routes
|
||||
routes: <String, WidgetBuilder>{
|
||||
// Set named routes
|
||||
AboutPage.routeName: (BuildContext context) => new AboutPage(),
|
||||
AboutPage.routeName: (BuildContext context) => AboutPage(),
|
||||
},
|
||||
));
|
||||
}
|
||||
|
||||
@@ -5,34 +5,34 @@ class AboutPage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
return Scaffold(
|
||||
// AppBar
|
||||
appBar: new AppBar(
|
||||
appBar: AppBar(
|
||||
// Title
|
||||
title: new Text("About Page"),
|
||||
title: Text("About Page"),
|
||||
// App Bar background color
|
||||
backgroundColor: Colors.blue,
|
||||
),
|
||||
// Body
|
||||
body: new Container(
|
||||
body: Container(
|
||||
// Center the content
|
||||
child: new Center(
|
||||
child: new Column(
|
||||
child: Center(
|
||||
child: Column(
|
||||
// Center content in the column
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
// add children to the column
|
||||
children: <Widget>[
|
||||
// Text
|
||||
new Text(
|
||||
Text(
|
||||
"About Page\nClick on below icon to goto Home Page",
|
||||
// Setting the style for the Text
|
||||
style: new TextStyle(fontSize: 20.0),
|
||||
style: TextStyle(fontSize: 20.0),
|
||||
// Set text alignment to center
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
// Icon Button
|
||||
new IconButton(
|
||||
icon: new Icon(
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.home,
|
||||
color: Colors.red,
|
||||
),
|
||||
|
||||
@@ -3,34 +3,34 @@ import 'package:flutter/material.dart';
|
||||
class HomePage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
return Scaffold(
|
||||
// AppBar
|
||||
appBar: new AppBar(
|
||||
appBar: AppBar(
|
||||
// Title
|
||||
title: new Text("Home Page"),
|
||||
title: Text("Home Page"),
|
||||
// App Bar background color
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
// Body
|
||||
body: new Container(
|
||||
body: Container(
|
||||
// Center the content
|
||||
child: new Center(
|
||||
child: new Column(
|
||||
child: Center(
|
||||
child: Column(
|
||||
// Center content in the column
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
// add children to the column
|
||||
children: <Widget>[
|
||||
// Text
|
||||
new Text(
|
||||
Text(
|
||||
"Home Page\nClick on below icon to goto About Page",
|
||||
// Setting the style for the Text
|
||||
style: new TextStyle(fontSize: 20.0,),
|
||||
style: TextStyle(fontSize: 20.0,),
|
||||
// Set text alignment to center
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
// Icon Button
|
||||
new IconButton(
|
||||
icon: new Icon(
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.info,
|
||||
color: Colors.blue,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user