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

@@ -15,7 +15,7 @@ class ButtonsDemo {
// START buttons_raised
// Create a raised button.
new RaisedButton(
RaisedButton(
child: const Text('BUTTON TITLE'),
onPressed: () {
// Perform some action
@@ -32,7 +32,7 @@ const RaisedButton(
// Create a button with an icon and a
// title.
new RaisedButton.icon(
RaisedButton.icon(
icon: const Icon(Icons.add, size: 18.0),
label: const Text('BUTTON TITLE'),
onPressed: () {
@@ -43,7 +43,7 @@ new RaisedButton.icon(
// START buttons_outline
// Create an outline button.
new OutlineButton(
OutlineButton(
child: const Text('BUTTON TITLE'),
onPressed: () {
// Perform some action
@@ -60,7 +60,7 @@ const OutlineButton(
// Create a button with an icon and a
// title.
new OutlineButton.icon(
OutlineButton.icon(
icon: const Icon(Icons.add, size: 18.0),
label: const Text('BUTTON TITLE'),
onPressed: () {
@@ -71,7 +71,7 @@ new OutlineButton.icon(
// START buttons_flat
// Create a flat button.
new FlatButton(
FlatButton(
child: const Text('BUTTON TITLE'),
onPressed: () {
// Perform some action
@@ -93,7 +93,7 @@ const FlatButton(
String dropdownValue;
// Dropdown button with string values.
new DropdownButton<String>(
DropdownButton<String>(
value: dropdownValue,
onChanged: (String newValue) {
// null indicates the user didn't select a
@@ -105,9 +105,9 @@ new DropdownButton<String>(
},
items: <String>['One', 'Two', 'Free', 'Four']
.map((String value) {
return new DropdownMenuItem<String>(
return DropdownMenuItem<String>(
value: value,
child: new Text(value));
child: Text(value));
})
.toList()
);
@@ -119,7 +119,7 @@ new DropdownButton<String>(
bool value;
// Toggleable icon button.
new IconButton(
IconButton(
icon: const Icon(Icons.thumb_up),
onPressed: () {
setState(() => value = !value);
@@ -131,8 +131,8 @@ new IconButton(
// START buttons_action
// Floating action button in Scaffold.
new Scaffold(
appBar: new AppBar(
Scaffold(
appBar: AppBar(
title: const Text('Demo')
),
floatingActionButton: const FloatingActionButton(
@@ -155,7 +155,7 @@ class SelectionControls {
bool checkboxValue = false;
// Create a checkbox.
new Checkbox(
Checkbox(
value: checkboxValue,
onChanged: (bool value) {
setState(() {
@@ -165,7 +165,7 @@ new Checkbox(
);
// Create a tristate checkbox.
new Checkbox(
Checkbox(
tristate: true,
value: checkboxValue,
onChanged: (bool value) {
@@ -194,19 +194,19 @@ void handleRadioValueChanged(int value) {
}
// Creates a set of radio buttons.
new Row(
Row(
children: <Widget>[
new Radio<int>(
Radio<int>(
value: 0,
groupValue: radioValue,
onChanged: handleRadioValueChanged
),
new Radio<int>(
Radio<int>(
value: 1,
groupValue: radioValue,
onChanged: handleRadioValueChanged
),
new Radio<int>(
Radio<int>(
value: 2,
groupValue: radioValue,
onChanged: handleRadioValueChanged
@@ -228,7 +228,7 @@ const Radio<int>(
bool switchValue = false;
// Create a switch.
new Switch(
Switch(
value: switchValue,
onChanged: (bool value) {
setState(() {
@@ -251,7 +251,7 @@ class GridLists {
// START gridlists
// Creates a scrollable grid list with images
// loaded from the web.
new GridView.count(
GridView.count(
crossAxisCount: 3,
childAspectRatio: 1.0,
padding: const EdgeInsets.all(4.0),
@@ -264,11 +264,11 @@ new GridView.count(
'...',
'https://example.com/image-n.jpg'
].map((String url) {
return new GridTile(
footer: new GridTileBar(
title: new Text(url)
return GridTile(
footer: GridTileBar(
title: Text(url)
),
child: new Image.network(url, fit: BoxFit.cover)
child: Image.network(url, fit: BoxFit.cover)
);
}).toList(),
);
@@ -280,7 +280,7 @@ new GridView.count(
class AnimatedImage {
void animatedImage() {
// START animated_image
new Image.network('https://example.com/animated-image.gif');
Image.network('https://example.com/animated-image.gif');
// END
}
}