Commit 83fce211 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

More const immutable classes (#9544)

* more widget const constructors

* prefer const constructors

* address review comments
parent 054c9379
......@@ -176,9 +176,9 @@ class FancyImageItem extends StatelessWidget {
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 @@ class FancyGalleryItem extends StatelessWidget {
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 @@ class GalleryDrawer extends StatelessWidget {
onChanged: (bool value) { _changeTheme(context, value); },
),
),
new Divider(),
const Divider(),
new ListTile(
leading: const Icon(Icons.hourglass_empty),
title: const Text('Animate Slowly'),
......
......@@ -93,20 +93,20 @@ class CardCollectionState extends State<CardCollection> {
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(); },
......
......@@ -525,7 +525,7 @@ class _AnimationDemoHomeState extends State<AnimationDemoHome> {
new Positioned(
top: statusBarHeight,
left: 0.0,
child: new IconTheme(
child: const IconTheme(
data: const IconThemeData(color: Colors.white),
child: const BackButton(),
),
......
......@@ -126,7 +126,7 @@ class _CalculatorState extends State<Calculator> {
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)
......
......@@ -116,7 +116,7 @@ class ContactsDemoState extends State<ContactsDemo> {
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 @@ class ContactsDemoState extends State<ContactsDemo> {
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 @@ class ContactsDemoState extends State<ContactsDemo> {
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 @@ class ContactsDemoState extends State<ContactsDemo> {
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 @@ class ContactsDemoState extends State<ContactsDemo> {
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 @@ class ContactsDemoState extends State<ContactsDemo> {
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 @@ class ContactsDemoState extends State<ContactsDemo> {
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 @@ class ContactsDemoState extends State<ContactsDemo> {
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 @@ class ContactsDemoState extends State<ContactsDemo> {
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.')
));
},
......
......@@ -14,8 +14,8 @@ class CupertinoProgressIndicatorDemo extends StatelessWidget {
appBar: new AppBar(
title: const Text('Cupertino Activity Indicator'),
),
body: new Center(
child: new CupertinoActivityIndicator(),
body: const Center(
child: const CupertinoActivityIndicator(),
),
);
}
......
......@@ -49,7 +49,7 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> {
setState(() {_pressedCount++;});
}
),
new CupertinoButton(
const CupertinoButton(
child: const Text('Disabled'),
onPressed: null,
),
......@@ -65,7 +65,7 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> {
}
),
const Padding(padding: const EdgeInsets.all(12.0)),
new CupertinoButton(
const CupertinoButton(
child: const Text('Disabled'),
color: _kBlue,
onPressed: null,
......
......@@ -121,7 +121,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
// Perform some action
},
),
new FlatButton(
const FlatButton(
child: const Text('DISABLED'),
onPressed: null,
)
......
......@@ -67,7 +67,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
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")
));
}
......
......@@ -108,7 +108,7 @@ class CollapsibleBody extends StatelessWidget {
)
)
),
new Divider(height: 1.0),
const Divider(height: 1.0),
new Container(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: new Row(
......
......@@ -103,13 +103,13 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
},
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)
)
),
......
......@@ -119,31 +119,31 @@ class MenuDemoState extends State<MenuDemo> {
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')
)
......
......@@ -43,7 +43,7 @@ class _SliderDemoState extends State<SliderDemo> {
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'),
]
),
......
......@@ -46,7 +46,7 @@ class TooltipDemo extends StatelessWidget {
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.')
));
}
......
......@@ -14,19 +14,19 @@ class TwoLevelListDemo extends StatelessWidget {
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'))
]
)
);
......
......@@ -84,7 +84,7 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
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 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
icon: const Icon(Icons.search),
tooltip: 'Search',
onPressed: () {
scaffoldKey.currentState.showSnackBar(new SnackBar(
scaffoldKey.currentState.showSnackBar(const SnackBar(
content: const Text('Not supported.'),
));
},
......
......@@ -82,7 +82,7 @@ class ShrinePageState extends State<ShrinePage> {
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
......
......@@ -254,10 +254,10 @@ class GalleryDrawer extends StatelessWidget {
new GalleryDrawerHeader(light: useLightTheme),
lightThemeItem,
darkThemeItem,
new Divider(),
const Divider(),
mountainViewItem,
cupertinoItem,
new Divider(),
const Divider(),
animateSlowlyItem,
// index 8, optional: Performance Overlay
sendFeedbackItem,
......
......@@ -44,7 +44,7 @@ new FlatButton(
// 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
);
......
......@@ -132,7 +132,7 @@ class GalleryHomeState extends State<GalleryHome> with SingleTickerProviderState
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 @@ class GalleryHomeState extends State<GalleryHome> with SingleTickerProviderState
),
body: new CustomScrollView(
slivers: <Widget>[
new SliverAppBar(
const SliverAppBar(
pinned: true,
expandedHeight: _kFlexibleSpaceMaxHeight,
flexibleSpace: const FlexibleSpaceBar(
......
......@@ -118,12 +118,12 @@ class StockHomeState extends State<StockHome> {
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 @@ class StockHomeState extends State<StockHome> {
}
},
),
new Divider(),
const Divider(),
new ListTile(
leading: const Icon(Icons.thumb_up),
title: const Text('Optimistic'),
......@@ -167,7 +167,7 @@ class StockHomeState extends State<StockHome> {
_handleStockModeChange(StockMode.pessimistic);
},
),
new Divider(),
const Divider(),
new ListTile(
leading: const Icon(Icons.settings),
title: const Text('Settings'),
......
......@@ -13,12 +13,11 @@ import 'package:flutter/widgets.dart';
/// * <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.
///
......
......@@ -42,16 +42,14 @@ const EdgeInsets _kBackgroundButtonPadding =
/// * <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.
///
......
......@@ -177,13 +177,11 @@ const Color _kDestructiveActionColor = const Color(0xFFFF3B30);
/// * [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.
///
......
......@@ -41,7 +41,7 @@ class CupertinoSlider extends StatefulWidget {
///
/// * [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 @@ class CupertinoSlider extends StatefulWidget {
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.
///
......
......@@ -677,7 +677,7 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
/// * <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 @@ class SliverAppBar extends StatefulWidget {
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].
///
......
......@@ -47,15 +47,14 @@ class BottomSheet extends StatefulWidget {
/// 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.
///
......
......@@ -103,19 +103,18 @@ class _CheckboxState extends State<Checkbox> with TickerProviderStateMixin {
}
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;
......
......@@ -44,17 +44,16 @@ const double _kDatePickerLandscapeHeight = _kMaxDayPickerHeight + _kDialogAction
// 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;
......
......@@ -27,14 +27,13 @@ class Divider extends StatelessWidget {
/// 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.
///
......
......@@ -116,12 +116,11 @@ class DrawerController extends StatefulWidget {
/// 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.
///
......
......@@ -333,13 +333,12 @@ class DropdownMenuItem<T> extends StatelessWidget {
/// 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 DropdownMenuItem<T> extends StatelessWidget {
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.
......
......@@ -21,17 +21,16 @@ import 'theme.dart';
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.
///
......
......@@ -73,15 +73,14 @@ class ExpansionPanel {
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].
......
......@@ -47,7 +47,7 @@ class FlatButton extends StatelessWidget {
///
/// 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 @@ class FlatButton extends StatelessWidget {
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.
///
......
......@@ -21,14 +21,13 @@ class GridTile extends StatelessWidget {
/// 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.
///
......
......@@ -16,14 +16,13 @@ class IconTheme extends InheritedWidget {
/// 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.
......
......@@ -463,15 +463,14 @@ class InputDecorator extends StatelessWidget {
// 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;
......
......@@ -158,7 +158,7 @@ class ListTile extends StatelessWidget {
/// 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 @@ class ListTile extends StatelessWidget {
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.
///
......
......@@ -110,7 +110,7 @@ class Material extends StatefulWidget {
/// 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 @@ class Material extends StatefulWidget {
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;
......
......@@ -34,12 +34,11 @@ abstract class MergeableMaterialItem {
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 @@ class MaterialSlice extends MergeableMaterialItem {
/// 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.
......
......@@ -475,7 +475,7 @@ class PopupMenuButton<T> extends StatefulWidget {
/// 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 @@ class PopupMenuButton<T> extends StatefulWidget {
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;
......
......@@ -127,19 +127,18 @@ class _RadioState<T> extends State<Radio<T>> with TickerProviderStateMixin {
}
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;
......
......@@ -80,17 +80,16 @@ class RefreshIndicator extends StatefulWidget {
///
/// 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.
......
......@@ -1015,12 +1015,11 @@ class PersistentBottomSheetController<T> extends ScaffoldFeatureController<_Pers
}
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;
......
......@@ -49,7 +49,7 @@ class Slider extends StatefulWidget {
///
/// * [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 @@ class Slider extends StatefulWidget {
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.
///
......
......@@ -79,14 +79,13 @@ class SnackBarAction extends StatefulWidget {
/// 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 @@ class SnackBar extends StatelessWidget {
/// 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.
///
......
......@@ -80,17 +80,15 @@ class Step {
/// 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;
......
......@@ -39,13 +39,12 @@ const EdgeInsets _kTabLabelPadding = const EdgeInsets.symmetric(horizontal: 12.0
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;
......
......@@ -31,15 +31,14 @@ class Theme extends InheritedWidget {
/// 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 @@ class AnimatedTheme extends ImplicitlyAnimatedWidget {
///
/// 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;
......
......@@ -184,7 +184,7 @@ class ThemeData {
/// 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 @@ class ThemeData {
@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);
......
......@@ -207,17 +207,15 @@ class _TimePickerHeaderLayout extends MultiChildLayoutDelegate {
// 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 _DialPainter extends CustomPainter {
}
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 _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
}
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;
......
......@@ -41,7 +41,7 @@ class Tooltip extends StatefulWidget {
/// 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 @@ class Tooltip extends StatefulWidget {
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;
......
......@@ -29,7 +29,7 @@ const Duration _kExpand = const Duration(milliseconds: 200);
/// * [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 @@ class TwoLevelListItem extends StatelessWidget {
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 @@ class TwoLevelList extends StatelessWidget {
/// 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.
///
......
......@@ -32,9 +32,8 @@ class TextSelectionPoint {
/// 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;
......
......@@ -60,18 +60,16 @@ class SemanticsData {
/// 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;
......
......@@ -44,7 +44,7 @@ class AnimatedCrossFade extends StatefulWidget {
/// 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 @@ class AnimatedCrossFade extends StatefulWidget {
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.
......
......@@ -38,7 +38,7 @@ typedef Future<LocaleQueryData> LocaleChangedCallback(Locale locale);
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 @@ class WidgetsApp extends StatefulWidget {
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;
......
......@@ -187,19 +187,18 @@ enum ConnectionState {
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 @@ class StreamBuilder<T> extends StreamBuilderBase<T, AsyncSnapshot<T>> {
/// 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 @@ class FutureBuilder<T> extends StatefulWidget {
/// 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 @@ class _FutureBuilderState<T> extends State<FutureBuilder<T>> {
/// 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() {
......
......@@ -71,7 +71,7 @@ class Dismissible extends StatefulWidget {
/// 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 @@ class Dismissible extends StatefulWidget {
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;
......
......@@ -117,7 +117,7 @@ class EditableText extends StatefulWidget {
///
/// 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 @@ class EditableText extends StatefulWidget {
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;
......
......@@ -10,13 +10,12 @@ import 'focus_manager.dart';
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 @@ class FocusScope extends StatefulWidget {
/// 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;
......
......@@ -21,14 +21,13 @@ class Form extends StatefulWidget {
/// 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 @@ class FormField<T> extends StatefulWidget {
/// 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().
......
......@@ -325,16 +325,15 @@ class RawGestureDetector extends StatefulWidget {
///
/// 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;
......
......@@ -77,14 +77,13 @@ class Hero extends StatefulWidget {
/// 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
......
......@@ -63,7 +63,7 @@ class Image extends StatefulWidget {
/// [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 @@ class Image extends StatefulWidget {
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.
///
......
......@@ -88,14 +88,13 @@ abstract class ImplicitlyAnimatedWidget extends StatefulWidget {
/// 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 @@ class AnimatedPositioned extends ImplicitlyAnimatedWidget {
/// 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 @@ class AnimatedPositioned extends ImplicitlyAnimatedWidget {
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 @@ class AnimatedOpacity extends ImplicitlyAnimatedWidget {
///
/// 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 @@ class AnimatedDefaultTextStyle extends ImplicitlyAnimatedWidget {
/// 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;
......
......@@ -32,12 +32,11 @@ class LayoutBuilder extends RenderObjectWidget {
/// 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.
......
......@@ -12,13 +12,12 @@ class LocaleQueryData { } // TODO(ianh): We need a better type here. This doesn'
/// 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;
......
......@@ -121,14 +121,13 @@ class MediaQuery extends InheritedWidget {
/// 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.
///
......
......@@ -475,15 +475,14 @@ class Navigator extends StatefulWidget {
/// 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;
......
......@@ -27,12 +27,11 @@ class OrientationBuilder extends StatelessWidget {
/// 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;
......
......@@ -201,12 +201,11 @@ class Overlay extends StatefulWidget {
/// 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.
///
......
......@@ -33,19 +33,18 @@ class GlowingOverscrollIndicator extends StatefulWidget {
///
/// 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.
......
......@@ -104,13 +104,12 @@ class PageStorage extends StatelessWidget {
/// 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;
......
......@@ -8,13 +8,12 @@ import 'framework.dart';
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,
......
......@@ -28,15 +28,14 @@ class RawKeyboardListener extends StatefulWidget {
///
/// 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;
......
......@@ -354,18 +354,17 @@ abstract class LocalHistoryRoute<T> extends Route<T> {
}
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;
......
......@@ -25,16 +25,15 @@ export 'package:flutter/physics.dart' show Tolerance;
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 @@ class Scrollable extends StatefulWidget {
// 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;
......
......@@ -146,14 +146,13 @@ class SingleChildScrollView extends StatelessWidget {
}
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;
......
......@@ -426,14 +426,13 @@ class SliverGrid extends SliverMultiBoxAdaptorWidget {
/// 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.
///
......
......@@ -29,16 +29,15 @@ abstract class SliverPersistentHeaderDelegate {
}
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;
......
......@@ -19,13 +19,12 @@ class TickerMode extends InheritedWidget {
/// 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.
///
......
......@@ -219,15 +219,14 @@ class SizeTransition extends AnimatedWidget {
/// 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 @@ class AnimatedBuilder extends AnimatedWidget {
/// 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;
......
......@@ -19,13 +19,12 @@ class WillPopScope extends StatefulWidget {
/// 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;
......
......@@ -9,18 +9,18 @@ import 'package:flutter_test/flutter_test.dart';
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));
});
}
......@@ -15,7 +15,7 @@ const TextStyle testStyle = const TextStyle(
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 @@ void main() {
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 @@ void main() {
});
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 @@ void main() {
});
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 @@ void main() {
});
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,
)));
......
......@@ -23,7 +23,7 @@ void main() {
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 @@ void main() {
});
testWidgets('Dialog action styles', (WidgetTester tester) async {
await tester.pumpWidget(new CupertinoDialogAction(
await tester.pumpWidget(const CupertinoDialogAction(
isDestructive: true,
child: const Text('Ok'),
));
......
......@@ -67,7 +67,7 @@ void main() {
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);
});
......
......@@ -9,10 +9,10 @@ void main() {
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(),
)
......
......@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
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'),
));
......
......@@ -100,7 +100,7 @@ void main() {
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 @@ void main() {
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,
......
......@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
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);
});
......
......@@ -20,7 +20,7 @@ void main() {
child: const Text('header')
)
),
new ListTile(
const ListTile(
leading: const Icon(Icons.archive),
title: const Text('Archive')
)
......
......@@ -31,9 +31,9 @@ void main() {
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
)
)
......
......@@ -36,7 +36,7 @@ void main() {
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);
});
......
......@@ -35,8 +35,8 @@ void main() {
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 @@ void main() {
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 @@ void main() {
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),
),
......
......@@ -27,8 +27,8 @@ void main() {
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 @@ void main() {
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 @@ void main() {
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 @@ void main() {
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)
)
......
......@@ -11,10 +11,10 @@ void main() {
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 @@ void main() {
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 @@ void main() {
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 @@ void main() {
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,
));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment