Commit 0400107c authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Apply @required according to the rules, for all of widgets/* (#7730)

parent 8f7d0a45
...@@ -45,8 +45,8 @@ class AnimatedCrossFade extends StatefulWidget { ...@@ -45,8 +45,8 @@ class AnimatedCrossFade extends StatefulWidget {
/// order to have finer control, e.g., creating an overlap between the fades. /// order to have finer control, e.g., creating an overlap between the fades.
AnimatedCrossFade({ AnimatedCrossFade({
Key key, Key key,
this.firstChild, @required this.firstChild,
this.secondChild, @required this.secondChild,
this.firstCurve: Curves.linear, this.firstCurve: Curves.linear,
this.secondCurve: Curves.linear, this.secondCurve: Curves.linear,
this.sizeCurve: Curves.linear, this.sizeCurve: Curves.linear,
......
...@@ -168,7 +168,7 @@ class CheckedModeBanner extends StatelessWidget { ...@@ -168,7 +168,7 @@ class CheckedModeBanner extends StatelessWidget {
/// Creates a checked mode banner. /// Creates a checked mode banner.
CheckedModeBanner({ CheckedModeBanner({
Key key, Key key,
this.child @required this.child
}) : super(key: key); }) : super(key: key);
/// The widget to show behind the banner. /// The widget to show behind the banner.
......
...@@ -91,7 +91,7 @@ class Container extends StatelessWidget { ...@@ -91,7 +91,7 @@ class Container extends StatelessWidget {
BoxConstraints constraints, BoxConstraints constraints,
this.margin, this.margin,
this.transform, this.transform,
this.child this.child,
}) : constraints = }) : constraints =
(width != null || height != null) (width != null || height != null)
? constraints?.tighten(width: width, height: height) ? constraints?.tighten(width: width, height: height)
......
...@@ -73,7 +73,7 @@ class Dismissable extends StatefulWidget { ...@@ -73,7 +73,7 @@ class Dismissable extends StatefulWidget {
/// according to their keys and avoids this pitfall. /// according to their keys and avoids this pitfall.
Dismissable({ Dismissable({
@required Key key, @required Key key,
this.child, @required this.child,
this.background, this.background,
this.secondaryBackground, this.secondaryBackground,
this.onResize, this.onResize,
......
...@@ -24,7 +24,7 @@ class _FocusScope extends InheritedWidget { ...@@ -24,7 +24,7 @@ class _FocusScope extends InheritedWidget {
this.scopeFocused, this.scopeFocused,
this.focusedScope, this.focusedScope,
this.focusedWidget, this.focusedWidget,
Widget child @required Widget child,
}) : super(key: key, child: child) { }) : super(key: key, child: child) {
assert(scopeFocused != null); assert(scopeFocused != null);
} }
...@@ -113,7 +113,7 @@ class Focus extends StatefulWidget { ...@@ -113,7 +113,7 @@ class Focus extends StatefulWidget {
Focus({ Focus({
@required GlobalKey key, @required GlobalKey key,
this.initiallyFocusedScope, this.initiallyFocusedScope,
this.child @required this.child,
}) : super(key: key) { }) : super(key: key) {
assert(key != null); assert(key != null);
} }
......
...@@ -1071,7 +1071,7 @@ abstract class State<T extends StatefulWidget> { ...@@ -1071,7 +1071,7 @@ abstract class State<T extends StatefulWidget> {
/// [ParentDataWidget]. /// [ParentDataWidget].
abstract class ProxyWidget extends Widget { abstract class ProxyWidget extends Widget {
/// Creates a widget that has exactly one child 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. /// The widget below this widget in the tree.
final Widget child; final Widget child;
......
...@@ -375,7 +375,7 @@ class AnimatedPositioned extends ImplicitlyAnimatedWidget { ...@@ -375,7 +375,7 @@ class AnimatedPositioned extends ImplicitlyAnimatedWidget {
/// The [curve] and [duration] arguments must not be null. /// The [curve] and [duration] arguments must not be null.
AnimatedPositioned({ AnimatedPositioned({
Key key, Key key,
this.child, @required this.child,
this.left, this.left,
this.top, this.top,
this.right, this.right,
......
...@@ -72,7 +72,7 @@ class NotificationListener<T extends Notification> extends StatelessWidget { ...@@ -72,7 +72,7 @@ class NotificationListener<T extends Notification> extends StatelessWidget {
/// Creates a widget that listens for notifications. /// Creates a widget that listens for notifications.
NotificationListener({ NotificationListener({
Key key, Key key,
this.child, @required this.child,
this.onNotification this.onNotification
}) : super(key: key); }) : super(key: key);
......
...@@ -107,7 +107,7 @@ class PageStorage extends StatelessWidget { ...@@ -107,7 +107,7 @@ class PageStorage extends StatelessWidget {
PageStorage({ PageStorage({
Key key, Key key,
@required this.bucket, @required this.bucket,
this.child @required this.child
}) : super(key: key) { }) : super(key: key) {
assert(bucket != null); assert(bucket != null);
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'basic.dart'; import 'basic.dart';
...@@ -30,7 +31,7 @@ class RawKeyboardListener extends StatefulWidget { ...@@ -30,7 +31,7 @@ class RawKeyboardListener extends StatefulWidget {
Key key, Key key,
this.focused: false, this.focused: false,
this.onKey, this.onKey,
this.child @required this.child,
}) : super(key: key) { }) : super(key: key) {
assert(child != null); assert(child != null);
} }
...@@ -98,7 +99,5 @@ class _RawKeyboardListenerState extends State<RawKeyboardListener> { ...@@ -98,7 +99,5 @@ class _RawKeyboardListenerState extends State<RawKeyboardListener> {
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) => config.child;
return config.child;
}
} }
...@@ -333,7 +333,7 @@ class _ModalScopeStatus extends InheritedWidget { ...@@ -333,7 +333,7 @@ class _ModalScopeStatus extends InheritedWidget {
Key key, Key key,
this.isCurrent, this.isCurrent,
this.route, this.route,
Widget child @required Widget child
}) : super(key: key, child: child) { }) : super(key: key, child: child) {
assert(isCurrent != null); assert(isCurrent != null);
assert(route != null); assert(route != null);
...@@ -366,7 +366,7 @@ class _ModalScope extends StatefulWidget { ...@@ -366,7 +366,7 @@ class _ModalScope extends StatefulWidget {
_ModalScope({ _ModalScope({
Key key, Key key,
this.route, this.route,
this.page @required this.page,
}) : super(key: key); }) : super(key: key);
final ModalRoute<dynamic> route; final ModalRoute<dynamic> route;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
...@@ -12,7 +13,7 @@ class Title extends StatelessWidget { ...@@ -12,7 +13,7 @@ class Title extends StatelessWidget {
Key key, Key key,
this.title, this.title,
this.color, this.color,
this.child @required this.child,
}) : super(key: key) { }) : super(key: key) {
assert(color == null || color.alpha == 0xFF); assert(color == null || color.alpha == 0xFF);
} }
......
...@@ -91,7 +91,7 @@ class SlideTransition extends AnimatedWidget { ...@@ -91,7 +91,7 @@ class SlideTransition extends AnimatedWidget {
Key key, Key key,
Animation<FractionalOffset> position, Animation<FractionalOffset> position,
this.transformHitTests: true, this.transformHitTests: true,
this.child this.child,
}) : super(key: key, animation: position); }) : super(key: key, animation: position);
/// The animation that controls the position of the child. /// The animation that controls the position of the child.
...@@ -116,7 +116,7 @@ class SlideTransition extends AnimatedWidget { ...@@ -116,7 +116,7 @@ class SlideTransition extends AnimatedWidget {
return new FractionalTranslation( return new FractionalTranslation(
translation: position.value, translation: position.value,
transformHitTests: transformHitTests, transformHitTests: transformHitTests,
child: child child: child,
); );
} }
} }
...@@ -131,7 +131,7 @@ class ScaleTransition extends AnimatedWidget { ...@@ -131,7 +131,7 @@ class ScaleTransition extends AnimatedWidget {
Key key, Key key,
Animation<double> scale, Animation<double> scale,
this.alignment: FractionalOffset.center, this.alignment: FractionalOffset.center,
this.child this.child,
}) : super(key: key, animation: scale); }) : super(key: key, animation: scale);
/// The animation that controls the scale of the child. /// The animation that controls the scale of the child.
...@@ -158,7 +158,7 @@ class ScaleTransition extends AnimatedWidget { ...@@ -158,7 +158,7 @@ class ScaleTransition extends AnimatedWidget {
return new Transform( return new Transform(
transform: transform, transform: transform,
alignment: alignment, alignment: alignment,
child: child child: child,
); );
} }
} }
...@@ -171,7 +171,7 @@ class RotationTransition extends AnimatedWidget { ...@@ -171,7 +171,7 @@ class RotationTransition extends AnimatedWidget {
RotationTransition({ RotationTransition({
Key key, Key key,
Animation<double> turns, Animation<double> turns,
this.child this.child,
}) : super(key: key, animation: turns); }) : super(key: key, animation: turns);
/// The animation that controls the rotation of the child. /// The animation that controls the rotation of the child.
...@@ -190,7 +190,7 @@ class RotationTransition extends AnimatedWidget { ...@@ -190,7 +190,7 @@ class RotationTransition extends AnimatedWidget {
return new Transform( return new Transform(
transform: transform, transform: transform,
alignment: FractionalOffset.center, alignment: FractionalOffset.center,
child: child child: child,
); );
} }
} }
...@@ -210,7 +210,7 @@ class SizeTransition extends AnimatedWidget { ...@@ -210,7 +210,7 @@ class SizeTransition extends AnimatedWidget {
this.axis: Axis.vertical, this.axis: Axis.vertical,
Animation<double> sizeFactor, Animation<double> sizeFactor,
this.axisAlignment: 0.5, this.axisAlignment: 0.5,
this.child this.child,
}) : super(key: key, animation: sizeFactor) { }) : super(key: key, animation: sizeFactor) {
assert(axis != null); assert(axis != null);
} }
...@@ -241,7 +241,7 @@ class SizeTransition extends AnimatedWidget { ...@@ -241,7 +241,7 @@ class SizeTransition extends AnimatedWidget {
alignment: alignment, alignment: alignment,
heightFactor: axis == Axis.vertical ? sizeFactor.value : null, heightFactor: axis == Axis.vertical ? sizeFactor.value : null,
widthFactor: axis == Axis.horizontal ? sizeFactor.value : null, widthFactor: axis == Axis.horizontal ? sizeFactor.value : null,
child: child child: child,
) )
); );
} }
...@@ -258,7 +258,7 @@ class FadeTransition extends AnimatedWidget { ...@@ -258,7 +258,7 @@ class FadeTransition extends AnimatedWidget {
FadeTransition({ FadeTransition({
Key key, Key key,
Animation<double> opacity, Animation<double> opacity,
this.child this.child,
}) : super(key: key, animation: opacity); }) : super(key: key, animation: opacity);
/// The animation that controls the opacity of the child. /// The animation that controls the opacity of the child.
...@@ -310,7 +310,7 @@ class PositionedTransition extends AnimatedWidget { ...@@ -310,7 +310,7 @@ class PositionedTransition extends AnimatedWidget {
PositionedTransition({ PositionedTransition({
Key key, Key key,
Animation<RelativeRect> rect, Animation<RelativeRect> rect,
this.child @required this.child,
}) : super(key: key, animation: rect); }) : super(key: key, animation: rect);
/// The animation that controls the child's size and position. /// The animation that controls the child's size and position.
...@@ -326,7 +326,7 @@ class PositionedTransition extends AnimatedWidget { ...@@ -326,7 +326,7 @@ class PositionedTransition extends AnimatedWidget {
right: rect.value.right, right: rect.value.right,
bottom: rect.value.bottom, bottom: rect.value.bottom,
left: rect.value.left, left: rect.value.left,
child: child child: child,
); );
} }
} }
...@@ -350,7 +350,7 @@ class RelativePositionedTransition extends AnimatedWidget { ...@@ -350,7 +350,7 @@ class RelativePositionedTransition extends AnimatedWidget {
Key key, Key key,
@required Animation<Rect> rect, @required Animation<Rect> rect,
@required this.size, @required this.size,
this.child @required this.child,
}) : super(key: key, animation: rect); }) : super(key: key, animation: rect);
/// The animation that controls the child's size and position. /// The animation that controls the child's size and position.
...@@ -373,7 +373,7 @@ class RelativePositionedTransition extends AnimatedWidget { ...@@ -373,7 +373,7 @@ class RelativePositionedTransition extends AnimatedWidget {
right: offsets.right, right: offsets.right,
bottom: offsets.bottom, bottom: offsets.bottom,
left: offsets.left, left: offsets.left,
child: child child: child,
); );
} }
} }
...@@ -412,7 +412,7 @@ class AnimatedBuilder extends AnimatedWidget { ...@@ -412,7 +412,7 @@ class AnimatedBuilder extends AnimatedWidget {
Key key, Key key,
@required Animation<Object> animation, @required Animation<Object> animation,
@required this.builder, @required this.builder,
this.child this.child,
}) : super(key: key, animation: animation) { }) : super(key: key, animation: animation) {
assert(builder != null); assert(builder != null);
} }
......
...@@ -10,6 +10,7 @@ void main() { ...@@ -10,6 +10,7 @@ void main() {
Widget widget = new Title( Widget widget = new Title(
color: const Color(0xFF00FF00), color: const Color(0xFF00FF00),
title: 'Awesome app', title: 'Awesome app',
child: new Container(),
); );
expect(widget.toString, isNot(throwsException)); expect(widget.toString, isNot(throwsException));
}); });
......
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