Skip to content

Commit

Permalink
🚧 remove new keyword to get inline with dart 2 code standard.
Browse files Browse the repository at this point in the history
  • Loading branch information
nisrulz committed Jul 23, 2019
1 parent e8b433c commit 6d56bfc
Show file tree
Hide file tree
Showing 45 changed files with 438 additions and 438 deletions.
26 changes: 13 additions & 13 deletions dropdown_button/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:flutter/material.dart';

void main() => runApp(new MyApp());
void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return new MyAppState();
return MyAppState();
}
}

Expand All @@ -23,9 +23,9 @@ class MyAppState extends State<MyApp> {
}

List<DropdownMenuItem<String>> buildAndGetDropDownMenuItems(List fruits) {
List<DropdownMenuItem<String>> items = new List();
List<DropdownMenuItem<String>> items = List();
for (String fruit in fruits) {
items.add(new DropdownMenuItem(value: fruit, child: new Text(fruit)));
items.add(DropdownMenuItem(value: fruit, child: Text(fruit)));
}
return items;
}
Expand All @@ -38,20 +38,20 @@ class MyAppState extends State<MyApp> {

@override
Widget build(BuildContext context) {
return new MaterialApp(
return MaterialApp(
debugShowCheckedModeBanner: false,
home: new Scaffold(
appBar: new AppBar(
title: new Text("DropDown Button Example"),
home: Scaffold(
appBar: AppBar(
title: Text("DropDown Button Example"),
),
body: new Container(
child: new Center(
child: new Column(
body: Container(
child: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text("Please choose a fruit: "),
new DropdownButton(
Text("Please choose a fruit: "),
DropdownButton(
value: _selectedFruit,
items: _dropDownMenuItems,
onChanged: changedDropDownItem,
Expand Down
14 changes: 7 additions & 7 deletions enabling_splash_screen/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import 'package:flutter/material.dart';

void main() => runApp(new MyApp());
void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new MaterialApp(
return MaterialApp(
title: 'Flutter Demo',
home: new Scaffold(
appBar: new AppBar(
title: new Text("Splash Screen Example"),
home: Scaffold(
appBar: AppBar(
title: Text("Splash Screen Example"),
),
body: new Center(
child: new Text("Hello World"),
body: Center(
child: Text("Hello World"),
),
),
);
Expand Down
18 changes: 9 additions & 9 deletions google_signin/lib/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ class Home extends StatelessWidget {

@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text("Sign In")),
body: new Container(
return Scaffold(
appBar: AppBar(title: Text("Sign In")),
body: Container(
padding: const EdgeInsets.all(20.0),
child: new Center(
child: new Column(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
showLoading
? new CircularProgressIndicator()
: new RaisedButton(
? CircularProgressIndicator()
: RaisedButton(
onPressed: this.onSignin,
child: new Text("Sign In"),
child: Text("Sign In"),
color: Colors.lightBlueAccent,
),
//new RaisedButton(onPressed: this.onLogout, child: new Text("Logout"), color: Colors.amberAccent),
//RaisedButton(onPressed: this.onLogout, child: Text("Logout"), color: Colors.amberAccent),
],
),
)),
Expand Down
16 changes: 8 additions & 8 deletions google_signin/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import 'home.dart';
import 'user.dart';

void main() {
runApp(new App());
runApp(App());
}

class App extends StatefulWidget {
AppState createState() => new AppState();
AppState createState() => AppState();
}

class AppState extends State<App> {
Expand All @@ -24,7 +24,7 @@ class AppState extends State<App> {
@override
void initState() {
super.initState();
userPage = new Home(
userPage = Home(
onSignin: () {
_signin();
print("Sign");
Expand All @@ -36,11 +36,11 @@ class AppState extends State<App> {

Future<FirebaseUser> _signin() async {
setState(() {
userPage = new Home(onSignin: null, onLogout: _logout, showLoading: true);
userPage = Home(onSignin: null, onLogout: _logout, showLoading: true);
});
FirebaseAuth _auth = FirebaseAuth.instance;
try {
googleSignIn = new GoogleSignIn();
googleSignIn = GoogleSignIn();
GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn();
GoogleSignInAuthentication gauth =
await googleSignInAccount.authentication;
Expand All @@ -51,7 +51,7 @@ class AppState extends State<App> {

setState(() {
_username = user.displayName;
userPage = new User(
userPage = User(
onLogout: _logout,
user: user,
);
Expand All @@ -67,7 +67,7 @@ class AppState extends State<App> {
void _logout() async {
await googleSignIn.signOut();
setState(() {
userPage = new Home(
userPage = Home(
onSignin: () {
_signin();
print("Sign");
Expand All @@ -82,7 +82,7 @@ class AppState extends State<App> {

@override
Widget build(BuildContext context) {
return new MaterialApp(
return MaterialApp(
home: userPage,
);
}
Expand Down
20 changes: 10 additions & 10 deletions google_signin/lib/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ class User extends StatelessWidget {

@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text("Welcome"),
return Scaffold(
appBar: AppBar(
title: Text("Welcome"),
actions: <Widget>[
new IconButton(
icon: new Icon(Icons.exit_to_app), onPressed: this.onLogout)
IconButton(
icon: Icon(Icons.exit_to_app), onPressed: this.onLogout)
],
),
body: new Container(
body: Container(
padding: const EdgeInsets.all(20.0),
child: new Center(
child: new Column(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Image.network(user.photoUrl),
new Text(
Image.network(user.photoUrl),
Text(
user.displayName,
textScaleFactor: 1.5,
),
Expand Down
12 changes: 6 additions & 6 deletions grid_layout/lib/gridview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ import 'package:flutter/material.dart';

class MyGridView {
Card getStructuredGridCell(name, image) {
return new Card(
return Card(
elevation: 1.5,
child: new Column(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
verticalDirection: VerticalDirection.down,
children: <Widget>[
new Image(image: new AssetImage('data_repo/img/' + image)),
new Center(
child: new Text(name),
Image(image: AssetImage('data_repo/img/' + image)),
Center(
child: Text(name),
)
],
));
}

GridView build() {
return new GridView.count(
return GridView.count(
primary: true,
padding: const EdgeInsets.all(1.0),
crossAxisCount: 2,
Expand Down
12 changes: 6 additions & 6 deletions grid_layout/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import 'package:flutter/material.dart';
import 'package:grid_layout/gridview.dart';

void main() => runApp(new MyApp());
void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
final MyGridView myGridView = new MyGridView();
final MyGridView myGridView = MyGridView();

@override
Widget build(BuildContext context) {
return new MaterialApp(
return MaterialApp(
debugShowCheckedModeBanner: false,
home: new Scaffold(
appBar: new AppBar(
home: Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: new Text("GridView Example"),
title: Text("GridView Example"),
),
body: myGridView.build(),
),
Expand Down
6 changes: 3 additions & 3 deletions handling_routes/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
));
}
20 changes: 10 additions & 10 deletions handling_routes/lib/screens/about.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
Expand Down
20 changes: 10 additions & 10 deletions handling_routes/lib/screens/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
Expand Down
Loading

0 comments on commit 6d56bfc

Please sign in to comment.