Apply @required according to the rules, for all of widgets/* (#7730)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -1071,7 +1071,7 @@ abstract class State<T extends StatefulWidget> {
|
||||
/// [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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -72,7 +72,7 @@ class NotificationListener<T extends Notification> extends StatelessWidget {
|
||||
/// Creates a widget that listens for notifications.
|
||||
NotificationListener({
|
||||
Key key,
|
||||
this.child,
|
||||
@required this.child,
|
||||
this.onNotification
|
||||
}) : super(key: key);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<RawKeyboardListener> {
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return config.child;
|
||||
}
|
||||
Widget build(BuildContext context) => config.child;
|
||||
}
|
||||
|
||||
@@ -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<dynamic> route;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ class SlideTransition extends AnimatedWidget {
|
||||
Key key,
|
||||
Animation<FractionalOffset> 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<double> 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<double> 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<double> 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<double> 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<RelativeRect> 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> 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<Object> animation,
|
||||
@required this.builder,
|
||||
this.child
|
||||
this.child,
|
||||
}) : super(key: key, animation: animation) {
|
||||
assert(builder != null);
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user