More const immutable classes (#9544)
* more widget const constructors
* prefer const constructors
* address review comments
diff --git a/dev/benchmarks/complex_layout/lib/main.dart b/dev/benchmarks/complex_layout/lib/main.dart
index 3162c8c..2075262 100644
--- a/dev/benchmarks/complex_layout/lib/main.dart
+++ b/dev/benchmarks/complex_layout/lib/main.dart
@@ -176,9 +176,9 @@
new ItemDescription(),
new ItemImageBox(),
new InfoBar(),
- new Padding(
+ const Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
- child: new Divider()
+ child: const Divider()
),
new IconBar(),
new FatDivider()
@@ -198,9 +198,9 @@
const UserHeader('Ali Connors'),
new ItemGalleryBox(index),
new InfoBar(),
- new Padding(
+ const Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
- child: new Divider()
+ child: const Divider()
),
new IconBar(),
new FatDivider()
@@ -599,7 +599,7 @@
onChanged: (bool value) { _changeTheme(context, value); },
),
),
- new Divider(),
+ const Divider(),
new ListTile(
leading: const Icon(Icons.hourglass_empty),
title: const Text('Animate Slowly'),
diff --git a/dev/manual_tests/card_collection.dart b/dev/manual_tests/card_collection.dart
index a44cf15..7d96361 100644
--- a/dev/manual_tests/card_collection.dart
+++ b/dev/manual_tests/card_collection.dart
@@ -93,20 +93,20 @@
buildDrawerCheckbox("Fixed size cards", _fixedSizeCards, _toggleFixedSizeCards),
buildDrawerCheckbox("Let the sun shine", _sunshine, _toggleSunshine),
buildDrawerCheckbox("Vary font sizes", _varyFontSizes, _toggleVaryFontSizes, enabled: !_editable),
- new Divider(),
+ const Divider(),
buildDrawerColorRadioItem("Deep Purple", Colors.deepPurple, _primaryColor, _selectColor),
buildDrawerColorRadioItem("Green", Colors.green, _primaryColor, _selectColor),
buildDrawerColorRadioItem("Amber", Colors.amber, _primaryColor, _selectColor),
buildDrawerColorRadioItem("Teal", Colors.teal, _primaryColor, _selectColor),
- new Divider(),
+ const Divider(),
buildDrawerDirectionRadioItem("Dismiss horizontally", DismissDirection.horizontal, _dismissDirection, _changeDismissDirection, icon: Icons.code),
buildDrawerDirectionRadioItem("Dismiss left", DismissDirection.endToStart, _dismissDirection, _changeDismissDirection, icon: Icons.arrow_back),
buildDrawerDirectionRadioItem("Dismiss right", DismissDirection.startToEnd, _dismissDirection, _changeDismissDirection, icon: Icons.arrow_forward),
- new Divider(),
+ const Divider(),
buildFontRadioItem("Left-align text", TextAlign.left, _textAlign, _changeTextAlign, icon: Icons.format_align_left, enabled: !_editable),
buildFontRadioItem("Center-align text", TextAlign.center, _textAlign, _changeTextAlign, icon: Icons.format_align_center, enabled: !_editable),
buildFontRadioItem("Right-align text", TextAlign.right, _textAlign, _changeTextAlign, icon: Icons.format_align_right, enabled: !_editable),
- new Divider(),
+ const Divider(),
new ListTile(
leading: const Icon(Icons.dvr),
onTap: () { debugDumpApp(); debugDumpRenderTree(); },
diff --git a/examples/flutter_gallery/lib/demo/animation/home.dart b/examples/flutter_gallery/lib/demo/animation/home.dart
index 721f740..e86c693 100644
--- a/examples/flutter_gallery/lib/demo/animation/home.dart
+++ b/examples/flutter_gallery/lib/demo/animation/home.dart
@@ -525,7 +525,7 @@
new Positioned(
top: statusBarHeight,
left: 0.0,
- child: new IconTheme(
+ child: const IconTheme(
data: const IconThemeData(color: Colors.white),
child: const BackButton(),
),
diff --git a/examples/flutter_gallery/lib/demo/calculator/home.dart b/examples/flutter_gallery/lib/demo/calculator/home.dart
index 6ace8b9..093804b 100644
--- a/examples/flutter_gallery/lib/demo/calculator/home.dart
+++ b/examples/flutter_gallery/lib/demo/calculator/home.dart
@@ -126,7 +126,7 @@
flex: 2,
child: new CalcDisplay(content: _expression.toString())
),
- new Divider(height: 1.0),
+ const Divider(height: 1.0),
new Expanded(
flex: 3,
child: new KeyPad(calcState: this)
diff --git a/examples/flutter_gallery/lib/demo/contacts_demo.dart b/examples/flutter_gallery/lib/demo/contacts_demo.dart
index fdc5550..95daa37 100644
--- a/examples/flutter_gallery/lib/demo/contacts_demo.dart
+++ b/examples/flutter_gallery/lib/demo/contacts_demo.dart
@@ -116,7 +116,7 @@
icon: const Icon(Icons.create),
tooltip: 'Edit',
onPressed: () {
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
+ _scaffoldKey.currentState.showSnackBar(const SnackBar(
content: const Text('This is actually just a demo. Editing isn\'t supported.')
));
},
@@ -176,7 +176,7 @@
icon: Icons.message,
tooltip: 'Send message',
onPressed: () {
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
+ _scaffoldKey.currentState.showSnackBar(const SnackBar(
content: const Text('Pretend that this opened your SMS application.')
));
},
@@ -189,7 +189,7 @@
icon: Icons.message,
tooltip: 'Send message',
onPressed: () {
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
+ _scaffoldKey.currentState.showSnackBar(const SnackBar(
content: const Text('In this demo, this button doesn\'t do anything.')
));
},
@@ -202,7 +202,7 @@
icon: Icons.message,
tooltip: 'Send message',
onPressed: () {
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
+ _scaffoldKey.currentState.showSnackBar(const SnackBar(
content: const Text('Imagine if you will, a messaging application.')
));
},
@@ -220,7 +220,7 @@
icon: Icons.email,
tooltip: 'Send personal e-mail',
onPressed: () {
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
+ _scaffoldKey.currentState.showSnackBar(const SnackBar(
content: const Text('Here, your e-mail application would open.')
));
},
@@ -233,7 +233,7 @@
icon: Icons.email,
tooltip: 'Send work e-mail',
onPressed: () {
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
+ _scaffoldKey.currentState.showSnackBar(const SnackBar(
content: const Text('This is a demo, so this button does not actually work.')
));
},
@@ -251,7 +251,7 @@
icon: Icons.map,
tooltip: 'Open map',
onPressed: () {
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
+ _scaffoldKey.currentState.showSnackBar(const SnackBar(
content: const Text('This would show a map of San Francisco.')
));
},
@@ -265,7 +265,7 @@
icon: Icons.map,
tooltip: 'Open map',
onPressed: () {
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
+ _scaffoldKey.currentState.showSnackBar(const SnackBar(
content: const Text('This would show a map of Mountain View.')
));
},
@@ -279,7 +279,7 @@
icon: Icons.map,
tooltip: 'Open map',
onPressed: () {
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
+ _scaffoldKey.currentState.showSnackBar(const SnackBar(
content: const Text('This would also show a map, if this was not a demo.')
));
},
diff --git a/examples/flutter_gallery/lib/demo/cupertino/cupertino_activity_indicator_demo.dart b/examples/flutter_gallery/lib/demo/cupertino/cupertino_activity_indicator_demo.dart
index bcd717f..57b100c 100644
--- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_activity_indicator_demo.dart
+++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_activity_indicator_demo.dart
@@ -14,8 +14,8 @@
appBar: new AppBar(
title: const Text('Cupertino Activity Indicator'),
),
- body: new Center(
- child: new CupertinoActivityIndicator(),
+ body: const Center(
+ child: const CupertinoActivityIndicator(),
),
);
}
diff --git a/examples/flutter_gallery/lib/demo/cupertino/cupertino_buttons_demo.dart b/examples/flutter_gallery/lib/demo/cupertino/cupertino_buttons_demo.dart
index 79685ec..cbc6d7b 100644
--- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_buttons_demo.dart
+++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_buttons_demo.dart
@@ -49,7 +49,7 @@
setState(() {_pressedCount++;});
}
),
- new CupertinoButton(
+ const CupertinoButton(
child: const Text('Disabled'),
onPressed: null,
),
@@ -65,7 +65,7 @@
}
),
const Padding(padding: const EdgeInsets.all(12.0)),
- new CupertinoButton(
+ const CupertinoButton(
child: const Text('Disabled'),
color: _kBlue,
onPressed: null,
diff --git a/examples/flutter_gallery/lib/demo/material/buttons_demo.dart b/examples/flutter_gallery/lib/demo/material/buttons_demo.dart
index 92fdadc..249b245 100644
--- a/examples/flutter_gallery/lib/demo/material/buttons_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/buttons_demo.dart
@@ -121,7 +121,7 @@
// Perform some action
},
),
- new FlatButton(
+ const FlatButton(
child: const Text('DISABLED'),
onPressed: null,
)
diff --git a/examples/flutter_gallery/lib/demo/material/drawer_demo.dart b/examples/flutter_gallery/lib/demo/material/drawer_demo.dart
index b922355..2647c77 100644
--- a/examples/flutter_gallery/lib/demo/material/drawer_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/drawer_demo.dart
@@ -67,7 +67,7 @@
void _showNotImplementedMessage() {
Navigator.of(context).pop(); // Dismiss the drawer.
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
+ _scaffoldKey.currentState.showSnackBar(const SnackBar(
content: const Text("The drawer's items don't do anything")
));
}
diff --git a/examples/flutter_gallery/lib/demo/material/expansion_panels_demo.dart b/examples/flutter_gallery/lib/demo/material/expansion_panels_demo.dart
index e08d2da..2a0e339 100644
--- a/examples/flutter_gallery/lib/demo/material/expansion_panels_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/expansion_panels_demo.dart
@@ -108,7 +108,7 @@
)
)
),
- new Divider(height: 1.0),
+ const Divider(height: 1.0),
new Container(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: new Row(
diff --git a/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart b/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart
index d616a06..925ce96 100644
--- a/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart
@@ -103,13 +103,13 @@
},
background: new Container(
color: theme.primaryColor,
- child: new ListTile(
+ child: const ListTile(
leading: const Icon(Icons.delete, color: Colors.white, size: 36.0)
)
),
secondaryBackground: new Container(
color: theme.primaryColor,
- child: new ListTile(
+ child: const ListTile(
trailing: const Icon(Icons.archive, color: Colors.white, size: 36.0)
)
),
diff --git a/examples/flutter_gallery/lib/demo/material/menu_demo.dart b/examples/flutter_gallery/lib/demo/material/menu_demo.dart
index 44035fc..6c49b84 100644
--- a/examples/flutter_gallery/lib/demo/material/menu_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/menu_demo.dart
@@ -119,31 +119,31 @@
padding: EdgeInsets.zero,
onSelected: showMenuSelection,
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
- new PopupMenuItem<String>(
+ const PopupMenuItem<String>(
value: 'Preview',
- child: new ListTile(
+ child: const ListTile(
leading: const Icon(Icons.visibility),
title: const Text('Preview')
)
),
- new PopupMenuItem<String>(
+ const PopupMenuItem<String>(
value: 'Share',
- child: new ListTile(
+ child: const ListTile(
leading: const Icon(Icons.person_add),
title: const Text('Share')
)
),
- new PopupMenuItem<String>(
+ const PopupMenuItem<String>(
value: 'Get Link',
- child: new ListTile(
+ child: const ListTile(
leading: const Icon(Icons.link),
title: const Text('Get link')
)
),
const PopupMenuDivider(), // ignore: list_element_type_not_assignable, https://github.com/flutter/flutter/issues/5771
- new PopupMenuItem<String>(
+ const PopupMenuItem<String>(
value: 'Remove',
- child: new ListTile(
+ child: const ListTile(
leading: const Icon(Icons.delete),
title: const Text('Remove')
)
diff --git a/examples/flutter_gallery/lib/demo/material/slider_demo.dart b/examples/flutter_gallery/lib/demo/material/slider_demo.dart
index acd8d00..7441d67 100644
--- a/examples/flutter_gallery/lib/demo/material/slider_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/slider_demo.dart
@@ -43,7 +43,7 @@
new Column(
mainAxisSize: MainAxisSize.min,
children: <Widget> [
- new Slider(value: 0.25, thumbOpenAtMin: true, onChanged: null),
+ const Slider(value: 0.25, thumbOpenAtMin: true, onChanged: null),
const Text('Disabled'),
]
),
diff --git a/examples/flutter_gallery/lib/demo/material/tooltip_demo.dart b/examples/flutter_gallery/lib/demo/material/tooltip_demo.dart
index a6d025d..c7bd7f3 100644
--- a/examples/flutter_gallery/lib/demo/material/tooltip_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/tooltip_demo.dart
@@ -46,7 +46,7 @@
color: theme.iconTheme.color,
tooltip: 'Place a phone call',
onPressed: () {
- Scaffold.of(context).showSnackBar(new SnackBar(
+ Scaffold.of(context).showSnackBar(const SnackBar(
content: const Text('That was an ordinary tap.')
));
}
diff --git a/examples/flutter_gallery/lib/demo/material/two_level_list_demo.dart b/examples/flutter_gallery/lib/demo/material/two_level_list_demo.dart
index d152173..cc22f96 100644
--- a/examples/flutter_gallery/lib/demo/material/two_level_list_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/two_level_list_demo.dart
@@ -14,19 +14,19 @@
body: new TwoLevelList(
type: MaterialListType.oneLine,
children: <Widget>[
- new TwoLevelListItem(title: const Text('Top')),
+ const TwoLevelListItem(title: const Text('Top')),
new TwoLevelSublist(
title: const Text('Sublist'),
backgroundColor: Theme.of(context).accentColor.withOpacity(0.025),
children: <Widget>[
- new TwoLevelListItem(title: const Text('One')),
- new TwoLevelListItem(title: const Text('Two')),
+ const TwoLevelListItem(title: const Text('One')),
+ const TwoLevelListItem(title: const Text('Two')),
// https://en.wikipedia.org/wiki/Free_Four
- new TwoLevelListItem(title: const Text('Free')),
- new TwoLevelListItem(title: const Text('Four'))
+ const TwoLevelListItem(title: const Text('Free')),
+ const TwoLevelListItem(title: const Text('Four'))
]
),
- new TwoLevelListItem(title: const Text('Bottom'))
+ const TwoLevelListItem(title: const Text('Bottom'))
]
)
);
diff --git a/examples/flutter_gallery/lib/demo/pesto_demo.dart b/examples/flutter_gallery/lib/demo/pesto_demo.dart
index ab4d4e3..b56232a 100644
--- a/examples/flutter_gallery/lib/demo/pesto_demo.dart
+++ b/examples/flutter_gallery/lib/demo/pesto_demo.dart
@@ -84,7 +84,7 @@
floatingActionButton: new FloatingActionButton(
child: const Icon(Icons.edit),
onPressed: () {
- scaffoldKey.currentState.showSnackBar(new SnackBar(
+ scaffoldKey.currentState.showSnackBar(const SnackBar(
content: const Text('Not supported.'),
));
},
@@ -108,7 +108,7 @@
icon: const Icon(Icons.search),
tooltip: 'Search',
onPressed: () {
- scaffoldKey.currentState.showSnackBar(new SnackBar(
+ scaffoldKey.currentState.showSnackBar(const SnackBar(
content: const Text('Not supported.'),
));
},
diff --git a/examples/flutter_gallery/lib/demo/shrine/shrine_page.dart b/examples/flutter_gallery/lib/demo/shrine/shrine_page.dart
index d6842cb..6a45a1a 100644
--- a/examples/flutter_gallery/lib/demo/shrine/shrine_page.dart
+++ b/examples/flutter_gallery/lib/demo/shrine/shrine_page.dart
@@ -82,7 +82,7 @@
void _emptyCart() {
widget.shoppingCart.clear();
- widget.scaffoldKey.currentState.showSnackBar(new SnackBar(content: const Text('Shopping cart is empty')));
+ widget.scaffoldKey.currentState.showSnackBar(const SnackBar(content: const Text('Shopping cart is empty')));
}
@override
diff --git a/examples/flutter_gallery/lib/gallery/drawer.dart b/examples/flutter_gallery/lib/gallery/drawer.dart
index 1070df9..92f765b 100644
--- a/examples/flutter_gallery/lib/gallery/drawer.dart
+++ b/examples/flutter_gallery/lib/gallery/drawer.dart
@@ -254,10 +254,10 @@
new GalleryDrawerHeader(light: useLightTheme),
lightThemeItem,
darkThemeItem,
- new Divider(),
+ const Divider(),
mountainViewItem,
cupertinoItem,
- new Divider(),
+ const Divider(),
animateSlowlyItem,
// index 8, optional: Performance Overlay
sendFeedbackItem,
diff --git a/examples/flutter_gallery/lib/gallery/example_code.dart b/examples/flutter_gallery/lib/gallery/example_code.dart
index 1070cd4..97d22eb 100644
--- a/examples/flutter_gallery/lib/gallery/example_code.dart
+++ b/examples/flutter_gallery/lib/gallery/example_code.dart
@@ -44,7 +44,7 @@
// Create a disabled button.
// Buttons are disabled when onPressed isn't
// specified or is null.
-new FlatButton(
+const FlatButton(
child: const Text('BUTTON TITLE'),
onPressed: null
);
diff --git a/examples/flutter_gallery/lib/gallery/home.dart b/examples/flutter_gallery/lib/gallery/home.dart
index 5dd6d5c..a2a4e41 100644
--- a/examples/flutter_gallery/lib/gallery/home.dart
+++ b/examples/flutter_gallery/lib/gallery/home.dart
@@ -132,7 +132,7 @@
for (GalleryItem galleryItem in kAllGalleryItems) {
if (category != galleryItem.category) {
if (category != null)
- listItems.add(new Divider());
+ listItems.add(const Divider());
listItems.add(
new Container(
height: 48.0,
@@ -166,7 +166,7 @@
),
body: new CustomScrollView(
slivers: <Widget>[
- new SliverAppBar(
+ const SliverAppBar(
pinned: true,
expandedHeight: _kFlexibleSpaceMaxHeight,
flexibleSpace: const FlexibleSpaceBar(
diff --git a/examples/stocks/lib/stock_home.dart b/examples/stocks/lib/stock_home.dart
index 11a87c6..178304a 100644
--- a/examples/stocks/lib/stock_home.dart
+++ b/examples/stocks/lib/stock_home.dart
@@ -118,12 +118,12 @@
child: new ListView(
children: <Widget>[
const DrawerHeader(child: const Center(child: const Text('Stocks'))),
- new ListTile(
+ const ListTile(
leading: const Icon(Icons.assessment),
title: const Text('Stock List'),
selected: true,
),
- new ListTile(
+ const ListTile(
leading: const Icon(Icons.account_balance),
title: const Text('Account Balance'),
enabled: false,
@@ -142,7 +142,7 @@
}
},
),
- new Divider(),
+ const Divider(),
new ListTile(
leading: const Icon(Icons.thumb_up),
title: const Text('Optimistic'),
@@ -167,7 +167,7 @@
_handleStockModeChange(StockMode.pessimistic);
},
),
- new Divider(),
+ const Divider(),
new ListTile(
leading: const Icon(Icons.settings),
title: const Text('Settings'),
diff --git a/packages/flutter/lib/src/cupertino/activity_indicator.dart b/packages/flutter/lib/src/cupertino/activity_indicator.dart
index b624f90..e978aba 100644
--- a/packages/flutter/lib/src/cupertino/activity_indicator.dart
+++ b/packages/flutter/lib/src/cupertino/activity_indicator.dart
@@ -13,12 +13,11 @@
/// * <https://developer.apple.com/ios/human-interface-guidelines/ui-controls/progress-indicators/#activity-indicators>
class CupertinoActivityIndicator extends StatefulWidget {
/// Creates an iOS-style activity indicator.
- CupertinoActivityIndicator({
+ const CupertinoActivityIndicator({
Key key,
this.animating: true,
- }) : super(key: key) {
- assert(animating != null);
- }
+ }) : assert(animating != null),
+ super(key: key);
/// Whether the activity indicator is running its animation.
///
diff --git a/packages/flutter/lib/src/cupertino/button.dart b/packages/flutter/lib/src/cupertino/button.dart
index acc1cd0..24ddf1b 100644
--- a/packages/flutter/lib/src/cupertino/button.dart
+++ b/packages/flutter/lib/src/cupertino/button.dart
@@ -42,16 +42,14 @@
/// * <https://developer.apple.com/ios/human-interface-guidelines/ui-controls/buttons/>
class CupertinoButton extends StatefulWidget {
/// Creates an iOS-style button.
- CupertinoButton({
+ const CupertinoButton({
@required this.child,
this.padding,
this.color,
this.minSize: 44.0,
this.pressedOpacity: 0.1,
@required this.onPressed,
- }) {
- assert(pressedOpacity >= 0.0 && pressedOpacity <= 1.0);
- }
+ }) : assert(pressedOpacity >= 0.0 && pressedOpacity <= 1.0);
/// The widget below this widget in the tree.
///
diff --git a/packages/flutter/lib/src/cupertino/dialog.dart b/packages/flutter/lib/src/cupertino/dialog.dart
index a6e6851..f0e130e 100644
--- a/packages/flutter/lib/src/cupertino/dialog.dart
+++ b/packages/flutter/lib/src/cupertino/dialog.dart
@@ -177,13 +177,11 @@
/// * [CupertinoAlertDialog]
class CupertinoDialogAction extends StatelessWidget {
/// Creates an action for an iOS-style dialog.
- CupertinoDialogAction({
+ const CupertinoDialogAction({
this.onPressed,
this.isDestructive: false,
@required this.child,
- }) {
- assert(child != null);
- }
+ }) : assert(child != null);
/// The callback that is called when the button is tapped or otherwise activated.
///
diff --git a/packages/flutter/lib/src/cupertino/slider.dart b/packages/flutter/lib/src/cupertino/slider.dart
index 5853ac3..7cf8bb2d 100644
--- a/packages/flutter/lib/src/cupertino/slider.dart
+++ b/packages/flutter/lib/src/cupertino/slider.dart
@@ -41,7 +41,7 @@
///
/// * [value] determines currently selected value for this slider.
/// * [onChanged] is called when the user selects a new value for the slider.
- CupertinoSlider({
+ const CupertinoSlider({
Key key,
@required this.value,
@required this.onChanged,
@@ -49,13 +49,12 @@
this.max: 1.0,
this.divisions,
this.activeColor: const Color(0xFF027AFF),
- }) : super(key: key) {
- assert(value != null);
- assert(min != null);
- assert(max != null);
- assert(value >= min && value <= max);
- assert(divisions == null || divisions > 0);
- }
+ }) : assert(value != null),
+ assert(min != null),
+ assert(max != null),
+ assert(value >= min && value <= max),
+ assert(divisions == null || divisions > 0),
+ super(key: key);
/// The currently selected value for this slider.
///
diff --git a/packages/flutter/lib/src/material/app_bar.dart b/packages/flutter/lib/src/material/app_bar.dart
index f1b9354..2232799 100644
--- a/packages/flutter/lib/src/material/app_bar.dart
+++ b/packages/flutter/lib/src/material/app_bar.dart
@@ -677,7 +677,7 @@
/// * <https://material.google.com/layout/structure.html#structure-toolbars>
class SliverAppBar extends StatefulWidget {
/// Creates a material design app bar that can be placed in a [CustomScrollView].
- SliverAppBar({
+ const SliverAppBar({
Key key,
this.leading,
this.title,
@@ -695,13 +695,12 @@
this.floating: false,
this.pinned: false,
this.snap: false,
- }) : super(key: key) {
- assert(primary != null);
- assert(floating != null);
- assert(pinned != null);
- assert(pinned && floating ? bottom != null : true);
- assert(snap != null);
- }
+ }) : assert(primary != null),
+ assert(floating != null),
+ assert(pinned != null),
+ assert(pinned && floating ? bottom != null : true),
+ assert(snap != null),
+ super(key: key);
/// A widget to display before the [title].
///
diff --git a/packages/flutter/lib/src/material/bottom_sheet.dart b/packages/flutter/lib/src/material/bottom_sheet.dart
index d298034..75bad97 100644
--- a/packages/flutter/lib/src/material/bottom_sheet.dart
+++ b/packages/flutter/lib/src/material/bottom_sheet.dart
@@ -47,15 +47,14 @@
/// Typically, bottom sheets are created implicitly by
/// [Scaffold.showBottomSheet], for persistent bottom sheets, or by
/// [showModalBottomSheet], for modal bottom sheets.
- BottomSheet({
+ const BottomSheet({
Key key,
this.animationController,
@required this.onClosing,
@required this.builder
- }) : super(key: key) {
- assert(onClosing != null);
- assert(builder != null);
- }
+ }) : assert(onClosing != null),
+ assert(builder != null),
+ super(key: key);
/// The animation that controls the bottom sheet's position.
///
diff --git a/packages/flutter/lib/src/material/checkbox.dart b/packages/flutter/lib/src/material/checkbox.dart
index 35c719c..cfdd7c3 100644
--- a/packages/flutter/lib/src/material/checkbox.dart
+++ b/packages/flutter/lib/src/material/checkbox.dart
@@ -103,19 +103,18 @@
}
class _CheckboxRenderObjectWidget extends LeafRenderObjectWidget {
- _CheckboxRenderObjectWidget({
+ const _CheckboxRenderObjectWidget({
Key key,
@required this.value,
@required this.activeColor,
@required this.inactiveColor,
@required this.onChanged,
@required this.vsync,
- }) : super(key: key) {
- assert(value != null);
- assert(activeColor != null);
- assert(inactiveColor != null);
- assert(vsync != null);
- }
+ }) : assert(value != null),
+ assert(activeColor != null),
+ assert(inactiveColor != null),
+ assert(vsync != null),
+ super(key: key);
final bool value;
final Color activeColor;
diff --git a/packages/flutter/lib/src/material/date_picker.dart b/packages/flutter/lib/src/material/date_picker.dart
index 73e0150..bfec061 100644
--- a/packages/flutter/lib/src/material/date_picker.dart
+++ b/packages/flutter/lib/src/material/date_picker.dart
@@ -44,17 +44,16 @@
// Shows the selected date in large font and toggles between year and day mode
class _DatePickerHeader extends StatelessWidget {
- _DatePickerHeader({
+ const _DatePickerHeader({
Key key,
@required this.selectedDate,
@required this.mode,
@required this.onModeChanged,
@required this.orientation,
- }) : super(key: key) {
- assert(selectedDate != null);
- assert(mode != null);
- assert(orientation != null);
- }
+ }) : assert(selectedDate != null),
+ assert(mode != null),
+ assert(orientation != null),
+ super(key: key);
final DateTime selectedDate;
final _DatePickerMode mode;
diff --git a/packages/flutter/lib/src/material/divider.dart b/packages/flutter/lib/src/material/divider.dart
index 99d54f3..b729f4f 100644
--- a/packages/flutter/lib/src/material/divider.dart
+++ b/packages/flutter/lib/src/material/divider.dart
@@ -27,14 +27,13 @@
/// Creates a material design divider.
///
/// The height must be at least 1.0 logical pixels.
- Divider({
+ const Divider({
Key key,
this.height: 16.0,
this.indent: 0.0,
this.color
- }) : super(key: key) {
- assert(height >= 1.0);
- }
+ }) : assert(height >= 1.0),
+ super(key: key);
/// The divider's vertical extent.
///
diff --git a/packages/flutter/lib/src/material/drawer.dart b/packages/flutter/lib/src/material/drawer.dart
index 8c96fb3..9288f1f 100644
--- a/packages/flutter/lib/src/material/drawer.dart
+++ b/packages/flutter/lib/src/material/drawer.dart
@@ -116,12 +116,11 @@
/// Rarely used directly.
///
/// The [child] argument must not be null and is typically a [Drawer].
- DrawerController({
+ const DrawerController({
GlobalKey key,
@required this.child
- }) : super(key: key) {
- assert(child != null);
- }
+ }) : assert(child != null),
+ super(key: key);
/// The widget below this widget in the tree.
///
diff --git a/packages/flutter/lib/src/material/dropdown.dart b/packages/flutter/lib/src/material/dropdown.dart
index 48f0692..03cacbd 100644
--- a/packages/flutter/lib/src/material/dropdown.dart
+++ b/packages/flutter/lib/src/material/dropdown.dart
@@ -333,13 +333,12 @@
/// Creates an item for a dropdown menu.
///
/// The [child] argument is required.
- DropdownMenuItem({
+ const DropdownMenuItem({
Key key,
this.value,
@required this.child,
- }) : super(key: key) {
- assert(child != null);
- }
+ }) : assert(child != null),
+ super(key: key);
/// The widget below this widget in the tree.
///
@@ -370,12 +369,11 @@
class DropdownButtonHideUnderline extends InheritedWidget {
/// Creates a [DropdownButtonHideUnderline]. A non-null [child] must
/// be given.
- DropdownButtonHideUnderline({
+ const DropdownButtonHideUnderline({
Key key,
@required Widget child,
- }) : super(key: key, child: child) {
- assert(child != null);
- }
+ }) : assert(child != null),
+ super(key: key, child: child);
/// Returns whether the underline of [DropdownButton] widgets should
/// be hidden.
diff --git a/packages/flutter/lib/src/material/expand_icon.dart b/packages/flutter/lib/src/material/expand_icon.dart
index ade426e..b5fd7aa 100644
--- a/packages/flutter/lib/src/material/expand_icon.dart
+++ b/packages/flutter/lib/src/material/expand_icon.dart
@@ -21,17 +21,16 @@
class ExpandIcon extends StatefulWidget {
/// Creates an [ExpandIcon] with the given padding, and a callback that is
/// triggered when the icon is pressed.
- ExpandIcon({
+ const ExpandIcon({
Key key,
this.isExpanded: false,
this.size: 24.0,
@required this.onPressed,
this.padding: const EdgeInsets.all(8.0)
- }) : super(key: key) {
- assert(isExpanded != null);
- assert(size != null);
- assert(padding != null);
- }
+ }) : assert(isExpanded != null),
+ assert(size != null),
+ assert(padding != null),
+ super(key: key);
/// Whether the icon is in an expanded state.
///
diff --git a/packages/flutter/lib/src/material/expansion_panel.dart b/packages/flutter/lib/src/material/expansion_panel.dart
index e55be3e..2b8a40a 100644
--- a/packages/flutter/lib/src/material/expansion_panel.dart
+++ b/packages/flutter/lib/src/material/expansion_panel.dart
@@ -73,15 +73,14 @@
class ExpansionPanelList extends StatelessWidget {
/// Creates an expansion panel list widget. The [expansionCallback] is
/// triggered when an expansion panel expand/collapse button is pushed.
- ExpansionPanelList({
+ const ExpansionPanelList({
Key key,
this.children: const <ExpansionPanel>[],
this.expansionCallback,
this.animationDuration: kThemeAnimationDuration
- }) : super(key: key) {
- assert(children != null);
- assert(animationDuration != null);
- }
+ }) : assert(children != null),
+ assert(animationDuration != null),
+ super(key: key);
/// The children of the expansion panel list. They are layed in a similar
/// fashion to [ListBody].
diff --git a/packages/flutter/lib/src/material/flat_button.dart b/packages/flutter/lib/src/material/flat_button.dart
index 9ef27c6..9207b1f 100644
--- a/packages/flutter/lib/src/material/flat_button.dart
+++ b/packages/flutter/lib/src/material/flat_button.dart
@@ -47,7 +47,7 @@
///
/// The [child] argument is required and is typically a [Text] widget in all
/// caps.
- FlatButton({
+ const FlatButton({
Key key,
@required this.onPressed,
this.textColor,
@@ -59,9 +59,8 @@
this.textTheme,
this.colorBrightness,
@required this.child
- }) : super(key: key) {
- assert(child != null);
- }
+ }) : assert(child != null),
+ super(key: key);
/// The callback that is called when the button is tapped or otherwise activated.
///
diff --git a/packages/flutter/lib/src/material/grid_tile.dart b/packages/flutter/lib/src/material/grid_tile.dart
index 8cf273a..ff2a060 100644
--- a/packages/flutter/lib/src/material/grid_tile.dart
+++ b/packages/flutter/lib/src/material/grid_tile.dart
@@ -21,14 +21,13 @@
/// Creates a grid tile.
///
/// Must have a child. Does not typically have both a header and a footer.
- GridTile({
+ const GridTile({
Key key,
this.header,
this.footer,
@required this.child,
- }) : super(key: key) {
- assert(child != null);
- }
+ }) : assert(child != null),
+ super(key: key);
/// The widget to show over the top of this grid tile.
///
diff --git a/packages/flutter/lib/src/material/icon_theme.dart b/packages/flutter/lib/src/material/icon_theme.dart
index bdc6399..65c8b66 100644
--- a/packages/flutter/lib/src/material/icon_theme.dart
+++ b/packages/flutter/lib/src/material/icon_theme.dart
@@ -16,14 +16,13 @@
/// descendant widgets.
///
/// Both [data] and [child] arguments must not be null.
- IconTheme({
+ const IconTheme({
Key key,
@required this.data,
@required Widget child
- }) : super(key: key, child: child) {
- assert(data != null);
- assert(child != null);
- }
+ }) : assert(data != null),
+ assert(child != null),
+ super(key: key, child: child);
/// Creates an icon theme that controls the color, opacity, and size of
/// descendant widgets, and merges in the current icon theme, if any.
diff --git a/packages/flutter/lib/src/material/input_decorator.dart b/packages/flutter/lib/src/material/input_decorator.dart
index 5b053cc..bea214a 100644
--- a/packages/flutter/lib/src/material/input_decorator.dart
+++ b/packages/flutter/lib/src/material/input_decorator.dart
@@ -463,15 +463,14 @@
// Smoothly animate the label of an InputDecorator as the label
// transitions between inline and caption.
class _AnimatedLabel extends ImplicitlyAnimatedWidget {
- _AnimatedLabel({
+ const _AnimatedLabel({
Key key,
this.text,
@required this.style,
Curve curve: Curves.linear,
@required Duration duration,
- }) : super(key: key, curve: curve, duration: duration) {
- assert(style != null);
- }
+ }) : assert(style != null),
+ super(key: key, curve: curve, duration: duration);
final String text;
final TextStyle style;
diff --git a/packages/flutter/lib/src/material/list_tile.dart b/packages/flutter/lib/src/material/list_tile.dart
index 18af246..15fd77b 100644
--- a/packages/flutter/lib/src/material/list_tile.dart
+++ b/packages/flutter/lib/src/material/list_tile.dart
@@ -158,7 +158,7 @@
/// If [isThreeLine] is true, then [subtitle] must not be null.
///
/// Requires one of its ancestors to be a [Material] widget.
- ListTile({
+ const ListTile({
Key key,
this.leading,
this.title,
@@ -170,11 +170,10 @@
this.onTap,
this.onLongPress,
this.selected: false,
- }) : super(key: key) {
- assert(isThreeLine != null);
- assert(enabled != null);
- assert(selected != null);
- }
+ }) : assert(isThreeLine != null),
+ assert(enabled != null),
+ assert(selected != null),
+ super(key: key);
/// A widget to display before the title.
///
diff --git a/packages/flutter/lib/src/material/material.dart b/packages/flutter/lib/src/material/material.dart
index 2c4bb36..c6dece9 100644
--- a/packages/flutter/lib/src/material/material.dart
+++ b/packages/flutter/lib/src/material/material.dart
@@ -110,7 +110,7 @@
/// Creates a piece of material.
///
/// The [type] and the [elevation] arguments must not be null.
- Material({
+ const Material({
Key key,
this.type: MaterialType.canvas,
this.elevation: 0,
@@ -118,11 +118,10 @@
this.textStyle,
this.borderRadius,
this.child,
- }) : super(key: key) {
- assert(type != null);
- assert(elevation != null);
- assert(type != MaterialType.circle || borderRadius == null);
- }
+ }) : assert(type != null),
+ assert(elevation != null),
+ assert(!(identical(type, MaterialType.circle) && borderRadius != null)),
+ super(key: key);
/// The widget below this widget in the tree.
final Widget child;
diff --git a/packages/flutter/lib/src/material/mergeable_material.dart b/packages/flutter/lib/src/material/mergeable_material.dart
index 0394606..1aa440c 100644
--- a/packages/flutter/lib/src/material/mergeable_material.dart
+++ b/packages/flutter/lib/src/material/mergeable_material.dart
@@ -34,12 +34,11 @@
class MaterialSlice extends MergeableMaterialItem {
/// Creates a slice of [Material] that's mergeable within a
/// [MergeableMaterial].
- MaterialSlice({
+ const MaterialSlice({
@required LocalKey key,
@required this.child,
- }) : super(key) {
- assert(key != null);
- }
+ }) : assert(key != null),
+ super(key);
/// The contents of this slice.
final Widget child;
@@ -55,12 +54,11 @@
/// All [MaterialGap] objects need a [LocalKey].
class MaterialGap extends MergeableMaterialItem {
/// Creates a Material gap with a given size.
- MaterialGap({
+ const MaterialGap({
@required LocalKey key,
this.size: 16.0
- }) : super(key) {
- assert(key != null);
- }
+ }) : assert(key != null),
+ super(key);
/// The main axis extent of this gap. For example, if the [MergableMaterial]
/// is vertical, then this is the height of the gap.
diff --git a/packages/flutter/lib/src/material/popup_menu.dart b/packages/flutter/lib/src/material/popup_menu.dart
index 110da6d..6d2fab8 100644
--- a/packages/flutter/lib/src/material/popup_menu.dart
+++ b/packages/flutter/lib/src/material/popup_menu.dart
@@ -475,7 +475,7 @@
/// Creates a button that shows a popup menu.
///
/// The [itemBuilder] argument must not be null.
- PopupMenuButton({
+ const PopupMenuButton({
Key key,
@required this.itemBuilder,
this.initialValue,
@@ -484,9 +484,8 @@
this.elevation: 8,
this.padding: const EdgeInsets.all(8.0),
this.child
- }) : super(key: key) {
- assert(itemBuilder != null);
- }
+ }) : assert(itemBuilder != null),
+ super(key: key);
/// Called when the button is pressed to create the items to show in the menu.
final PopupMenuItemBuilder<T> itemBuilder;
diff --git a/packages/flutter/lib/src/material/radio.dart b/packages/flutter/lib/src/material/radio.dart
index ccb6361..55e7ce3 100644
--- a/packages/flutter/lib/src/material/radio.dart
+++ b/packages/flutter/lib/src/material/radio.dart
@@ -127,19 +127,18 @@
}
class _RadioRenderObjectWidget extends LeafRenderObjectWidget {
- _RadioRenderObjectWidget({
+ const _RadioRenderObjectWidget({
Key key,
@required this.selected,
@required this.activeColor,
@required this.inactiveColor,
this.onChanged,
@required this.vsync,
- }) : super(key: key) {
- assert(selected != null);
- assert(activeColor != null);
- assert(inactiveColor != null);
- assert(vsync != null);
- }
+ }) : assert(selected != null),
+ assert(activeColor != null),
+ assert(inactiveColor != null),
+ assert(vsync != null),
+ super(key: key);
final bool selected;
final Color inactiveColor;
diff --git a/packages/flutter/lib/src/material/refresh_indicator.dart b/packages/flutter/lib/src/material/refresh_indicator.dart
index 71f2478..5665118 100644
--- a/packages/flutter/lib/src/material/refresh_indicator.dart
+++ b/packages/flutter/lib/src/material/refresh_indicator.dart
@@ -80,17 +80,16 @@
///
/// The [onRefresh] and [child] arguments must be non-null. The default
/// [displacement] is 40.0 logical pixels.
- RefreshIndicator({
+ const RefreshIndicator({
Key key,
@required this.child,
this.displacement: 40.0,
@required this.onRefresh,
this.color,
this.backgroundColor
- }) : super(key: key) {
- assert(child != null);
- assert(onRefresh != null);
- }
+ }) : assert(child != null),
+ assert(onRefresh != null),
+ super(key: key);
/// The refresh indicator will be stacked on top of this child. The indicator
/// will appear when child's Scrollable descendant is over-scrolled.
diff --git a/packages/flutter/lib/src/material/scaffold.dart b/packages/flutter/lib/src/material/scaffold.dart
index 885802c..0b0fd9c 100644
--- a/packages/flutter/lib/src/material/scaffold.dart
+++ b/packages/flutter/lib/src/material/scaffold.dart
@@ -1015,12 +1015,11 @@
}
class _ScaffoldScope extends InheritedWidget {
- _ScaffoldScope({
+ const _ScaffoldScope({
@required this.hasDrawer,
@required Widget child,
- }) : super(child: child) {
- assert(hasDrawer != null);
- }
+ }) : assert(hasDrawer != null),
+ super(child: child);
final bool hasDrawer;
diff --git a/packages/flutter/lib/src/material/slider.dart b/packages/flutter/lib/src/material/slider.dart
index a4cb5d5..64fec7f 100644
--- a/packages/flutter/lib/src/material/slider.dart
+++ b/packages/flutter/lib/src/material/slider.dart
@@ -49,7 +49,7 @@
///
/// * [value] determines currently selected value for this slider.
/// * [onChanged] is called when the user selects a new value for the slider.
- Slider({
+ const Slider({
Key key,
@required this.value,
@required this.onChanged,
@@ -59,14 +59,13 @@
this.label,
this.activeColor,
this.thumbOpenAtMin: false,
- }) : super(key: key) {
- assert(value != null);
- assert(min != null);
- assert(max != null);
- assert(value >= min && value <= max);
- assert(divisions == null || divisions > 0);
- assert(thumbOpenAtMin != null);
- }
+ }) : assert(value != null),
+ assert(min != null),
+ assert(max != null),
+ assert(value >= min && value <= max),
+ assert(divisions == null || divisions > 0),
+ assert(thumbOpenAtMin != null),
+ super(key: key);
/// The currently selected value for this slider.
///
diff --git a/packages/flutter/lib/src/material/snack_bar.dart b/packages/flutter/lib/src/material/snack_bar.dart
index bdf4836..a0eb8c9 100644
--- a/packages/flutter/lib/src/material/snack_bar.dart
+++ b/packages/flutter/lib/src/material/snack_bar.dart
@@ -79,14 +79,13 @@
/// Creates an action for a [SnackBar].
///
/// The [label] and [onPressed] arguments must be non-null.
- SnackBarAction({
+ const SnackBarAction({
Key key,
@required this.label,
@required this.onPressed
- }) : super(key: key) {
- assert(label != null);
- assert(onPressed != null);
- }
+ }) : assert(label != null),
+ assert(onPressed != null),
+ super(key: key);
/// The button label.
final String label;
@@ -145,16 +144,15 @@
/// Creates a snack bar.
///
/// The [content] argument must be non-null.
- SnackBar({
+ const SnackBar({
Key key,
@required this.content,
this.backgroundColor,
this.action,
this.duration: _kSnackBarDisplayDuration,
this.animation,
- }) : super(key: key) {
- assert(content != null);
- }
+ }) : assert(content != null),
+ super(key: key);
/// The primary content of the snack bar.
///
diff --git a/packages/flutter/lib/src/material/stepper.dart b/packages/flutter/lib/src/material/stepper.dart
index 74a6382..217f4f1 100644
--- a/packages/flutter/lib/src/material/stepper.dart
+++ b/packages/flutter/lib/src/material/stepper.dart
@@ -80,17 +80,15 @@
/// Creates a step for a [Stepper].
///
/// The [title], [content], and [state] arguments must not be null.
- Step({
+ const Step({
@required this.title,
this.subtitle,
@required this.content,
this.state: StepState.indexed,
this.isActive: false,
- }) {
- assert(title != null);
- assert(content != null);
- assert(state != null);
- }
+ }) : assert(title != null),
+ assert(content != null),
+ assert(state != null);
/// The title of the step that typically describes it.
final Widget title;
diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart
index e4baaaf..6480ad8 100644
--- a/packages/flutter/lib/src/material/tabs.dart
+++ b/packages/flutter/lib/src/material/tabs.dart
@@ -39,13 +39,12 @@
class Tab extends StatelessWidget {
/// Creates a material design [TabBar] tab. At least one of [text] and [icon]
/// must be non-null.
- Tab({
+ const Tab({
Key key,
this.text,
this.icon,
- }) : super(key: key) {
- assert(text != null || icon != null);
- }
+ }) : assert(text != null || icon != null),
+ super(key: key);
/// The text to display as the tab's label.
final String text;
diff --git a/packages/flutter/lib/src/material/theme.dart b/packages/flutter/lib/src/material/theme.dart
index edf56cd..8ee93ea 100644
--- a/packages/flutter/lib/src/material/theme.dart
+++ b/packages/flutter/lib/src/material/theme.dart
@@ -31,15 +31,14 @@
/// Applies the given theme [data] to [child].
///
/// The [data] and [child] arguments must not be null.
- Theme({
+ const Theme({
Key key,
@required this.data,
this.isMaterialAppTheme: false,
@required Widget child
- }) : super(key: key, child: child) {
- assert(child != null);
- assert(data != null);
- }
+ }) : assert(child != null),
+ assert(data != null),
+ super(key: key, child: child);
/// Specifies the color and typography values for descendant widgets.
final ThemeData data;
@@ -154,17 +153,16 @@
///
/// By default, the theme transition uses a linear curve. The [data] and
/// [child] arguments must not be null.
- AnimatedTheme({
+ const AnimatedTheme({
Key key,
@required this.data,
this.isMaterialAppTheme: false,
Curve curve: Curves.linear,
Duration duration: kThemeAnimationDuration,
@required this.child,
- }) : super(key: key, curve: curve, duration: duration) {
- assert(child != null);
- assert(data != null);
- }
+ }) : assert(child != null),
+ assert(data != null),
+ super(key: key, curve: curve, duration: duration);
/// Specifies the color and typography values for descendant widgets.
final ThemeData data;
diff --git a/packages/flutter/lib/src/material/theme_data.dart b/packages/flutter/lib/src/material/theme_data.dart
index d14f44a..53ccd4a 100644
--- a/packages/flutter/lib/src/material/theme_data.dart
+++ b/packages/flutter/lib/src/material/theme_data.dart
@@ -184,7 +184,7 @@
/// This will rarely be used directly. It is used by [lerp] to
/// create intermediate themes based on two themes created with the
/// [new ThemeData] constructor.
- ThemeData.raw({
+ const ThemeData.raw({
@required this.brightness,
@required this.primaryColor,
@required this.primaryColorBrightness,
@@ -215,38 +215,36 @@
@required this.primaryIconTheme,
@required this.accentIconTheme,
@required this.platform
- }) {
- assert(brightness != null);
- assert(primaryColor != null);
- assert(primaryColorBrightness != null);
- assert(accentColor != null);
- assert(accentColorBrightness != null);
- assert(canvasColor != null);
- assert(scaffoldBackgroundColor != null);
- assert(cardColor != null);
- assert(dividerColor != null);
- assert(highlightColor != null);
- assert(splashColor != null);
- assert(selectedRowColor != null);
- assert(unselectedWidgetColor != null);
- assert(disabledColor != null);
- assert(buttonColor != null);
- assert(secondaryHeaderColor != null);
- assert(textSelectionColor != null);
- assert(textSelectionHandleColor != null);
- assert(backgroundColor != null);
- assert(dialogBackgroundColor != null);
- assert(indicatorColor != null);
- assert(hintColor != null);
- assert(errorColor != null);
- assert(textTheme != null);
- assert(primaryTextTheme != null);
- assert(accentTextTheme != null);
- assert(iconTheme != null);
- assert(primaryIconTheme != null);
- assert(accentIconTheme != null);
- assert(platform != null);
- }
+ }) : assert(brightness != null),
+ assert(primaryColor != null),
+ assert(primaryColorBrightness != null),
+ assert(accentColor != null),
+ assert(accentColorBrightness != null),
+ assert(canvasColor != null),
+ assert(scaffoldBackgroundColor != null),
+ assert(cardColor != null),
+ assert(dividerColor != null),
+ assert(highlightColor != null),
+ assert(splashColor != null),
+ assert(selectedRowColor != null),
+ assert(unselectedWidgetColor != null),
+ assert(disabledColor != null),
+ assert(buttonColor != null),
+ assert(secondaryHeaderColor != null),
+ assert(textSelectionColor != null),
+ assert(textSelectionHandleColor != null),
+ assert(backgroundColor != null),
+ assert(dialogBackgroundColor != null),
+ assert(indicatorColor != null),
+ assert(hintColor != null),
+ assert(errorColor != null),
+ assert(textTheme != null),
+ assert(primaryTextTheme != null),
+ assert(accentTextTheme != null),
+ assert(iconTheme != null),
+ assert(primaryIconTheme != null),
+ assert(accentIconTheme != null),
+ assert(platform != null);
/// A default light blue theme.
factory ThemeData.light() => new ThemeData(brightness: Brightness.light);
diff --git a/packages/flutter/lib/src/material/time_picker.dart b/packages/flutter/lib/src/material/time_picker.dart
index d4269f4..bb3b6ec 100644
--- a/packages/flutter/lib/src/material/time_picker.dart
+++ b/packages/flutter/lib/src/material/time_picker.dart
@@ -207,17 +207,15 @@
// TODO(ianh): Localize!
class _TimePickerHeader extends StatelessWidget {
- _TimePickerHeader({
+ const _TimePickerHeader({
@required this.selectedTime,
@required this.mode,
@required this.orientation,
@required this.onModeChanged,
@required this.onChanged,
- }) {
- assert(selectedTime != null);
- assert(mode != null);
- assert(orientation != null);
- }
+ }) : assert(selectedTime != null),
+ assert(mode != null),
+ assert(orientation != null);
final TimeOfDay selectedTime;
final _TimePickerMode mode;
@@ -447,13 +445,11 @@
}
class _Dial extends StatefulWidget {
- _Dial({
+ const _Dial({
@required this.selectedTime,
@required this.mode,
@required this.onChanged
- }) {
- assert(selectedTime != null);
- }
+ }) : assert(selectedTime != null);
final TimeOfDay selectedTime;
final _TimePickerMode mode;
@@ -625,12 +621,11 @@
}
class _TimePickerDialog extends StatefulWidget {
- _TimePickerDialog({
+ const _TimePickerDialog({
Key key,
@required this.initialTime
- }) : super(key: key) {
- assert(initialTime != null);
- }
+ }) : assert(initialTime != null),
+ super(key: key);
final TimeOfDay initialTime;
diff --git a/packages/flutter/lib/src/material/tooltip.dart b/packages/flutter/lib/src/material/tooltip.dart
index 0778544..1f71cfc 100644
--- a/packages/flutter/lib/src/material/tooltip.dart
+++ b/packages/flutter/lib/src/material/tooltip.dart
@@ -41,7 +41,7 @@
/// user long presses on the widget.
///
/// The [message] argument cannot be null.
- Tooltip({
+ const Tooltip({
Key key,
@required this.message,
this.height: 32.0,
@@ -49,14 +49,13 @@
this.verticalOffset: 24.0,
this.preferBelow: true,
@required this.child,
- }) : super(key: key) {
- assert(message != null);
- assert(height != null);
- assert(padding != null);
- assert(verticalOffset != null);
- assert(preferBelow != null);
- assert(child != null);
- }
+ }) : assert(message != null),
+ assert(height != null),
+ assert(padding != null),
+ assert(verticalOffset != null),
+ assert(preferBelow != null),
+ assert(child != null),
+ super(key: key);
/// The text to display in the tooltip.
final String message;
diff --git a/packages/flutter/lib/src/material/two_level_list.dart b/packages/flutter/lib/src/material/two_level_list.dart
index 65d2bb5..a9a3cb5 100644
--- a/packages/flutter/lib/src/material/two_level_list.dart
+++ b/packages/flutter/lib/src/material/two_level_list.dart
@@ -29,7 +29,7 @@
/// * [ListTile]
class TwoLevelListItem extends StatelessWidget {
/// Creates an item in a two-level list.
- TwoLevelListItem({
+ const TwoLevelListItem({
Key key,
this.leading,
@required this.title,
@@ -37,9 +37,8 @@
this.enabled: true,
this.onTap,
this.onLongPress
- }) : super(key: key) {
- assert(title != null);
- }
+ }) : assert(title != null),
+ super(key: key);
/// A widget to display before the title.
///
@@ -259,14 +258,13 @@
/// Creates a scrollable list of items that can expand and collapse.
///
/// The [type] argument must not be null.
- TwoLevelList({
+ const TwoLevelList({
Key key,
this.children: const <Widget>[],
this.type: MaterialListType.twoLine,
this.padding
- }) : super(key: key) {
- assert(type != null);
- }
+ }) : assert(type != null),
+ super(key: key);
/// The widgets to display in this list.
///
diff --git a/packages/flutter/lib/src/rendering/editable.dart b/packages/flutter/lib/src/rendering/editable.dart
index cce2908..6147b9f 100644
--- a/packages/flutter/lib/src/rendering/editable.dart
+++ b/packages/flutter/lib/src/rendering/editable.dart
@@ -32,9 +32,8 @@
/// Creates a description of a point in a text selection.
///
/// The [point] argument must not be null.
- TextSelectionPoint(this.point, this.direction) {
- assert(point != null);
- }
+ const TextSelectionPoint(this.point, this.direction)
+ : assert(point != null);
/// Screen coordinates of the lower left or lower right corner of the selection.
final Offset point;
diff --git a/packages/flutter/lib/src/rendering/semantics.dart b/packages/flutter/lib/src/rendering/semantics.dart
index e0d8b98..72d7fa5 100644
--- a/packages/flutter/lib/src/rendering/semantics.dart
+++ b/packages/flutter/lib/src/rendering/semantics.dart
@@ -60,18 +60,16 @@
/// Creates a semantics data object.
///
/// The [flags], [actions], [label], and [Rect] arguments must not be null.
- SemanticsData({
+ const SemanticsData({
@required this.flags,
@required this.actions,
@required this.label,
@required this.rect,
this.transform
- }) {
- assert(flags != null);
- assert(actions != null);
- assert(label != null);
- assert(rect != null);
- }
+ }) : assert(flags != null),
+ assert(actions != null),
+ assert(label != null),
+ assert(rect != null);
/// A bit field of [SemanticsFlags] that apply to this node.
final int flags;
diff --git a/packages/flutter/lib/src/widgets/animated_cross_fade.dart b/packages/flutter/lib/src/widgets/animated_cross_fade.dart
index 46f8923..1252665 100644
--- a/packages/flutter/lib/src/widgets/animated_cross_fade.dart
+++ b/packages/flutter/lib/src/widgets/animated_cross_fade.dart
@@ -44,7 +44,7 @@
/// The [duration] of the animation is the same for all components (fade in,
/// fade out, and size), and you can pass [Interval]s instead of [Curve]s in
/// order to have finer control, e.g., creating an overlap between the fades.
- AnimatedCrossFade({
+ const AnimatedCrossFade({
Key key,
@required this.firstChild,
@required this.secondChild,
@@ -53,11 +53,10 @@
this.sizeCurve: Curves.linear,
@required this.crossFadeState,
@required this.duration
- }) : super(key: key) {
- assert(firstCurve != null);
- assert(secondCurve != null);
- assert(sizeCurve != null);
- }
+ }) : assert(firstCurve != null),
+ assert(secondCurve != null),
+ assert(sizeCurve != null),
+ super(key: key);
/// The child that is visible when [crossFadeState] is [showFirst]. It fades
/// out when transitioning from [showFirst] to [showSecond] and vice versa.
diff --git a/packages/flutter/lib/src/widgets/app.dart b/packages/flutter/lib/src/widgets/app.dart
index 415b4ce..828e07c 100644
--- a/packages/flutter/lib/src/widgets/app.dart
+++ b/packages/flutter/lib/src/widgets/app.dart
@@ -38,7 +38,7 @@
class WidgetsApp extends StatefulWidget {
/// Creates a widget that wraps a number of widgets that are commonly
/// required for an application.
- WidgetsApp({
+ const WidgetsApp({
Key key,
@required this.onGenerateRoute,
this.title,
@@ -51,13 +51,12 @@
this.checkerboardRasterCacheImages: false,
this.showSemanticsDebugger: false,
this.debugShowCheckedModeBanner: true
- }) : super(key: key) {
- assert(color != null);
- assert(onGenerateRoute != null);
- assert(showPerformanceOverlay != null);
- assert(checkerboardRasterCacheImages != null);
- assert(showSemanticsDebugger != null);
- }
+ }) : assert(color != null),
+ assert(onGenerateRoute != null),
+ assert(showPerformanceOverlay != null),
+ assert(checkerboardRasterCacheImages != null),
+ assert(showSemanticsDebugger != null),
+ super(key: key);
/// A one-line description of this app for use in the window manager.
final String title;
diff --git a/packages/flutter/lib/src/widgets/async.dart b/packages/flutter/lib/src/widgets/async.dart
index 3e3121a..5daf39e 100644
--- a/packages/flutter/lib/src/widgets/async.dart
+++ b/packages/flutter/lib/src/widgets/async.dart
@@ -187,19 +187,18 @@
class AsyncSnapshot<T> {
/// Creates an [AsyncSnapshot] with the specified [connectionState],
/// and optionally either [data] or [error] (but not both).
- AsyncSnapshot._(this.connectionState, this.data, this.error) {
- assert(connectionState != null);
- assert(data == null || error == null);
- }
+ const AsyncSnapshot._(this.connectionState, this.data, this.error)
+ : assert(connectionState != null),
+ assert(!(data != null && error != null));
/// Creates an [AsyncSnapshot] in [ConnectionState.none] with null data and error.
- AsyncSnapshot.nothing() : this._(ConnectionState.none, null, null);
+ const AsyncSnapshot.nothing() : this._(ConnectionState.none, null, null);
/// Creates an [AsyncSnapshot] in the specified [state] and with the specified [data].
- AsyncSnapshot.withData(ConnectionState state, T data) : this._(state, data, null);
+ AsyncSnapshot.withData(ConnectionState state, T data) : this._(state, data, null); // not const because https://github.com/dart-lang/sdk/issues/29432
/// Creates an [AsyncSnapshot] in the specified [state] and with the specified [error].
- AsyncSnapshot.withError(ConnectionState state, Object error) : this._(state, null, error);
+ const AsyncSnapshot.withError(ConnectionState state, Object error) : this._(state, null, error);
/// Current state of connection to the asynchronous computation.
final ConnectionState connectionState;
@@ -309,19 +308,18 @@
/// Creates a new [StreamBuilder] that builds itself based on the latest
/// snapshot of interaction with the specified [stream] and whose build
/// strategy is given by [builder].
- StreamBuilder({
+ const StreamBuilder({
Key key,
Stream<T> stream,
@required this.builder
- }) : super(key: key, stream: stream) {
- assert(builder != null);
- }
+ }) : assert(builder != null),
+ super(key: key, stream: stream);
/// The build strategy currently used by this builder. Cannot be null.
final AsyncWidgetBuilder<T> builder;
@override
- AsyncSnapshot<T> initial() => new AsyncSnapshot<T>.nothing();
+ AsyncSnapshot<T> initial() => new AsyncSnapshot<T>.nothing(); // ignore: prefer_const_constructors
@override
AsyncSnapshot<T> afterConnected(AsyncSnapshot<T> current) => current.inState(ConnectionState.waiting);
@@ -387,13 +385,12 @@
/// interaction with a [Future].
///
/// The [builder] must not be null.
- FutureBuilder({
+ const FutureBuilder({
Key key,
this.future,
@required this.builder
- }) : super(key: key) {
- assert(builder != null);
- }
+ }) : assert(builder != null),
+ super(key: key);
/// The asynchronous computation to which this builder is currently connected,
/// possibly null.
@@ -412,7 +409,7 @@
/// calling setState from stale callbacks, e.g. after disposal of this state,
/// or after widget reconfiguration to a new Future.
Object _activeCallbackIdentity;
- AsyncSnapshot<T> _snapshot = new AsyncSnapshot<T>.nothing();
+ AsyncSnapshot<T> _snapshot = new AsyncSnapshot<T>.nothing(); // ignore: prefer_const_constructors
@override
void initState() {
diff --git a/packages/flutter/lib/src/widgets/dismissible.dart b/packages/flutter/lib/src/widgets/dismissible.dart
index ca8a316..85cfef6 100644
--- a/packages/flutter/lib/src/widgets/dismissible.dart
+++ b/packages/flutter/lib/src/widgets/dismissible.dart
@@ -71,7 +71,7 @@
/// which means the item after the dismissed item would be synced with the
/// state of the dismissed item. Using keys causes the widgets to sync
/// according to their keys and avoids this pitfall.
- Dismissible({
+ const Dismissible({
@required Key key,
@required this.child,
this.background,
@@ -81,10 +81,9 @@
this.direction: DismissDirection.horizontal,
this.resizeDuration: const Duration(milliseconds: 300),
this.dismissThresholds: const <DismissDirection, double>{},
- }) : super(key: key) {
- assert(key != null);
- assert(secondaryBackground != null ? background != null : true);
- }
+ }) : assert(key != null),
+ assert(secondaryBackground != null ? background != null : true),
+ super(key: key);
/// The widget below this widget in the tree.
final Widget child;
diff --git a/packages/flutter/lib/src/widgets/editable_text.dart b/packages/flutter/lib/src/widgets/editable_text.dart
index bfdc2b9..c2143f7 100644
--- a/packages/flutter/lib/src/widgets/editable_text.dart
+++ b/packages/flutter/lib/src/widgets/editable_text.dart
@@ -117,7 +117,7 @@
///
/// The [controller], [focusNode], [style], and [cursorColor] arguments must
/// not be null.
- EditableText({
+ const EditableText({
Key key,
@required this.controller,
@required this.focusNode,
@@ -133,15 +133,14 @@
this.keyboardType,
this.onChanged,
this.onSubmitted,
- }) : super(key: key) {
- assert(controller != null);
- assert(focusNode != null);
- assert(obscureText != null);
- assert(style != null);
- assert(cursorColor != null);
- assert(maxLines != null);
- assert(autofocus != null);
- }
+ }) : assert(controller != null),
+ assert(focusNode != null),
+ assert(obscureText != null),
+ assert(style != null),
+ assert(cursorColor != null),
+ assert(maxLines != null),
+ assert(autofocus != null),
+ super(key: key);
/// Controls the text being edited.
final TextEditingController controller;
diff --git a/packages/flutter/lib/src/widgets/focus_scope.dart b/packages/flutter/lib/src/widgets/focus_scope.dart
index f5c9bbb..5e37a27 100644
--- a/packages/flutter/lib/src/widgets/focus_scope.dart
+++ b/packages/flutter/lib/src/widgets/focus_scope.dart
@@ -10,13 +10,12 @@
import 'framework.dart';
class _FocusScopeMarker extends InheritedWidget {
- _FocusScopeMarker({
+ const _FocusScopeMarker({
Key key,
@required this.node,
Widget child,
- }) : super(key: key, child: child) {
- assert(node != null);
- }
+ }) : assert(node != null),
+ super(key: key, child: child);
final FocusScopeNode node;
@@ -53,15 +52,14 @@
/// Creates a scope in which widgets can receive focus.
///
/// The [node] argument must not be null.
- FocusScope({
+ const FocusScope({
Key key,
@required this.node,
this.autofocus: false,
this.child,
- }) : super(key: key) {
- assert(node != null);
- assert(autofocus != null);
- }
+ }) : assert(node != null),
+ assert(autofocus != null),
+ super(key: key);
/// Controls whether this scope is currently active.
final FocusScopeNode node;
diff --git a/packages/flutter/lib/src/widgets/form.dart b/packages/flutter/lib/src/widgets/form.dart
index b0c1833..4f42b4a 100644
--- a/packages/flutter/lib/src/widgets/form.dart
+++ b/packages/flutter/lib/src/widgets/form.dart
@@ -21,14 +21,13 @@
/// Creates a container for form fields.
///
/// The [child] argument must not be null.
- Form({
+ const Form({
Key key,
@required this.child,
this.autovalidate: false,
this.onWillPop,
- }) : super(key: key) {
- assert(child != null);
- }
+ }) : assert(child != null),
+ super(key: key);
/// Returns the closest [FormState] which encloses the given context.
///
@@ -194,16 +193,15 @@
/// Creates a single form field.
///
/// The [builder] argument must not be null.
- FormField({
+ const FormField({
Key key,
@required this.builder,
this.onSaved,
this.validator,
this.initialValue,
this.autovalidate: false,
- }) : super(key: key) {
- assert(builder != null);
- }
+ }) : assert(builder != null),
+ super(key: key);
/// An optional method to call with the final value when the form is saved via
/// Form.save().
diff --git a/packages/flutter/lib/src/widgets/gesture_detector.dart b/packages/flutter/lib/src/widgets/gesture_detector.dart
index 6193216..fc820bd 100644
--- a/packages/flutter/lib/src/widgets/gesture_detector.dart
+++ b/packages/flutter/lib/src/widgets/gesture_detector.dart
@@ -325,16 +325,15 @@
///
/// By default, gesture detectors contribute semantic information to the tree
/// that is used by assistive technology.
- RawGestureDetector({
+ const RawGestureDetector({
Key key,
this.child,
this.gestures: const <Type, GestureRecognizerFactory>{},
this.behavior,
this.excludeFromSemantics: false
- }) : super(key: key) {
- assert(gestures != null);
- assert(excludeFromSemantics != null);
- }
+ }) : assert(gestures != null),
+ assert(excludeFromSemantics != null),
+ super(key: key);
/// The widget below this widget in the tree.
final Widget child;
diff --git a/packages/flutter/lib/src/widgets/heroes.dart b/packages/flutter/lib/src/widgets/heroes.dart
index ba189d5..3f3895e 100644
--- a/packages/flutter/lib/src/widgets/heroes.dart
+++ b/packages/flutter/lib/src/widgets/heroes.dart
@@ -77,14 +77,13 @@
/// Create a hero.
///
/// The [tag] and [child] parameters must not be null.
- Hero({
+ const Hero({
Key key,
@required this.tag,
@required this.child,
- }) : super(key: key) {
- assert(tag != null);
- assert(child != null);
- }
+ }) : assert(tag != null),
+ assert(child != null),
+ super(key: key);
/// The identifier for this particular hero. If the tag of this hero matches
/// the tag of a hero on a [PageRoute] that we're navigating to or from, then
diff --git a/packages/flutter/lib/src/widgets/image.dart b/packages/flutter/lib/src/widgets/image.dart
index a16c138..b0a0b13 100644
--- a/packages/flutter/lib/src/widgets/image.dart
+++ b/packages/flutter/lib/src/widgets/image.dart
@@ -63,7 +63,7 @@
/// [new Image.network] and [new Image.asset] respectively.
///
/// The [image] and [repeat] arguments must not be null.
- Image({
+ const Image({
Key key,
@required this.image,
this.width,
@@ -75,9 +75,8 @@
this.repeat: ImageRepeat.noRepeat,
this.centerSlice,
this.gaplessPlayback: false
- }) : super(key: key) {
- assert(image != null);
- }
+ }) : assert(image != null),
+ super(key: key);
/// Creates a widget that displays an [ImageStream] obtained from the network.
///
diff --git a/packages/flutter/lib/src/widgets/implicit_animations.dart b/packages/flutter/lib/src/widgets/implicit_animations.dart
index 785a795..d6f80d8 100644
--- a/packages/flutter/lib/src/widgets/implicit_animations.dart
+++ b/packages/flutter/lib/src/widgets/implicit_animations.dart
@@ -88,14 +88,13 @@
/// Initializes fields for subclasses.
///
/// The [curve] and [duration] arguments must not be null.
- ImplicitlyAnimatedWidget({
+ const ImplicitlyAnimatedWidget({
Key key,
this.curve: Curves.linear,
@required this.duration
- }) : super(key: key) {
- assert(curve != null);
- assert(duration != null);
- }
+ }) : assert(curve != null),
+ assert(duration != null),
+ super(key: key);
/// The curve to apply when animating the parameters of this container.
final Curve curve;
@@ -386,7 +385,7 @@
/// the three must be null.
///
/// The [curve] and [duration] arguments must not be null.
- AnimatedPositioned({
+ const AnimatedPositioned({
Key key,
@required this.child,
this.left,
@@ -397,10 +396,9 @@
this.height,
Curve curve: Curves.linear,
@required Duration duration,
- }) : super(key: key, curve: curve, duration: duration) {
- assert(left == null || right == null || width == null);
- assert(top == null || bottom == null || height == null);
- }
+ }) : assert(left == null || right == null || width == null),
+ assert(top == null || bottom == null || height == null),
+ super(key: key, curve: curve, duration: duration);
/// Creates a widget that animates the rectangle it occupies implicitly.
///
@@ -526,15 +524,14 @@
///
/// The [opacity] argument must not be null and must be between 0.0 and 1.0,
/// inclusive. The [curve] and [duration] arguments must not be null.
- AnimatedOpacity({
+ const AnimatedOpacity({
Key key,
this.child,
@required this.opacity,
Curve curve: Curves.linear,
@required Duration duration,
- }) : super(key: key, curve: curve, duration: duration) {
- assert(opacity != null && opacity >= 0.0 && opacity <= 1.0);
- }
+ }) : assert(opacity != null && opacity >= 0.0 && opacity <= 1.0),
+ super(key: key, curve: curve, duration: duration);
/// The widget below this widget in the tree.
final Widget child;
@@ -583,16 +580,15 @@
/// Creates a widget that animates the default text style implicitly.
///
/// The [child], [style], [curve], and [duration] arguments must not be null.
- AnimatedDefaultTextStyle({
+ const AnimatedDefaultTextStyle({
Key key,
@required this.child,
@required this.style,
Curve curve: Curves.linear,
@required Duration duration,
- }) : super(key: key, curve: curve, duration: duration) {
- assert(style != null);
- assert(child != null);
- }
+ }) : assert(style != null),
+ assert(child != null),
+ super(key: key, curve: curve, duration: duration);
/// The widget below this widget in the tree.
final Widget child;
diff --git a/packages/flutter/lib/src/widgets/layout_builder.dart b/packages/flutter/lib/src/widgets/layout_builder.dart
index 6e476b3..dc6e59c 100644
--- a/packages/flutter/lib/src/widgets/layout_builder.dart
+++ b/packages/flutter/lib/src/widgets/layout_builder.dart
@@ -32,12 +32,11 @@
/// Creates a widget that defers its building until layout.
///
/// The [builder] argument must not be null.
- LayoutBuilder({
+ const LayoutBuilder({
Key key,
@required this.builder
- }) : super(key: key) {
- assert(builder != null);
- }
+ }) : assert(builder != null),
+ super(key: key);
/// Called at layout time to construct the widget tree. The builder must not
/// return null.
diff --git a/packages/flutter/lib/src/widgets/locale_query.dart b/packages/flutter/lib/src/widgets/locale_query.dart
index 9c0359f..bc156bd 100644
--- a/packages/flutter/lib/src/widgets/locale_query.dart
+++ b/packages/flutter/lib/src/widgets/locale_query.dart
@@ -12,13 +12,12 @@
/// Establishes a subtree in which locale queries resolve to the given data.
class LocaleQuery extends InheritedWidget {
/// Creates a widget that provides [LocaleQueryData] to its descendants.
- LocaleQuery({
+ const LocaleQuery({
Key key,
@required this.data,
@required Widget child
- }) : super(key: key, child: child) {
- assert(child != null);
- }
+ }) : assert(child != null),
+ super(key: key, child: child);
/// The locale data for this subtree.
final LocaleQueryData data;
diff --git a/packages/flutter/lib/src/widgets/media_query.dart b/packages/flutter/lib/src/widgets/media_query.dart
index df53bcc..2d20dfa 100644
--- a/packages/flutter/lib/src/widgets/media_query.dart
+++ b/packages/flutter/lib/src/widgets/media_query.dart
@@ -121,14 +121,13 @@
/// Creates a widget that provides [MediaQueryData] to its descendants.
///
/// The [data] and [child] arguments must not be null.
- MediaQuery({
+ const MediaQuery({
Key key,
@required this.data,
@required Widget child,
- }) : super(key: key, child: child) {
- assert(child != null);
- assert(data != null);
- }
+ }) : assert(child != null),
+ assert(data != null),
+ super(key: key, child: child);
/// Contains information about the current media.
///
diff --git a/packages/flutter/lib/src/widgets/navigator.dart b/packages/flutter/lib/src/widgets/navigator.dart
index ab5430c..8fefac3 100644
--- a/packages/flutter/lib/src/widgets/navigator.dart
+++ b/packages/flutter/lib/src/widgets/navigator.dart
@@ -475,15 +475,14 @@
/// Creates a widget that maintains a stack-based history of child widgets.
///
/// The [onGenerateRoute] argument must not be null.
- Navigator({
+ const Navigator({
Key key,
this.initialRoute,
@required this.onGenerateRoute,
this.onUnknownRoute,
this.observers: const <NavigatorObserver>[]
- }) : super(key: key) {
- assert(onGenerateRoute != null);
- }
+ }) : assert(onGenerateRoute != null),
+ super(key: key);
/// The name of the first route to show.
final String initialRoute;
diff --git a/packages/flutter/lib/src/widgets/orientation_builder.dart b/packages/flutter/lib/src/widgets/orientation_builder.dart
index c4dd51c..a5b8eac 100644
--- a/packages/flutter/lib/src/widgets/orientation_builder.dart
+++ b/packages/flutter/lib/src/widgets/orientation_builder.dart
@@ -27,12 +27,11 @@
/// Creates an orientation builder.
///
/// The [builder] argument must not be null.
- OrientationBuilder({
+ const OrientationBuilder({
Key key,
@required this.builder,
- }) : super(key: key) {
- assert(builder != null);
- }
+ }) : assert(builder != null),
+ super(key: key);
/// Builds the widgets below this widget given this widget's orientation.
final OrientationWidgetBuilder builder;
diff --git a/packages/flutter/lib/src/widgets/overlay.dart b/packages/flutter/lib/src/widgets/overlay.dart
index ab2d763..e2140b5 100644
--- a/packages/flutter/lib/src/widgets/overlay.dart
+++ b/packages/flutter/lib/src/widgets/overlay.dart
@@ -201,12 +201,11 @@
/// Rather than creating an overlay, consider using the overlay that has
/// already been created by the [WidgetsApp] or the [MaterialApp] for this
/// application.
- Overlay({
+ const Overlay({
Key key,
this.initialEntries: const <OverlayEntry>[]
- }) : super(key: key) {
- assert(initialEntries != null);
- }
+ }) : assert(initialEntries != null),
+ super(key: key);
/// The entries to include in the overlay initially.
///
diff --git a/packages/flutter/lib/src/widgets/overscroll_indicator.dart b/packages/flutter/lib/src/widgets/overscroll_indicator.dart
index ab12040..9dd4e76 100644
--- a/packages/flutter/lib/src/widgets/overscroll_indicator.dart
+++ b/packages/flutter/lib/src/widgets/overscroll_indicator.dart
@@ -33,19 +33,18 @@
///
/// The [showLeading], [showTrailing], [axisDirection], and [color] arguments
/// must not be null.
- GlowingOverscrollIndicator({
+ const GlowingOverscrollIndicator({
Key key,
this.showLeading: true,
this.showTrailing: true,
@required this.axisDirection,
@required this.color,
this.child,
- }) : super(key: key) {
- assert(showLeading != null);
- assert(showTrailing != null);
- assert(axisDirection != null);
- assert(color != null);
- }
+ }) : assert(showLeading != null),
+ assert(showTrailing != null),
+ assert(axisDirection != null),
+ assert(color != null),
+ super(key: key);
/// Whether to show the overscroll glow on the side with negative scroll
/// offsets.
diff --git a/packages/flutter/lib/src/widgets/page_storage.dart b/packages/flutter/lib/src/widgets/page_storage.dart
index 2b0a44d..7d71ac8 100644
--- a/packages/flutter/lib/src/widgets/page_storage.dart
+++ b/packages/flutter/lib/src/widgets/page_storage.dart
@@ -104,13 +104,12 @@
/// Creates a widget that provides a storage bucket for its descendants.
///
/// The [bucket] argument must not be null.
- PageStorage({
+ const PageStorage({
Key key,
@required this.bucket,
@required this.child
- }) : super(key: key) {
- assert(bucket != null);
- }
+ }) : assert(bucket != null),
+ super(key: key);
/// The widget below this widget in the tree.
final Widget child;
diff --git a/packages/flutter/lib/src/widgets/primary_scroll_controller.dart b/packages/flutter/lib/src/widgets/primary_scroll_controller.dart
index 855f902..42659b0 100644
--- a/packages/flutter/lib/src/widgets/primary_scroll_controller.dart
+++ b/packages/flutter/lib/src/widgets/primary_scroll_controller.dart
@@ -8,13 +8,12 @@
import 'scroll_controller.dart';
class PrimaryScrollController extends InheritedWidget {
- PrimaryScrollController({
+ const PrimaryScrollController({
Key key,
@required this.controller,
@required Widget child
- }) : super(key: key, child: child) {
- assert(controller != null);
- }
+ }) : assert(controller != null),
+ super(key: key, child: child);
const PrimaryScrollController.none({
Key key,
diff --git a/packages/flutter/lib/src/widgets/raw_keyboard_listener.dart b/packages/flutter/lib/src/widgets/raw_keyboard_listener.dart
index 8a0d7c3..bdad69f 100644
--- a/packages/flutter/lib/src/widgets/raw_keyboard_listener.dart
+++ b/packages/flutter/lib/src/widgets/raw_keyboard_listener.dart
@@ -28,15 +28,14 @@
///
/// For text entry, consider using a [EditableText], which integrates with
/// on-screen keyboards and input method editors (IMEs).
- RawKeyboardListener({
+ const RawKeyboardListener({
Key key,
@required this.focusNode,
@required this.onKey,
@required this.child,
- }) : super(key: key) {
- assert(focusNode != null);
- assert(child != null);
- }
+ }) : assert(focusNode != null),
+ assert(child != null),
+ super(key: key);
/// Controls whether this widget has keyboard focus.
final FocusNode focusNode;
diff --git a/packages/flutter/lib/src/widgets/routes.dart b/packages/flutter/lib/src/widgets/routes.dart
index 14d6f4d..3922b02 100644
--- a/packages/flutter/lib/src/widgets/routes.dart
+++ b/packages/flutter/lib/src/widgets/routes.dart
@@ -354,18 +354,17 @@
}
class _ModalScopeStatus extends InheritedWidget {
- _ModalScopeStatus({
+ const _ModalScopeStatus({
Key key,
@required this.isCurrent,
@required this.canPop,
@required this.route,
@required Widget child
- }) : super(key: key, child: child) {
- assert(isCurrent != null);
- assert(canPop != null);
- assert(route != null);
- assert(child != null);
- }
+ }) : assert(isCurrent != null),
+ assert(canPop != null),
+ assert(route != null),
+ assert(child != null),
+ super(key: key, child: child);
final bool isCurrent;
final bool canPop;
diff --git a/packages/flutter/lib/src/widgets/scrollable.dart b/packages/flutter/lib/src/widgets/scrollable.dart
index 357653e..89f2263 100644
--- a/packages/flutter/lib/src/widgets/scrollable.dart
+++ b/packages/flutter/lib/src/widgets/scrollable.dart
@@ -25,16 +25,15 @@
typedef Widget ViewportBuilder(BuildContext context, ViewportOffset position);
class Scrollable extends StatefulWidget {
- Scrollable({
+ const Scrollable({
Key key,
this.axisDirection: AxisDirection.down,
this.controller,
this.physics,
@required this.viewportBuilder,
- }) : super (key: key) {
- assert(axisDirection != null);
- assert(viewportBuilder != null);
- }
+ }) : assert(axisDirection != null),
+ assert(viewportBuilder != null),
+ super (key: key);
final AxisDirection axisDirection;
@@ -100,15 +99,14 @@
// Enable Scrollable.of() to work as if ScrollableState was an inherited widget.
// ScrollableState.build() always rebuilds its _ScrollableScope.
class _ScrollableScope extends InheritedWidget {
- _ScrollableScope({
+ const _ScrollableScope({
Key key,
@required this.scrollable,
@required this.position,
@required Widget child
- }) : super(key: key, child: child) {
- assert(scrollable != null);
- assert(child != null);
- }
+ }) : assert(scrollable != null),
+ assert(child != null),
+ super(key: key, child: child);
final ScrollableState scrollable;
final ScrollPosition position;
diff --git a/packages/flutter/lib/src/widgets/single_child_scroll_view.dart b/packages/flutter/lib/src/widgets/single_child_scroll_view.dart
index 0be8825..bef55ff 100644
--- a/packages/flutter/lib/src/widgets/single_child_scroll_view.dart
+++ b/packages/flutter/lib/src/widgets/single_child_scroll_view.dart
@@ -146,14 +146,13 @@
}
class _SingleChildViewport extends SingleChildRenderObjectWidget {
- _SingleChildViewport({
+ const _SingleChildViewport({
Key key,
this.axisDirection: AxisDirection.down,
this.offset,
Widget child,
- }) : super(key: key, child: child) {
- assert(axisDirection != null);
- }
+ }) : assert(axisDirection != null),
+ super(key: key, child: child);
final AxisDirection axisDirection;
final ViewportOffset offset;
diff --git a/packages/flutter/lib/src/widgets/sliver.dart b/packages/flutter/lib/src/widgets/sliver.dart
index 40b7f31..46668f0 100644
--- a/packages/flutter/lib/src/widgets/sliver.dart
+++ b/packages/flutter/lib/src/widgets/sliver.dart
@@ -426,14 +426,13 @@
/// extent in the main axis.
class SliverFillViewport extends SliverMultiBoxAdaptorWidget {
/// Creates a sliver whose box children that each fill the viewport.
- SliverFillViewport({
+ const SliverFillViewport({
Key key,
@required SliverChildDelegate delegate,
this.viewportFraction: 1.0,
- }) : super(key: key, delegate: delegate) {
- assert(viewportFraction != null);
- assert(viewportFraction > 0.0);
- }
+ }) : assert(viewportFraction != null),
+ assert(viewportFraction > 0.0),
+ super(key: key, delegate: delegate);
/// The fraction of the viewport that each child should fill in the main axis.
///
diff --git a/packages/flutter/lib/src/widgets/sliver_persistent_header.dart b/packages/flutter/lib/src/widgets/sliver_persistent_header.dart
index d466be1..8e90bed 100644
--- a/packages/flutter/lib/src/widgets/sliver_persistent_header.dart
+++ b/packages/flutter/lib/src/widgets/sliver_persistent_header.dart
@@ -29,16 +29,15 @@
}
class SliverPersistentHeader extends StatelessWidget {
- SliverPersistentHeader({
+ const SliverPersistentHeader({
Key key,
@required this.delegate,
this.pinned: false,
this.floating: false,
- }) : super(key: key) {
- assert(delegate != null);
- assert(pinned != null);
- assert(floating != null);
- }
+ }) : assert(delegate != null),
+ assert(pinned != null),
+ assert(floating != null),
+ super(key: key);
final SliverPersistentHeaderDelegate delegate;
diff --git a/packages/flutter/lib/src/widgets/ticker_provider.dart b/packages/flutter/lib/src/widgets/ticker_provider.dart
index 277bb92..4850c37 100644
--- a/packages/flutter/lib/src/widgets/ticker_provider.dart
+++ b/packages/flutter/lib/src/widgets/ticker_provider.dart
@@ -19,13 +19,12 @@
/// Creates a widget that enables or disables tickers.
///
/// The [enabled] argument must not be null.
- TickerMode({
+ const TickerMode({
Key key,
@required this.enabled,
Widget child
- }) : super(key: key, child: child) {
- assert(enabled != null);
- }
+ }) : assert(enabled != null),
+ super(key: key, child: child);
/// The current ticker mode of this subtree.
///
diff --git a/packages/flutter/lib/src/widgets/transitions.dart b/packages/flutter/lib/src/widgets/transitions.dart
index e9e0d30..3c59e29 100644
--- a/packages/flutter/lib/src/widgets/transitions.dart
+++ b/packages/flutter/lib/src/widgets/transitions.dart
@@ -219,15 +219,14 @@
/// The [sizeFactor] argument must not be null. The [axis] argument defaults
/// to [Axis.vertical]. The [axisAlignment] defaults to 0.5, which centers the
/// child along the main axis during the transition.
- SizeTransition({
+ const SizeTransition({
Key key,
this.axis: Axis.vertical,
@required Animation<double> sizeFactor,
this.axisAlignment: 0.5,
this.child,
- }) : super(key: key, listenable: sizeFactor) {
- assert(axis != null);
- }
+ }) : assert(axis != null),
+ super(key: key, listenable: sizeFactor);
/// [Axis.horizontal] if [sizeFactor] modifies the width, otherwise [Axis.vertical].
final Axis axis;
@@ -465,14 +464,13 @@
/// Creates an animated builder.
///
/// The [animation] and [builder] arguments must not be null.
- AnimatedBuilder({
+ const AnimatedBuilder({
Key key,
@required Listenable animation,
@required this.builder,
this.child,
- }) : super(key: key, listenable: animation) {
- assert(builder != null);
- }
+ }) : assert(builder != null),
+ super(key: key, listenable: animation);
/// Called every time the animation changes value.
final TransitionBuilder builder;
diff --git a/packages/flutter/lib/src/widgets/will_pop_scope.dart b/packages/flutter/lib/src/widgets/will_pop_scope.dart
index 7bb4620..45b3e66 100644
--- a/packages/flutter/lib/src/widgets/will_pop_scope.dart
+++ b/packages/flutter/lib/src/widgets/will_pop_scope.dart
@@ -19,13 +19,12 @@
/// dismiss the enclosing [ModalRoute].
///
/// The [child] argument must not be null.
- WillPopScope({
+ const WillPopScope({
Key key,
@required this.child,
@required this.onWillPop,
- }) : super(key: key) {
- assert(child != null);
- }
+ }) : assert(child != null),
+ super(key: key);
/// The widget below this widget in the tree.
final Widget child;
diff --git a/packages/flutter/test/cupertino/activity_indicator_test.dart b/packages/flutter/test/cupertino/activity_indicator_test.dart
index 1a03fbb..5f84af3 100644
--- a/packages/flutter/test/cupertino/activity_indicator_test.dart
+++ b/packages/flutter/test/cupertino/activity_indicator_test.dart
@@ -9,18 +9,18 @@
void main() {
testWidgets('Activity indicator animate property works', (WidgetTester tester) async {
- await tester.pumpWidget(new Center(child: new CupertinoActivityIndicator()));
+ await tester.pumpWidget(const Center(child: const CupertinoActivityIndicator()));
expect(SchedulerBinding.instance.transientCallbackCount, equals(1));
- await tester.pumpWidget(new Center(child: new CupertinoActivityIndicator(animating: false)));
+ await tester.pumpWidget(const Center(child: const CupertinoActivityIndicator(animating: false)));
expect(SchedulerBinding.instance.transientCallbackCount, equals(0));
await tester.pumpWidget(new Container());
- await tester.pumpWidget(new Center(child: new CupertinoActivityIndicator(animating: false)));
+ await tester.pumpWidget(const Center(child: const CupertinoActivityIndicator(animating: false)));
expect(SchedulerBinding.instance.transientCallbackCount, equals(0));
- await tester.pumpWidget(new Center(child: new CupertinoActivityIndicator()));
+ await tester.pumpWidget(const Center(child: const CupertinoActivityIndicator()));
expect(SchedulerBinding.instance.transientCallbackCount, equals(1));
});
}
diff --git a/packages/flutter/test/cupertino/button_test.dart b/packages/flutter/test/cupertino/button_test.dart
index b7e966b..5e4c026 100644
--- a/packages/flutter/test/cupertino/button_test.dart
+++ b/packages/flutter/test/cupertino/button_test.dart
@@ -15,7 +15,7 @@
void main() {
testWidgets('Default layout minimum size', (WidgetTester tester) async {
await tester.pumpWidget(
- new Center(child: new CupertinoButton(
+ const Center(child: const CupertinoButton(
child: const Text('X', style: testStyle),
onPressed: null,
))
@@ -47,7 +47,7 @@
testWidgets('Size grows with text', (WidgetTester tester) async {
await tester.pumpWidget(
- new Center(child: new CupertinoButton(
+ const Center(child: const CupertinoButton(
child: const Text('XXXX', style: testStyle),
onPressed: null,
))
@@ -61,7 +61,7 @@
});
testWidgets('Button with background is wider', (WidgetTester tester) async {
- await tester.pumpWidget(new Center(child: new CupertinoButton(
+ await tester.pumpWidget(const Center(child: const CupertinoButton(
child: const Text('X', style: testStyle),
onPressed: null,
color: const Color(0xFFFFFFFF),
@@ -75,7 +75,7 @@
});
testWidgets('Custom padding', (WidgetTester tester) async {
- await tester.pumpWidget(new Center(child: new CupertinoButton(
+ await tester.pumpWidget(const Center(child: const CupertinoButton(
child: const Text(' ', style: testStyle),
onPressed: null,
padding: const EdgeInsets.all(100.0),
@@ -116,7 +116,7 @@
});
testWidgets('Disabled button doesn\'t animate', (WidgetTester tester) async {
- await tester.pumpWidget(new Center(child: new CupertinoButton(
+ await tester.pumpWidget(const Center(child: const CupertinoButton(
child: const Text('Tap me'),
onPressed: null,
)));
diff --git a/packages/flutter/test/cupertino/dialog_test.dart b/packages/flutter/test/cupertino/dialog_test.dart
index 82266c3..2f7b0fc 100644
--- a/packages/flutter/test/cupertino/dialog_test.dart
+++ b/packages/flutter/test/cupertino/dialog_test.dart
@@ -23,7 +23,7 @@
title: const Text('The title'),
content: const Text('The content'),
actions: <Widget>[
- new CupertinoDialogAction(
+ const CupertinoDialogAction(
child: const Text('Cancel'),
),
new CupertinoDialogAction(
@@ -64,7 +64,7 @@
});
testWidgets('Dialog action styles', (WidgetTester tester) async {
- await tester.pumpWidget(new CupertinoDialogAction(
+ await tester.pumpWidget(const CupertinoDialogAction(
isDestructive: true,
child: const Text('Ok'),
));
diff --git a/packages/flutter/test/material/about_test.dart b/packages/flutter/test/material/about_test.dart
index e955a8b..940a1ef 100644
--- a/packages/flutter/test/material/about_test.dart
+++ b/packages/flutter/test/material/about_test.dart
@@ -67,7 +67,7 @@
testWidgets('About box logic defaults to executable name for app name', (WidgetTester tester) async {
await tester.pumpWidget(
- new Material(child: const AboutListTile()),
+ const Material(child: const AboutListTile()),
);
expect(find.text('About flutter_tester'), findsOneWidget);
});
diff --git a/packages/flutter/test/material/back_button_test.dart b/packages/flutter/test/material/back_button_test.dart
index 489fbad..f1e8c1a 100644
--- a/packages/flutter/test/material/back_button_test.dart
+++ b/packages/flutter/test/material/back_button_test.dart
@@ -9,10 +9,10 @@
testWidgets('BackButton control test', (WidgetTester tester) async {
await tester.pumpWidget(
new MaterialApp(
- home: new Material(child: const Text('Home')),
+ home: const Material(child: const Text('Home')),
routes: <String, WidgetBuilder>{
'/next': (BuildContext context) {
- return new Material(
+ return const Material(
child: const Center(
child: const BackButton(),
)
diff --git a/packages/flutter/test/material/debug_test.dart b/packages/flutter/test/material/debug_test.dart
index 76f14fa..46da6b0 100644
--- a/packages/flutter/test/material/debug_test.dart
+++ b/packages/flutter/test/material/debug_test.dart
@@ -7,7 +7,7 @@
void main() {
testWidgets('debugCheckHasMaterial control test', (WidgetTester tester) async {
- await tester.pumpWidget(new FlatButton(
+ await tester.pumpWidget(const FlatButton(
onPressed: null,
child: const Text('Go'),
));
diff --git a/packages/flutter/test/material/dialog_test.dart b/packages/flutter/test/material/dialog_test.dart
index b50cc36..e4a3497 100644
--- a/packages/flutter/test/material/dialog_test.dart
+++ b/packages/flutter/test/material/dialog_test.dart
@@ -100,7 +100,7 @@
testWidgets('Simple dialog control test', (WidgetTester tester) async {
await tester.pumpWidget(
new MaterialApp(
- home: new Material(
+ home: const Material(
child: const Center(
child: const RaisedButton(
onPressed: null,
@@ -141,7 +141,7 @@
testWidgets('Barrier dismissible', (WidgetTester tester) async {
await tester.pumpWidget(
new MaterialApp(
- home: new Material(
+ home: const Material(
child: const Center(
child: const RaisedButton(
onPressed: null,
diff --git a/packages/flutter/test/material/divider_test.dart b/packages/flutter/test/material/divider_test.dart
index 7e7a163..72e52ba 100644
--- a/packages/flutter/test/material/divider_test.dart
+++ b/packages/flutter/test/material/divider_test.dart
@@ -7,7 +7,7 @@
void main() {
testWidgets('Divider control test', (WidgetTester tester) async {
- await tester.pumpWidget(new Center(child: new Divider()));
+ await tester.pumpWidget(const Center(child: const Divider()));
final RenderBox box = tester.firstRenderObject(find.byType(Divider));
expect(box.size.height, 15.0);
});
diff --git a/packages/flutter/test/material/drawer_test.dart b/packages/flutter/test/material/drawer_test.dart
index d73593b..4cfa689 100644
--- a/packages/flutter/test/material/drawer_test.dart
+++ b/packages/flutter/test/material/drawer_test.dart
@@ -20,7 +20,7 @@
child: const Text('header')
)
),
- new ListTile(
+ const ListTile(
leading: const Icon(Icons.archive),
title: const Text('Archive')
)
diff --git a/packages/flutter/test/material/expand_icon_test.dart b/packages/flutter/test/material/expand_icon_test.dart
index f64d47f..e4a02b7 100644
--- a/packages/flutter/test/material/expand_icon_test.dart
+++ b/packages/flutter/test/material/expand_icon_test.dart
@@ -31,9 +31,9 @@
testWidgets('ExpandIcon disabled', (WidgetTester tester) async {
await tester.pumpWidget(
- new Material(
- child: new Center(
- child: new ExpandIcon(
+ const Material(
+ child: const Center(
+ child: const ExpandIcon(
onPressed: null
)
)
diff --git a/packages/flutter/test/material/grid_title_test.dart b/packages/flutter/test/material/grid_title_test.dart
index 5592d7a..7a36db3 100644
--- a/packages/flutter/test/material/grid_title_test.dart
+++ b/packages/flutter/test/material/grid_title_test.dart
@@ -36,7 +36,7 @@
expect(tester.getBottomLeft(find.byKey(headerKey)).dy,
lessThan(tester.getTopLeft(find.byKey(footerKey)).dy));
- await tester.pumpWidget(new GridTile(child: const Text('Simple')));
+ await tester.pumpWidget(const GridTile(child: const Text('Simple')));
expect(find.text('Simple'), findsOneWidget);
});
diff --git a/packages/flutter/test/material/icon_test.dart b/packages/flutter/test/material/icon_test.dart
index 687c60d..9dcd47b 100644
--- a/packages/flutter/test/material/icon_test.dart
+++ b/packages/flutter/test/material/icon_test.dart
@@ -35,8 +35,8 @@
testWidgets('Icon sizing - sized theme', (WidgetTester tester) async {
await tester.pumpWidget(
- new Center(
- child: new IconTheme(
+ const Center(
+ child: const IconTheme(
data: const IconThemeData(size: 36.0),
child: const Icon(null),
),
@@ -49,8 +49,8 @@
testWidgets('Icon sizing - sized theme, explicit size', (WidgetTester tester) async {
await tester.pumpWidget(
- new Center(
- child: new IconTheme(
+ const Center(
+ child: const IconTheme(
data: const IconThemeData(size: 36.0),
child: const Icon(
null,
@@ -66,8 +66,8 @@
testWidgets('Icon sizing - sizeless theme, default size', (WidgetTester tester) async {
await tester.pumpWidget(
- new Center(
- child: new IconTheme(
+ const Center(
+ child: const IconTheme(
data: const IconThemeData(),
child: const Icon(null),
),
diff --git a/packages/flutter/test/material/image_icon_test.dart b/packages/flutter/test/material/image_icon_test.dart
index bf14f05..56b719d 100644
--- a/packages/flutter/test/material/image_icon_test.dart
+++ b/packages/flutter/test/material/image_icon_test.dart
@@ -27,8 +27,8 @@
testWidgets('Icon opacity', (WidgetTester tester) async {
await tester.pumpWidget(
- new Center(
- child: new IconTheme(
+ const Center(
+ child: const IconTheme(
data: const IconThemeData(opacity: 0.5),
child: const ImageIcon(_kImage),
),
@@ -56,8 +56,8 @@
testWidgets('ImageIcon sizing - sized theme', (WidgetTester tester) async {
await tester.pumpWidget(
- new Center(
- child: new IconTheme(
+ const Center(
+ child: const IconTheme(
data: const IconThemeData(size: 36.0),
child: const ImageIcon(null)
)
@@ -70,8 +70,8 @@
testWidgets('ImageIcon sizing - sized theme, explicit size', (WidgetTester tester) async {
await tester.pumpWidget(
- new Center(
- child: new IconTheme(
+ const Center(
+ child: const IconTheme(
data: const IconThemeData(size: 36.0),
child: const ImageIcon(
null,
@@ -87,8 +87,8 @@
testWidgets('ImageIcon sizing - sizeless theme, default size', (WidgetTester tester) async {
await tester.pumpWidget(
- new Center(
- child: new IconTheme(
+ const Center(
+ child: const IconTheme(
data: const IconThemeData(),
child: const ImageIcon(null)
)
diff --git a/packages/flutter/test/material/mergeable_material_test.dart b/packages/flutter/test/material/mergeable_material_test.dart
index a9aa4d3..857c957 100644
--- a/packages/flutter/test/material/mergeable_material_test.dart
+++ b/packages/flutter/test/material/mergeable_material_test.dart
@@ -81,7 +81,7 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
@@ -102,7 +102,7 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
@@ -125,14 +125,14 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('B'),
child: const SizedBox(
width: 100.0,
@@ -155,14 +155,14 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('B'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
@@ -190,7 +190,7 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
@@ -219,17 +219,17 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialGap(
+ const MaterialGap(
key: const ValueKey<String>('x')
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('B'),
child: const SizedBox(
width: 100.0,
@@ -253,14 +253,14 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('B'),
child: const SizedBox(
width: 100.0,
@@ -292,14 +292,14 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('B'),
child: const SizedBox(
width: 100.0,
@@ -322,17 +322,17 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialGap(
+ const MaterialGap(
key: const ValueKey<String>('x')
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('B'),
child: const SizedBox(
width: 100.0,
@@ -364,14 +364,14 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('B'),
child: const SizedBox(
width: 100.0,
@@ -394,17 +394,17 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialGap(
+ const MaterialGap(
key: const ValueKey<String>('x')
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('B'),
child: const SizedBox(
width: 100.0,
@@ -434,14 +434,14 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('B'),
child: const SizedBox(
width: 100.0,
@@ -471,17 +471,17 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialGap(
+ const MaterialGap(
key: const ValueKey<String>('x')
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('B'),
child: const SizedBox(
width: 100.0,
@@ -513,14 +513,14 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('C'),
child: const SizedBox(
width: 100.0,
@@ -543,21 +543,21 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('B'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('C'),
child: const SizedBox(
width: 100.0,
@@ -581,21 +581,21 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('B'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('C'),
child: const SizedBox(
width: 100.0,
@@ -618,14 +618,14 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('C'),
child: const SizedBox(
width: 100.0,
@@ -650,14 +650,14 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('C'),
child: const SizedBox(
width: 100.0,
@@ -680,27 +680,27 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialGap(
+ const MaterialGap(
key: const ValueKey<String>('x')
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('B'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialGap(
+ const MaterialGap(
key: const ValueKey<String>('y')
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('C'),
child: const SizedBox(
width: 100.0,
@@ -734,27 +734,27 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialGap(
+ const MaterialGap(
key: const ValueKey<String>('x')
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('B'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialGap(
+ const MaterialGap(
key: const ValueKey<String>('y')
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('C'),
child: const SizedBox(
width: 100.0,
@@ -779,14 +779,14 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('C'),
child: const SizedBox(
width: 100.0,
@@ -818,17 +818,17 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialGap(
+ const MaterialGap(
key: const ValueKey<String>('x')
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('C'),
child: const SizedBox(
width: 100.0,
@@ -852,27 +852,27 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialGap(
+ const MaterialGap(
key: const ValueKey<String>('y')
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('B'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialGap(
+ const MaterialGap(
key: const ValueKey<String>('z')
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('C'),
child: const SizedBox(
width: 100.0,
@@ -906,27 +906,27 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialGap(
+ const MaterialGap(
key: const ValueKey<String>('x')
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('B'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialGap(
+ const MaterialGap(
key: const ValueKey<String>('y')
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('C'),
child: const SizedBox(
width: 100.0,
@@ -951,17 +951,17 @@
body: new SingleChildScrollView(
child: new MergeableMaterial(
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialGap(
+ const MaterialGap(
key: const ValueKey<String>('z')
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('C'),
child: const SizedBox(
width: 100.0,
@@ -1006,28 +1006,28 @@
child: new MergeableMaterial(
hasDividers: true,
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('B'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('C'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('D'),
child: const SizedBox(
width: 100.0,
@@ -1054,31 +1054,31 @@
child: new MergeableMaterial(
hasDividers: true,
children: <MergeableMaterialItem>[
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('A'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('B'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialGap(
+ const MaterialGap(
key: const ValueKey<String>('x')
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('C'),
child: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new MaterialSlice(
+ const MaterialSlice(
key: const ValueKey<String>('D'),
child: const SizedBox(
width: 100.0,
diff --git a/packages/flutter/test/material/page_test.dart b/packages/flutter/test/material/page_test.dart
index c9184c7..b622c39 100644
--- a/packages/flutter/test/material/page_test.dart
+++ b/packages/flutter/test/material/page_test.dart
@@ -11,10 +11,10 @@
await tester.pumpWidget(
new MaterialApp(
theme: new ThemeData(platform: TargetPlatform.android),
- home: new Material(child: const Text('Page 1')),
+ home: const Material(child: const Text('Page 1')),
routes: <String, WidgetBuilder>{
'/next': (BuildContext context) {
- return new Material(child: const Text('Page 2'));
+ return const Material(child: const Text('Page 2'));
},
},
)
@@ -62,7 +62,7 @@
await tester.pumpWidget(
new MaterialApp(
theme: new ThemeData(platform: TargetPlatform.iOS),
- home: new Material(child: const Text('Page 1')),
+ home: const Material(child: const Text('Page 1')),
routes: <String, WidgetBuilder>{
'/next': (BuildContext context) {
return new Material(
@@ -141,7 +141,7 @@
await tester.pumpWidget(
new MaterialApp(
theme: new ThemeData(platform: TargetPlatform.iOS),
- home: new Material(child: const Text('Page 1')),
+ home: const Material(child: const Text('Page 1')),
)
);
@@ -149,7 +149,7 @@
tester.state<NavigatorState>(find.byType(Navigator)).push(new MaterialPageRoute<Null>(
builder: (BuildContext context) {
- return new Material(child: const Text('Page 2'));
+ return const Material(child: const Text('Page 2'));
},
fullscreenDialog: true,
));
diff --git a/packages/flutter/test/material/scaffold_test.dart b/packages/flutter/test/material/scaffold_test.dart
index 92f4e23..a6651c0 100644
--- a/packages/flutter/test/material/scaffold_test.dart
+++ b/packages/flutter/test/material/scaffold_test.dart
@@ -137,7 +137,7 @@
),
body: new CustomScrollView(
slivers: <Widget>[
- new SliverAppBar(
+ const SliverAppBar(
pinned: true,
expandedHeight: appBarHeight,
title: const Text('Title'),
@@ -184,7 +184,7 @@
body: new CustomScrollView(
primary: true,
slivers: <Widget>[
- new SliverAppBar(
+ const SliverAppBar(
title: const Text('Title')
),
new SliverList(
diff --git a/packages/flutter/test/material/stepper_test.dart b/packages/flutter/test/material/stepper_test.dart
index 3b977d7..fa552eb 100644
--- a/packages/flutter/test/material/stepper_test.dart
+++ b/packages/flutter/test/material/stepper_test.dart
@@ -16,14 +16,14 @@
index = i;
},
steps: <Step>[
- new Step(
+ const Step(
title: const Text('Step 1'),
content: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new Step(
+ const Step(
title: const Text('Step 2'),
content: const SizedBox(
width: 100.0,
@@ -44,14 +44,14 @@
child: new Material(
child: new Stepper(
steps: <Step>[
- new Step(
+ const Step(
title: const Text('Step 1'),
content: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new Step(
+ const Step(
title: const Text('Step 2'),
content: const SizedBox(
width: 200.0,
@@ -73,14 +73,14 @@
child: new Stepper(
currentStep: 1,
steps: <Step>[
- new Step(
+ const Step(
title: const Text('Step 1'),
content: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new Step(
+ const Step(
title: const Text('Step 2'),
content: const SizedBox(
width: 200.0,
@@ -108,7 +108,7 @@
child: new Stepper(
type: StepperType.horizontal,
steps: <Step>[
- new Step(
+ const Step(
title: const Text('Step 1'),
content: const SizedBox(
width: 100.0,
@@ -131,11 +131,11 @@
child: new Stepper(
type: StepperType.horizontal,
steps: <Step>[
- new Step(
+ const Step(
title: const Text('Step 1'),
content: const Text('A')
),
- new Step(
+ const Step(
title: const Text('Step 2'),
content: const Text('B')
)
@@ -153,11 +153,11 @@
currentStep: 1,
type: StepperType.horizontal,
steps: <Step>[
- new Step(
+ const Step(
title: const Text('Step 1'),
content: const Text('A')
),
- new Step(
+ const Step(
title: const Text('Step 2'),
content: const Text('B')
)
@@ -185,14 +185,14 @@
cancelPressed = true;
},
steps: <Step>[
- new Step(
+ const Step(
title: const Text('Step 1'),
content: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new Step(
+ const Step(
title: const Text('Step 2'),
content: const SizedBox(
width: 200.0,
@@ -221,14 +221,14 @@
index = i;
},
steps: <Step>[
- new Step(
+ const Step(
title: const Text('Step 1'),
content: const SizedBox(
width: 100.0,
height: 100.0
)
),
- new Step(
+ const Step(
title: const Text('Step 2'),
state: StepState.disabled,
content: const SizedBox(
@@ -250,21 +250,21 @@
new Material(
child: new Stepper(
steps: <Step>[
- new Step(
+ const Step(
title: const Text('Step 1'),
content: const SizedBox(
width: 100.0,
height: 300.0
)
),
- new Step(
+ const Step(
title: const Text('Step 2'),
content: const SizedBox(
width: 100.0,
height: 300.0
)
),
- new Step(
+ const Step(
title: const Text('Step 3'),
content: const SizedBox(
width: 100.0,
@@ -285,21 +285,21 @@
child: new Stepper(
currentStep: 2,
steps: <Step>[
- new Step(
+ const Step(
title: const Text('Step 1'),
content: const SizedBox(
width: 100.0,
height: 300.0
)
),
- new Step(
+ const Step(
title: const Text('Step 2'),
content: const SizedBox(
width: 100.0,
height: 300.0
)
),
- new Step(
+ const Step(
title: const Text('Step 3'),
content: const SizedBox(
width: 100.0,
@@ -321,7 +321,7 @@
child: new Material(
child: new Stepper(
steps: <Step>[
- new Step(
+ const Step(
title: const Text('A'),
state: StepState.complete,
content: const SizedBox(
@@ -329,7 +329,7 @@
height: 100.0
)
),
- new Step(
+ const Step(
title: const Text('B'),
content: const SizedBox(
width: 100.0,
@@ -352,7 +352,7 @@
child: new Material(
child: new Stepper(
steps: <Step>[
- new Step(
+ const Step(
title: const Text('A'),
state: StepState.error,
content: const SizedBox(
diff --git a/packages/flutter/test/material/text_field_test.dart b/packages/flutter/test/material/text_field_test.dart
index 75b321f6..f86d476 100644
--- a/packages/flutter/test/material/text_field_test.dart
+++ b/packages/flutter/test/material/text_field_test.dart
@@ -125,8 +125,8 @@
testWidgets('Cursor blinks', (WidgetTester tester) async {
Widget builder() {
- return new Center(
- child: new Material(
+ return const Center(
+ child: const Material(
child: const TextField(
decoration: const InputDecoration(
hintText: 'Placeholder',
@@ -169,8 +169,8 @@
testWidgets('obscureText control test', (WidgetTester tester) async {
Widget builder() {
- return new Center(
- child: new Material(
+ return const Center(
+ child: const Material(
child: const TextField(
obscureText: true,
decoration: const InputDecoration(
@@ -811,8 +811,8 @@
testWidgets('No space between Input icon and text', (WidgetTester tester) async {
await tester.pumpWidget(
- new Center(
- child: new Material(
+ const Center(
+ child: const Material(
child: const TextField(
decoration: const InputDecoration(
icon: const Icon(Icons.phone),
@@ -830,8 +830,8 @@
testWidgets('Collapsed hint text placement', (WidgetTester tester) async {
await tester.pumpWidget(
- overlay(new Center(
- child: new Material(
+ overlay(const Center(
+ child: const Material(
child: const TextField(
decoration: const InputDecoration.collapsed(
hintText: 'hint',
diff --git a/packages/flutter/test/material/theme_test.dart b/packages/flutter/test/material/theme_test.dart
index 3159bf5..6a5ff1d 100644
--- a/packages/flutter/test/material/theme_test.dart
+++ b/packages/flutter/test/material/theme_test.dart
@@ -103,7 +103,7 @@
onChanged: (String newValue) { },
value: 'menuItem',
items: <DropdownMenuItem<String>>[
- new DropdownMenuItem<String>(
+ const DropdownMenuItem<String>(
value: 'menuItem',
child: const Text('menuItem'),
),
diff --git a/packages/flutter/test/material/two_level_list_test.dart b/packages/flutter/test/material/two_level_list_test.dart
index db29877..ce2a24b 100644
--- a/packages/flutter/test/material/two_level_list_test.dart
+++ b/packages/flutter/test/material/two_level_list_test.dart
@@ -8,7 +8,7 @@
void main() {
testWidgets('TwoLevelList default control', (WidgetTester tester) async {
- await tester.pumpWidget(new Center(child: new TwoLevelList()));
+ await tester.pumpWidget(const Center(child: const TwoLevelList()));
await tester.pumpWidget(
new Material(
@@ -41,8 +41,8 @@
key: sublistKey,
title: const Text('Sublist'),
children: <Widget>[
- new TwoLevelListItem(title: const Text('0')),
- new TwoLevelListItem(title: const Text('1'))
+ const TwoLevelListItem(title: const Text('0')),
+ const TwoLevelListItem(title: const Text('1'))
]
),
new TwoLevelListItem(title: const Text('Bottom'), key: bottomKey)
@@ -100,8 +100,8 @@
didChangeOpen = opened;
},
children: <Widget>[
- new TwoLevelListItem(title: const Text('0')),
- new TwoLevelListItem(title: const Text('1'))
+ const TwoLevelListItem(title: const Text('0')),
+ const TwoLevelListItem(title: const Text('1'))
]
),
]
diff --git a/packages/flutter/test/widgets/animated_cross_fade_test.dart b/packages/flutter/test/widgets/animated_cross_fade_test.dart
index 1c4a44f..70ad32b 100644
--- a/packages/flutter/test/widgets/animated_cross_fade_test.dart
+++ b/packages/flutter/test/widgets/animated_cross_fade_test.dart
@@ -9,8 +9,8 @@
void main() {
testWidgets('AnimatedCrossFade test', (WidgetTester tester) async {
await tester.pumpWidget(
- new Center(
- child: new AnimatedCrossFade(
+ const Center(
+ child: const AnimatedCrossFade(
firstChild: const SizedBox(
width: 100.0,
height: 100.0
@@ -31,8 +31,8 @@
expect(box.size.height, equals(100.0));
await tester.pumpWidget(
- new Center(
- child: new AnimatedCrossFade(
+ const Center(
+ child: const AnimatedCrossFade(
firstChild: const SizedBox(
width: 100.0,
height: 100.0
@@ -57,8 +57,8 @@
testWidgets('AnimatedCrossFade test showSecond', (WidgetTester tester) async {
await tester.pumpWidget(
- new Center(
- child: new AnimatedCrossFade(
+ const Center(
+ child: const AnimatedCrossFade(
firstChild: const SizedBox(
width: 100.0,
height: 100.0
diff --git a/packages/flutter/test/widgets/async_test.dart b/packages/flutter/test/widgets/async_test.dart
index e87df07..684c8b2 100644
--- a/packages/flutter/test/widgets/async_test.dart
+++ b/packages/flutter/test/widgets/async_test.dart
@@ -20,13 +20,13 @@
});
test('requiring data fails if there is an error', () {
expect(
- () => new AsyncSnapshot<String>.withError(ConnectionState.done, 'error').requireData,
+ () => const AsyncSnapshot<String>.withError(ConnectionState.done, 'error').requireData,
throwsA(equals('error')),
);
});
test('requiring data fails if snapshot has neither data nor error', () {
expect(
- () => new AsyncSnapshot<String>.nothing().requireData,
+ () => const AsyncSnapshot<String>.nothing().requireData,
throwsStateError,
);
});
diff --git a/packages/flutter/test/widgets/heroes_test.dart b/packages/flutter/test/widgets/heroes_test.dart
index 40ba033..7aa5410 100644
--- a/packages/flutter/test/widgets/heroes_test.dart
+++ b/packages/flutter/test/widgets/heroes_test.dart
@@ -200,7 +200,7 @@
home: new Material(
child: new ListView(
children: <Widget>[
- new Hero(tag: 'a', child: const Text('foo')),
+ const Hero(tag: 'a', child: const Text('foo')),
new Builder(builder: (BuildContext context) {
return new FlatButton(child: const Text('two'), onPressed: () => Navigator.push(context, route));
})
@@ -393,8 +393,8 @@
home: new Material(
child: new ListView(
children: <Widget>[
- new Hero(tag: 'a', child: const Text('a')),
- new Hero(tag: 'a', child: const Text('a too')),
+ const Hero(tag: 'a', child: const Text('a')),
+ const Hero(tag: 'a', child: const Text('a too')),
new Builder(
builder: (BuildContext context) {
return new FlatButton(
@@ -929,8 +929,8 @@
return new Material(
child: new ListView(
children: <Widget>[
- new Card(
- child: new Hero(
+ const Card(
+ child: const Hero(
tag: 'H',
child: const SizedBox(
height: 200.0,
@@ -955,8 +955,8 @@
builder: (BuildContext context) { // Navigator.push() needs context
return new ListView(
children: <Widget> [
- new Card(
- child: new Hero(
+ const Card(
+ child: const Hero(
tag: 'H',
child: const SizedBox(
height: 100.0,
diff --git a/packages/flutter/test/widgets/page_transitions_test.dart b/packages/flutter/test/widgets/page_transitions_test.dart
index e5a4ed8..942b8ff 100644
--- a/packages/flutter/test/widgets/page_transitions_test.dart
+++ b/packages/flutter/test/widgets/page_transitions_test.dart
@@ -137,7 +137,7 @@
key: containerKey1,
body: new Container(
decoration: const BoxDecoration(backgroundColor: const Color(0xff00ffff)),
- child: new Hero(
+ child: const Hero(
tag: kHeroTag,
child: const Text('Home')
)
@@ -148,7 +148,7 @@
body: new Container(
padding: const EdgeInsets.all(100.0),
decoration: const BoxDecoration(backgroundColor: const Color(0xffff00ff)),
- child: new Hero(
+ child: const Hero(
tag: kHeroTag,
child: const Text('Settings')
)
diff --git a/packages/flutter/test/widgets/text_test.dart b/packages/flutter/test/widgets/text_test.dart
index 282cbed..a58f79a 100644
--- a/packages/flutter/test/widgets/text_test.dart
+++ b/packages/flutter/test/widgets/text_test.dart
@@ -7,7 +7,7 @@
void main() {
testWidgets('Text respects media query', (WidgetTester tester) async {
- await tester.pumpWidget(new MediaQuery(
+ await tester.pumpWidget(const MediaQuery(
data: const MediaQueryData(textScaleFactor: 1.5),
child: const Center(
child: const Text('Hello')
diff --git a/packages/flutter/test/widgets/ticker_provider_test.dart b/packages/flutter/test/widgets/ticker_provider_test.dart
index 453989c..ff27391 100644
--- a/packages/flutter/test/widgets/ticker_provider_test.dart
+++ b/packages/flutter/test/widgets/ticker_provider_test.dart
@@ -7,7 +7,7 @@
void main() {
testWidgets('TickerMode', (WidgetTester tester) async {
- final Widget widget = new TickerMode(
+ final Widget widget = const TickerMode(
enabled: false,
child: const LinearProgressIndicator()
);
@@ -17,14 +17,14 @@
expect(tester.binding.transientCallbackCount, 0);
- await tester.pumpWidget(new TickerMode(
+ await tester.pumpWidget(const TickerMode(
enabled: true,
child: const LinearProgressIndicator()
));
expect(tester.binding.transientCallbackCount, 1);
- await tester.pumpWidget(new TickerMode(
+ await tester.pumpWidget(const TickerMode(
enabled: false,
child: const LinearProgressIndicator()
));