1
1
import 'package:flutter/material.dart' ;
2
2
3
- void main () => runApp (new MyApp ());
3
+ void main () => runApp (MyApp ());
4
4
5
5
class MyApp extends StatefulWidget {
6
6
@override
7
7
State <StatefulWidget > createState () {
8
- return new MyAppState ();
8
+ return MyAppState ();
9
9
}
10
10
}
11
11
@@ -23,9 +23,9 @@ class MyAppState extends State<MyApp> {
23
23
}
24
24
25
25
List <DropdownMenuItem <String >> buildAndGetDropDownMenuItems (List fruits) {
26
- List <DropdownMenuItem <String >> items = new List ();
26
+ List <DropdownMenuItem <String >> items = List ();
27
27
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)));
29
29
}
30
30
return items;
31
31
}
@@ -38,20 +38,20 @@ class MyAppState extends State<MyApp> {
38
38
39
39
@override
40
40
Widget build (BuildContext context) {
41
- return new MaterialApp (
41
+ return MaterialApp (
42
42
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" ),
46
46
),
47
- body: new Container (
48
- child: new Center (
49
- child: new Column (
47
+ body: Container (
48
+ child: Center (
49
+ child: Column (
50
50
crossAxisAlignment: CrossAxisAlignment .center,
51
51
mainAxisAlignment: MainAxisAlignment .center,
52
52
children: < Widget > [
53
- new Text ("Please choose a fruit: " ),
54
- new DropdownButton (
53
+ Text ("Please choose a fruit: " ),
54
+ DropdownButton (
55
55
value: _selectedFruit,
56
56
items: _dropDownMenuItems,
57
57
onChanged: changedDropDownItem,
0 commit comments