Skip to content

Commit 6d56bfc

Browse files
committed
🚧 remove new keyword to get inline with dart 2 code standard.
1 parent e8b433c commit 6d56bfc

File tree

45 files changed

+438
-438
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+438
-438
lines changed

dropdown_button/lib/main.dart

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import 'package:flutter/material.dart';
22

3-
void main() => runApp(new MyApp());
3+
void main() => runApp(MyApp());
44

55
class MyApp extends StatefulWidget {
66
@override
77
State<StatefulWidget> createState() {
8-
return new MyAppState();
8+
return MyAppState();
99
}
1010
}
1111

@@ -23,9 +23,9 @@ class MyAppState extends State<MyApp> {
2323
}
2424

2525
List<DropdownMenuItem<String>> buildAndGetDropDownMenuItems(List fruits) {
26-
List<DropdownMenuItem<String>> items = new List();
26+
List<DropdownMenuItem<String>> items = List();
2727
for (String fruit in fruits) {
28-
items.add(new DropdownMenuItem(value: fruit, child: new Text(fruit)));
28+
items.add(DropdownMenuItem(value: fruit, child: Text(fruit)));
2929
}
3030
return items;
3131
}
@@ -38,20 +38,20 @@ class MyAppState extends State<MyApp> {
3838

3939
@override
4040
Widget build(BuildContext context) {
41-
return new MaterialApp(
41+
return MaterialApp(
4242
debugShowCheckedModeBanner: false,
43-
home: new Scaffold(
44-
appBar: new AppBar(
45-
title: new Text("DropDown Button Example"),
43+
home: Scaffold(
44+
appBar: AppBar(
45+
title: Text("DropDown Button Example"),
4646
),
47-
body: new Container(
48-
child: new Center(
49-
child: new Column(
47+
body: Container(
48+
child: Center(
49+
child: Column(
5050
crossAxisAlignment: CrossAxisAlignment.center,
5151
mainAxisAlignment: MainAxisAlignment.center,
5252
children: <Widget>[
53-
new Text("Please choose a fruit: "),
54-
new DropdownButton(
53+
Text("Please choose a fruit: "),
54+
DropdownButton(
5555
value: _selectedFruit,
5656
items: _dropDownMenuItems,
5757
onChanged: changedDropDownItem,

enabling_splash_screen/lib/main.dart

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import 'package:flutter/material.dart';
22

3-
void main() => runApp(new MyApp());
3+
void main() => runApp(MyApp());
44

55
class MyApp extends StatelessWidget {
66
// This widget is the root of your application.
77
@override
88
Widget build(BuildContext context) {
9-
return new MaterialApp(
9+
return MaterialApp(
1010
title: 'Flutter Demo',
11-
home: new Scaffold(
12-
appBar: new AppBar(
13-
title: new Text("Splash Screen Example"),
11+
home: Scaffold(
12+
appBar: AppBar(
13+
title: Text("Splash Screen Example"),
1414
),
15-
body: new Center(
16-
child: new Text("Hello World"),
15+
body: Center(
16+
child: Text("Hello World"),
1717
),
1818
),
1919
);

google_signin/lib/home.dart

+9-9
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ class Home extends StatelessWidget {
1616

1717
@override
1818
Widget build(BuildContext context) {
19-
return new Scaffold(
20-
appBar: new AppBar(title: new Text("Sign In")),
21-
body: new Container(
19+
return Scaffold(
20+
appBar: AppBar(title: Text("Sign In")),
21+
body: Container(
2222
padding: const EdgeInsets.all(20.0),
23-
child: new Center(
24-
child: new Column(
23+
child: Center(
24+
child: Column(
2525
mainAxisAlignment: MainAxisAlignment.center,
2626
children: <Widget>[
2727
showLoading
28-
? new CircularProgressIndicator()
29-
: new RaisedButton(
28+
? CircularProgressIndicator()
29+
: RaisedButton(
3030
onPressed: this.onSignin,
31-
child: new Text("Sign In"),
31+
child: Text("Sign In"),
3232
color: Colors.lightBlueAccent,
3333
),
34-
//new RaisedButton(onPressed: this.onLogout, child: new Text("Logout"), color: Colors.amberAccent),
34+
//RaisedButton(onPressed: this.onLogout, child: Text("Logout"), color: Colors.amberAccent),
3535
],
3636
),
3737
)),

google_signin/lib/main.dart

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import 'home.dart';
88
import 'user.dart';
99

1010
void main() {
11-
runApp(new App());
11+
runApp(App());
1212
}
1313

1414
class App extends StatefulWidget {
15-
AppState createState() => new AppState();
15+
AppState createState() => AppState();
1616
}
1717

1818
class AppState extends State<App> {
@@ -24,7 +24,7 @@ class AppState extends State<App> {
2424
@override
2525
void initState() {
2626
super.initState();
27-
userPage = new Home(
27+
userPage = Home(
2828
onSignin: () {
2929
_signin();
3030
print("Sign");
@@ -36,11 +36,11 @@ class AppState extends State<App> {
3636

3737
Future<FirebaseUser> _signin() async {
3838
setState(() {
39-
userPage = new Home(onSignin: null, onLogout: _logout, showLoading: true);
39+
userPage = Home(onSignin: null, onLogout: _logout, showLoading: true);
4040
});
4141
FirebaseAuth _auth = FirebaseAuth.instance;
4242
try {
43-
googleSignIn = new GoogleSignIn();
43+
googleSignIn = GoogleSignIn();
4444
GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn();
4545
GoogleSignInAuthentication gauth =
4646
await googleSignInAccount.authentication;
@@ -51,7 +51,7 @@ class AppState extends State<App> {
5151

5252
setState(() {
5353
_username = user.displayName;
54-
userPage = new User(
54+
userPage = User(
5555
onLogout: _logout,
5656
user: user,
5757
);
@@ -67,7 +67,7 @@ class AppState extends State<App> {
6767
void _logout() async {
6868
await googleSignIn.signOut();
6969
setState(() {
70-
userPage = new Home(
70+
userPage = Home(
7171
onSignin: () {
7272
_signin();
7373
print("Sign");
@@ -82,7 +82,7 @@ class AppState extends State<App> {
8282

8383
@override
8484
Widget build(BuildContext context) {
85-
return new MaterialApp(
85+
return MaterialApp(
8686
home: userPage,
8787
);
8888
}

google_signin/lib/user.dart

+10-10
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ class User extends StatelessWidget {
1313

1414
@override
1515
Widget build(BuildContext context) {
16-
return new Scaffold(
17-
appBar: new AppBar(
18-
title: new Text("Welcome"),
16+
return Scaffold(
17+
appBar: AppBar(
18+
title: Text("Welcome"),
1919
actions: <Widget>[
20-
new IconButton(
21-
icon: new Icon(Icons.exit_to_app), onPressed: this.onLogout)
20+
IconButton(
21+
icon: Icon(Icons.exit_to_app), onPressed: this.onLogout)
2222
],
2323
),
24-
body: new Container(
24+
body: Container(
2525
padding: const EdgeInsets.all(20.0),
26-
child: new Center(
27-
child: new Column(
26+
child: Center(
27+
child: Column(
2828
mainAxisAlignment: MainAxisAlignment.center,
2929
children: <Widget>[
30-
new Image.network(user.photoUrl),
31-
new Text(
30+
Image.network(user.photoUrl),
31+
Text(
3232
user.displayName,
3333
textScaleFactor: 1.5,
3434
),

grid_layout/lib/gridview.dart

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ import 'package:flutter/material.dart';
22

33
class MyGridView {
44
Card getStructuredGridCell(name, image) {
5-
return new Card(
5+
return Card(
66
elevation: 1.5,
7-
child: new Column(
7+
child: Column(
88
crossAxisAlignment: CrossAxisAlignment.stretch,
99
mainAxisSize: MainAxisSize.min,
1010
verticalDirection: VerticalDirection.down,
1111
children: <Widget>[
12-
new Image(image: new AssetImage('data_repo/img/' + image)),
13-
new Center(
14-
child: new Text(name),
12+
Image(image: AssetImage('data_repo/img/' + image)),
13+
Center(
14+
child: Text(name),
1515
)
1616
],
1717
));
1818
}
1919

2020
GridView build() {
21-
return new GridView.count(
21+
return GridView.count(
2222
primary: true,
2323
padding: const EdgeInsets.all(1.0),
2424
crossAxisCount: 2,

grid_layout/lib/main.dart

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import 'package:flutter/material.dart';
22
import 'package:grid_layout/gridview.dart';
33

4-
void main() => runApp(new MyApp());
4+
void main() => runApp(MyApp());
55

66
class MyApp extends StatelessWidget {
7-
final MyGridView myGridView = new MyGridView();
7+
final MyGridView myGridView = MyGridView();
88

99
@override
1010
Widget build(BuildContext context) {
11-
return new MaterialApp(
11+
return MaterialApp(
1212
debugShowCheckedModeBanner: false,
13-
home: new Scaffold(
14-
appBar: new AppBar(
13+
home: Scaffold(
14+
appBar: AppBar(
1515
// Here we take the value from the MyHomePage object that was created by
1616
// the App.build method, and use it to set our appbar title.
17-
title: new Text("GridView Example"),
17+
title: Text("GridView Example"),
1818
),
1919
body: myGridView.build(),
2020
),

handling_routes/lib/main.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import 'package:handling_routes/screens/about.dart';
33
import 'package:handling_routes/screens/home.dart';
44

55
void main() {
6-
runApp(new MaterialApp(
7-
home: new HomePage(), // home has implicit route set at '/'
6+
runApp(MaterialApp(
7+
home: HomePage(), // home has implicit route set at '/'
88
// Setup routes
99
routes: <String, WidgetBuilder>{
1010
// Set named routes
11-
AboutPage.routeName: (BuildContext context) => new AboutPage(),
11+
AboutPage.routeName: (BuildContext context) => AboutPage(),
1212
},
1313
));
1414
}

handling_routes/lib/screens/about.dart

+10-10
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,34 @@ class AboutPage extends StatelessWidget {
55

66
@override
77
Widget build(BuildContext context) {
8-
return new Scaffold(
8+
return Scaffold(
99
// AppBar
10-
appBar: new AppBar(
10+
appBar: AppBar(
1111
// Title
12-
title: new Text("About Page"),
12+
title: Text("About Page"),
1313
// App Bar background color
1414
backgroundColor: Colors.blue,
1515
),
1616
// Body
17-
body: new Container(
17+
body: Container(
1818
// Center the content
19-
child: new Center(
20-
child: new Column(
19+
child: Center(
20+
child: Column(
2121
// Center content in the column
2222
mainAxisAlignment: MainAxisAlignment.center,
2323
// add children to the column
2424
children: <Widget>[
2525
// Text
26-
new Text(
26+
Text(
2727
"About Page\nClick on below icon to goto Home Page",
2828
// Setting the style for the Text
29-
style: new TextStyle(fontSize: 20.0),
29+
style: TextStyle(fontSize: 20.0),
3030
// Set text alignment to center
3131
textAlign: TextAlign.center,
3232
),
3333
// Icon Button
34-
new IconButton(
35-
icon: new Icon(
34+
IconButton(
35+
icon: Icon(
3636
Icons.home,
3737
color: Colors.red,
3838
),

handling_routes/lib/screens/home.dart

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,34 @@ import 'package:flutter/material.dart';
33
class HomePage extends StatelessWidget {
44
@override
55
Widget build(BuildContext context) {
6-
return new Scaffold(
6+
return Scaffold(
77
// AppBar
8-
appBar: new AppBar(
8+
appBar: AppBar(
99
// Title
10-
title: new Text("Home Page"),
10+
title: Text("Home Page"),
1111
// App Bar background color
1212
backgroundColor: Colors.red,
1313
),
1414
// Body
15-
body: new Container(
15+
body: Container(
1616
// Center the content
17-
child: new Center(
18-
child: new Column(
17+
child: Center(
18+
child: Column(
1919
// Center content in the column
2020
mainAxisAlignment: MainAxisAlignment.center,
2121
// add children to the column
2222
children: <Widget>[
2323
// Text
24-
new Text(
24+
Text(
2525
"Home Page\nClick on below icon to goto About Page",
2626
// Setting the style for the Text
27-
style: new TextStyle(fontSize: 20.0,),
27+
style: TextStyle(fontSize: 20.0,),
2828
// Set text alignment to center
2929
textAlign: TextAlign.center,
3030
),
3131
// Icon Button
32-
new IconButton(
33-
icon: new Icon(
32+
IconButton(
33+
icon: Icon(
3434
Icons.info,
3535
color: Colors.blue,
3636
),

0 commit comments

Comments
 (0)