diff --git a/packages/flutter/lib/src/widgets/animated_cross_fade.dart b/packages/flutter/lib/src/widgets/animated_cross_fade.dart index a6924f13d1..e6c0847879 100644 --- a/packages/flutter/lib/src/widgets/animated_cross_fade.dart +++ b/packages/flutter/lib/src/widgets/animated_cross_fade.dart @@ -45,8 +45,8 @@ class AnimatedCrossFade extends StatefulWidget { /// order to have finer control, e.g., creating an overlap between the fades. AnimatedCrossFade({ Key key, - this.firstChild, - this.secondChild, + @required this.firstChild, + @required this.secondChild, this.firstCurve: Curves.linear, this.secondCurve: Curves.linear, this.sizeCurve: Curves.linear, diff --git a/packages/flutter/lib/src/widgets/banner.dart b/packages/flutter/lib/src/widgets/banner.dart index 48d0a8a775..df48842a99 100644 --- a/packages/flutter/lib/src/widgets/banner.dart +++ b/packages/flutter/lib/src/widgets/banner.dart @@ -168,7 +168,7 @@ class CheckedModeBanner extends StatelessWidget { /// Creates a checked mode banner. CheckedModeBanner({ Key key, - this.child + @required this.child }) : super(key: key); /// The widget to show behind the banner. diff --git a/packages/flutter/lib/src/widgets/container.dart b/packages/flutter/lib/src/widgets/container.dart index 6c99c59521..28a64f3cce 100644 --- a/packages/flutter/lib/src/widgets/container.dart +++ b/packages/flutter/lib/src/widgets/container.dart @@ -91,7 +91,7 @@ class Container extends StatelessWidget { BoxConstraints constraints, this.margin, this.transform, - this.child + this.child, }) : constraints = (width != null || height != null) ? constraints?.tighten(width: width, height: height) diff --git a/packages/flutter/lib/src/widgets/dismissable.dart b/packages/flutter/lib/src/widgets/dismissable.dart index c1d79d98ad..3afd7cbf83 100644 --- a/packages/flutter/lib/src/widgets/dismissable.dart +++ b/packages/flutter/lib/src/widgets/dismissable.dart @@ -73,7 +73,7 @@ class Dismissable extends StatefulWidget { /// according to their keys and avoids this pitfall. Dismissable({ @required Key key, - this.child, + @required this.child, this.background, this.secondaryBackground, this.onResize, diff --git a/packages/flutter/lib/src/widgets/focus.dart b/packages/flutter/lib/src/widgets/focus.dart index fae934bded..afe8f22883 100644 --- a/packages/flutter/lib/src/widgets/focus.dart +++ b/packages/flutter/lib/src/widgets/focus.dart @@ -24,7 +24,7 @@ class _FocusScope extends InheritedWidget { this.scopeFocused, this.focusedScope, this.focusedWidget, - Widget child + @required Widget child, }) : super(key: key, child: child) { assert(scopeFocused != null); } @@ -113,7 +113,7 @@ class Focus extends StatefulWidget { Focus({ @required GlobalKey key, this.initiallyFocusedScope, - this.child + @required this.child, }) : super(key: key) { assert(key != null); } diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index 2f9e58f6b0..5e4be3aa7a 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -1071,7 +1071,7 @@ abstract class State { /// [ParentDataWidget]. abstract class ProxyWidget extends Widget { /// Creates a widget that has exactly one child widget. - const ProxyWidget({ Key key, this.child }) : super(key: key); + const ProxyWidget({ Key key, @required this.child }) : super(key: key); /// The widget below this widget in the tree. final Widget child; diff --git a/packages/flutter/lib/src/widgets/implicit_animations.dart b/packages/flutter/lib/src/widgets/implicit_animations.dart index f476eb957e..8a7a9eb8be 100644 --- a/packages/flutter/lib/src/widgets/implicit_animations.dart +++ b/packages/flutter/lib/src/widgets/implicit_animations.dart @@ -375,7 +375,7 @@ class AnimatedPositioned extends ImplicitlyAnimatedWidget { /// The [curve] and [duration] arguments must not be null. AnimatedPositioned({ Key key, - this.child, + @required this.child, this.left, this.top, this.right, diff --git a/packages/flutter/lib/src/widgets/notification_listener.dart b/packages/flutter/lib/src/widgets/notification_listener.dart index 65894862f6..b1fddeff5e 100644 --- a/packages/flutter/lib/src/widgets/notification_listener.dart +++ b/packages/flutter/lib/src/widgets/notification_listener.dart @@ -72,7 +72,7 @@ class NotificationListener extends StatelessWidget { /// Creates a widget that listens for notifications. NotificationListener({ Key key, - this.child, + @required this.child, this.onNotification }) : super(key: key); diff --git a/packages/flutter/lib/src/widgets/page_storage.dart b/packages/flutter/lib/src/widgets/page_storage.dart index 44e5a7f6bd..dcbdaed33f 100644 --- a/packages/flutter/lib/src/widgets/page_storage.dart +++ b/packages/flutter/lib/src/widgets/page_storage.dart @@ -107,7 +107,7 @@ class PageStorage extends StatelessWidget { PageStorage({ Key key, @required this.bucket, - this.child + @required this.child }) : super(key: key) { assert(bucket != null); } diff --git a/packages/flutter/lib/src/widgets/raw_keyboard_listener.dart b/packages/flutter/lib/src/widgets/raw_keyboard_listener.dart index 1ef817a168..2825aaae50 100644 --- a/packages/flutter/lib/src/widgets/raw_keyboard_listener.dart +++ b/packages/flutter/lib/src/widgets/raw_keyboard_listener.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import 'basic.dart'; @@ -30,7 +31,7 @@ class RawKeyboardListener extends StatefulWidget { Key key, this.focused: false, this.onKey, - this.child + @required this.child, }) : super(key: key) { assert(child != null); } @@ -98,7 +99,5 @@ class _RawKeyboardListenerState extends State { } @override - Widget build(BuildContext context) { - return config.child; - } + Widget build(BuildContext context) => config.child; } diff --git a/packages/flutter/lib/src/widgets/routes.dart b/packages/flutter/lib/src/widgets/routes.dart index ff4180008f..732cf8a58b 100644 --- a/packages/flutter/lib/src/widgets/routes.dart +++ b/packages/flutter/lib/src/widgets/routes.dart @@ -333,7 +333,7 @@ class _ModalScopeStatus extends InheritedWidget { Key key, this.isCurrent, this.route, - Widget child + @required Widget child }) : super(key: key, child: child) { assert(isCurrent != null); assert(route != null); @@ -366,7 +366,7 @@ class _ModalScope extends StatefulWidget { _ModalScope({ Key key, this.route, - this.page + @required this.page, }) : super(key: key); final ModalRoute route; diff --git a/packages/flutter/lib/src/widgets/title.dart b/packages/flutter/lib/src/widgets/title.dart index 53e59bbd66..001edc9223 100644 --- a/packages/flutter/lib/src/widgets/title.dart +++ b/packages/flutter/lib/src/widgets/title.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; @@ -12,7 +13,7 @@ class Title extends StatelessWidget { Key key, this.title, this.color, - this.child + @required this.child, }) : super(key: key) { assert(color == null || color.alpha == 0xFF); } diff --git a/packages/flutter/lib/src/widgets/transitions.dart b/packages/flutter/lib/src/widgets/transitions.dart index c1adf52739..2eb867d889 100644 --- a/packages/flutter/lib/src/widgets/transitions.dart +++ b/packages/flutter/lib/src/widgets/transitions.dart @@ -91,7 +91,7 @@ class SlideTransition extends AnimatedWidget { Key key, Animation position, this.transformHitTests: true, - this.child + this.child, }) : super(key: key, animation: position); /// The animation that controls the position of the child. @@ -116,7 +116,7 @@ class SlideTransition extends AnimatedWidget { return new FractionalTranslation( translation: position.value, transformHitTests: transformHitTests, - child: child + child: child, ); } } @@ -131,7 +131,7 @@ class ScaleTransition extends AnimatedWidget { Key key, Animation scale, this.alignment: FractionalOffset.center, - this.child + this.child, }) : super(key: key, animation: scale); /// The animation that controls the scale of the child. @@ -158,7 +158,7 @@ class ScaleTransition extends AnimatedWidget { return new Transform( transform: transform, alignment: alignment, - child: child + child: child, ); } } @@ -171,7 +171,7 @@ class RotationTransition extends AnimatedWidget { RotationTransition({ Key key, Animation turns, - this.child + this.child, }) : super(key: key, animation: turns); /// The animation that controls the rotation of the child. @@ -190,7 +190,7 @@ class RotationTransition extends AnimatedWidget { return new Transform( transform: transform, alignment: FractionalOffset.center, - child: child + child: child, ); } } @@ -210,7 +210,7 @@ class SizeTransition extends AnimatedWidget { this.axis: Axis.vertical, Animation sizeFactor, this.axisAlignment: 0.5, - this.child + this.child, }) : super(key: key, animation: sizeFactor) { assert(axis != null); } @@ -241,7 +241,7 @@ class SizeTransition extends AnimatedWidget { alignment: alignment, heightFactor: axis == Axis.vertical ? sizeFactor.value : null, widthFactor: axis == Axis.horizontal ? sizeFactor.value : null, - child: child + child: child, ) ); } @@ -258,7 +258,7 @@ class FadeTransition extends AnimatedWidget { FadeTransition({ Key key, Animation opacity, - this.child + this.child, }) : super(key: key, animation: opacity); /// The animation that controls the opacity of the child. @@ -310,7 +310,7 @@ class PositionedTransition extends AnimatedWidget { PositionedTransition({ Key key, Animation rect, - this.child + @required this.child, }) : super(key: key, animation: rect); /// The animation that controls the child's size and position. @@ -326,7 +326,7 @@ class PositionedTransition extends AnimatedWidget { right: rect.value.right, bottom: rect.value.bottom, left: rect.value.left, - child: child + child: child, ); } } @@ -350,7 +350,7 @@ class RelativePositionedTransition extends AnimatedWidget { Key key, @required Animation rect, @required this.size, - this.child + @required this.child, }) : super(key: key, animation: rect); /// The animation that controls the child's size and position. @@ -373,7 +373,7 @@ class RelativePositionedTransition extends AnimatedWidget { right: offsets.right, bottom: offsets.bottom, left: offsets.left, - child: child + child: child, ); } } @@ -412,7 +412,7 @@ class AnimatedBuilder extends AnimatedWidget { Key key, @required Animation animation, @required this.builder, - this.child + this.child, }) : super(key: key, animation: animation) { assert(builder != null); } diff --git a/packages/flutter/test/widgets/title_test.dart b/packages/flutter/test/widgets/title_test.dart index adf5d75129..aa5a6082a6 100644 --- a/packages/flutter/test/widgets/title_test.dart +++ b/packages/flutter/test/widgets/title_test.dart @@ -10,6 +10,7 @@ void main() { Widget widget = new Title( color: const Color(0xFF00FF00), title: 'Awesome app', + child: new Container(), ); expect(widget.toString, isNot(throwsException)); });