Commit 9b5d1fbe authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Provide more widget const constructors. (#9247)

Still many more to go.
parent 93b90362
...@@ -14,7 +14,9 @@ class FractionalOffset { ...@@ -14,7 +14,9 @@ class FractionalOffset {
/// Creates a fractional offset. /// Creates a fractional offset.
/// ///
/// The [dx] and [dy] arguments must not be null. /// The [dx] and [dy] arguments must not be null.
const FractionalOffset(this.dx, this.dy); const FractionalOffset(this.dx, this.dy)
: assert(dx != null),
assert(dy != null);
/// The distance fraction in the horizontal direction. /// The distance fraction in the horizontal direction.
/// ///
......
...@@ -167,19 +167,18 @@ class Banner extends StatelessWidget { ...@@ -167,19 +167,18 @@ class Banner extends StatelessWidget {
/// Creates a banner. /// Creates a banner.
/// ///
/// The [message] and [location] arguments must not be null. /// The [message] and [location] arguments must not be null.
Banner({ const Banner({
Key key, Key key,
this.child, this.child,
@required this.message, @required this.message,
@required this.location, @required this.location,
this.color: _kColor, this.color: _kColor,
this.textStyle: _kTextStyle, this.textStyle: _kTextStyle,
}) : super(key: key) { }) : assert(message != null),
assert(message != null); assert(location != null),
assert(location != null); assert(color != null),
assert(color != null); assert(textStyle != null),
assert(textStyle != null); super(key: key);
}
/// The widget to show behind the banner. /// The widget to show behind the banner.
final Widget child; final Widget child;
...@@ -215,7 +214,7 @@ class Banner extends StatelessWidget { ...@@ -215,7 +214,7 @@ class Banner extends StatelessWidget {
/// Does nothing in release mode. /// Does nothing in release mode.
class CheckedModeBanner extends StatelessWidget { class CheckedModeBanner extends StatelessWidget {
/// Creates a checked mode banner. /// Creates a checked mode banner.
CheckedModeBanner({ const CheckedModeBanner({
Key key, Key key,
@required this.child @required this.child
}) : super(key: key); }) : super(key: key);
......
This diff is collapsed.
...@@ -1339,9 +1339,9 @@ abstract class MultiChildRenderObjectWidget extends RenderObjectWidget { ...@@ -1339,9 +1339,9 @@ abstract class MultiChildRenderObjectWidget extends RenderObjectWidget {
/// The [children] argument must not be null and must not contain any null /// The [children] argument must not be null and must not contain any null
/// objects. /// objects.
MultiChildRenderObjectWidget({ Key key, this.children: const <Widget>[] }) MultiChildRenderObjectWidget({ Key key, this.children: const <Widget>[] })
: super(key: key) { : assert(children != null),
assert(children != null); super(key: key) {
assert(!children.any((Widget child) => child == null)); assert(!children.any((Widget child) => child == null)); // https://github.com/dart-lang/sdk/issues/29276
} }
/// The widgets below this widget in the tree. /// The widgets below this widget in the tree.
......
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