Unnecessary new (#20138)

* enable lint unnecessary_new

* fix tests

* fix tests

* fix tests
This commit is contained in:
Alexandre Ardhuin
2018-09-12 08:29:29 +02:00
committed by GitHub
parent d7a0dcaa4a
commit d927c93310
1285 changed files with 26519 additions and 26519 deletions

View File

@@ -11,7 +11,7 @@ export 'controls_constants.dart';
/// A test page with a checkbox, three radio buttons, and a switch.
class SelectionControlsPage extends StatefulWidget {
@override
State<StatefulWidget> createState() => new _SelectionControlsPageState();
State<StatefulWidget> createState() => _SelectionControlsPageState();
}
class _SelectionControlsPageState extends State<SelectionControlsPage> {
@@ -53,13 +53,13 @@ class _SelectionControlsPageState extends State<SelectionControlsPage> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(leading: const BackButton(key: ValueKey<String>('back'))),
body: new Material(
child: new Column(children: <Widget>[
new Row(
return Scaffold(
appBar: AppBar(leading: const BackButton(key: ValueKey<String>('back'))),
body: Material(
child: Column(children: <Widget>[
Row(
children: <Widget>[
new Checkbox(
Checkbox(
key: checkbox1Key,
value: _isChecked,
onChanged: _updateCheckbox,
@@ -72,23 +72,23 @@ class _SelectionControlsPageState extends State<SelectionControlsPage> {
],
),
const Spacer(),
new Row(children: <Widget>[
new Radio<int>(key: radio1Key, value: 0, groupValue: _radio, onChanged: _updateRadio),
new Radio<int>(key: radio2Key, value: 1, groupValue: _radio, onChanged: _updateRadio),
new Radio<int>(key: radio3Key, value: 2, groupValue: _radio, onChanged: _updateRadio),
Row(children: <Widget>[
Radio<int>(key: radio1Key, value: 0, groupValue: _radio, onChanged: _updateRadio),
Radio<int>(key: radio2Key, value: 1, groupValue: _radio, onChanged: _updateRadio),
Radio<int>(key: radio3Key, value: 2, groupValue: _radio, onChanged: _updateRadio),
]),
const Spacer(),
new Switch(
Switch(
key: switchKey,
value: _isOn,
onChanged: _updateSwitch,
),
const Spacer(),
new MergeSemantics(
child: new Row(
MergeSemantics(
child: Row(
children: <Widget>[
const Text(switchLabel),
new Switch(
Switch(
key: labeledSwitchKey,
value: _isLabeledOn,
onChanged: _updateLabeledSwitch,

View File

@@ -11,28 +11,28 @@ export 'text_field_constants.dart';
/// A page with a normal text field and a password field.
class TextFieldPage extends StatefulWidget {
@override
State<StatefulWidget> createState() => new _TextFieldPageState();
State<StatefulWidget> createState() => _TextFieldPageState();
}
class _TextFieldPageState extends State<TextFieldPage> {
final TextEditingController _normalController = new TextEditingController();
final TextEditingController _passwordController = new TextEditingController();
final TextEditingController _normalController = TextEditingController();
final TextEditingController _passwordController = TextEditingController();
final Key normalTextFieldKey = const ValueKey<String>(normalTextFieldKeyValue);
final Key passwordTextFieldKey = const ValueKey<String>(passwordTextFieldKeyValue);
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(leading: const BackButton(key: ValueKey<String>('back'))),
body: new Material(
child: new Column(children: <Widget>[
new TextField(
return Scaffold(
appBar: AppBar(leading: const BackButton(key: ValueKey<String>('back'))),
body: Material(
child: Column(children: <Widget>[
TextField(
key: normalTextFieldKey,
controller: _normalController,
autofocus: false,
),
const Spacer(),
new TextField(
TextField(
key: passwordTextFieldKey,
controller: _passwordController,
obscureText: true,