mirror of
https://github.com/nisrulz/flutter-examples.git
synced 2025-05-20 06:26:21 +08:00
🚧 remove new keyword to get inline with dart 2 code standard.
This commit is contained in:
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -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,
|
||||
|
Reference in New Issue
Block a user