parent
93b90362fd
commit
9b5d1fbe1e
@ -14,7 +14,9 @@ class FractionalOffset {
|
||||
/// Creates a fractional offset.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
|
@ -167,19 +167,18 @@ class Banner extends StatelessWidget {
|
||||
/// Creates a banner.
|
||||
///
|
||||
/// The [message] and [location] arguments must not be null.
|
||||
Banner({
|
||||
const Banner({
|
||||
Key key,
|
||||
this.child,
|
||||
@required this.message,
|
||||
@required this.location,
|
||||
this.color: _kColor,
|
||||
this.textStyle: _kTextStyle,
|
||||
}) : super(key: key) {
|
||||
assert(message != null);
|
||||
assert(location != null);
|
||||
assert(color != null);
|
||||
assert(textStyle != null);
|
||||
}
|
||||
}) : assert(message != null),
|
||||
assert(location != null),
|
||||
assert(color != null),
|
||||
assert(textStyle != null),
|
||||
super(key: key);
|
||||
|
||||
/// The widget to show behind the banner.
|
||||
final Widget child;
|
||||
@ -215,7 +214,7 @@ class Banner extends StatelessWidget {
|
||||
/// Does nothing in release mode.
|
||||
class CheckedModeBanner extends StatelessWidget {
|
||||
/// Creates a checked mode banner.
|
||||
CheckedModeBanner({
|
||||
const CheckedModeBanner({
|
||||
Key key,
|
||||
@required this.child
|
||||
}) : super(key: key);
|
||||
|
@ -65,13 +65,12 @@ class Opacity extends SingleChildRenderObjectWidget {
|
||||
///
|
||||
/// The [opacity] argument must not be null and must be between 0.0 and 1.0
|
||||
/// (inclusive).
|
||||
Opacity({
|
||||
const Opacity({
|
||||
Key key,
|
||||
@required this.opacity,
|
||||
Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(opacity != null && opacity >= 0.0 && opacity <= 1.0);
|
||||
}
|
||||
}) : assert(opacity != null && opacity >= 0.0 && opacity <= 1.0),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// The fraction to scale the child's alpha value.
|
||||
///
|
||||
@ -108,15 +107,14 @@ class ShaderMask extends SingleChildRenderObjectWidget {
|
||||
/// Creates a widget that applies a mask generated by a [Shader] to its child.
|
||||
///
|
||||
/// The [shaderCallback] and [blendMode] arguments must not be null.
|
||||
ShaderMask({
|
||||
const ShaderMask({
|
||||
Key key,
|
||||
@required this.shaderCallback,
|
||||
this.blendMode: BlendMode.modulate,
|
||||
Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(shaderCallback != null);
|
||||
assert(blendMode != null);
|
||||
}
|
||||
}) : assert(shaderCallback != null),
|
||||
assert(blendMode != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// Called to creates the [Shader] that generates the mask.
|
||||
///
|
||||
@ -154,13 +152,12 @@ class BackdropFilter extends SingleChildRenderObjectWidget {
|
||||
/// Creates a backdrop filter.
|
||||
///
|
||||
/// The [filter] argument must not be null.
|
||||
BackdropFilter({
|
||||
const BackdropFilter({
|
||||
Key key,
|
||||
@required this.filter,
|
||||
Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(filter != null);
|
||||
}
|
||||
}) : assert(filter != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// The image filter to apply to the existing painted content before painting the child.
|
||||
///
|
||||
@ -206,10 +203,9 @@ class BackdropFilter extends SingleChildRenderObjectWidget {
|
||||
/// * [Canvas].
|
||||
class CustomPaint extends SingleChildRenderObjectWidget {
|
||||
/// Creates a widget that delegates its painting.
|
||||
CustomPaint({ Key key, this.painter, this.foregroundPainter, this.size: Size.zero, Widget child })
|
||||
: super(key: key, child: child) {
|
||||
assert(size != null);
|
||||
}
|
||||
const CustomPaint({ Key key, this.painter, this.foregroundPainter, this.size: Size.zero, Widget child })
|
||||
: assert(size != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// The painter that paints before the children.
|
||||
final CustomPainter painter;
|
||||
@ -292,7 +288,7 @@ class ClipRect extends SingleChildRenderObjectWidget {
|
||||
///
|
||||
/// If [clipper] is null, the clip will match the layout size and position of
|
||||
/// the child.
|
||||
ClipRect({ Key key, this.clipper, Widget child }) : super(key: key, child: child);
|
||||
const ClipRect({ Key key, this.clipper, Widget child }) : super(key: key, child: child);
|
||||
|
||||
/// If non-null, determines which clip to use.
|
||||
final CustomClipper<Rect> clipper;
|
||||
@ -330,14 +326,13 @@ class ClipRRect extends SingleChildRenderObjectWidget {
|
||||
/// right-angled corners.
|
||||
///
|
||||
/// If [clipper] is non-null, then [borderRadius] is ignored.
|
||||
ClipRRect({
|
||||
const ClipRRect({
|
||||
Key key,
|
||||
this.borderRadius,
|
||||
this.clipper,
|
||||
Widget child,
|
||||
}) : super(key: key, child: child) {
|
||||
assert(borderRadius != null || clipper != null);
|
||||
}
|
||||
}) : assert(borderRadius != null || clipper != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// The border radius of the rounded corners.
|
||||
///
|
||||
@ -379,7 +374,7 @@ class ClipOval extends SingleChildRenderObjectWidget {
|
||||
///
|
||||
/// If [clipper] is null, the oval will be inscribed into the layout size and
|
||||
/// position of the child.
|
||||
ClipOval({ Key key, this.clipper, Widget child }) : super(key: key, child: child);
|
||||
const ClipOval({ Key key, this.clipper, Widget child }) : super(key: key, child: child);
|
||||
|
||||
/// If non-null, determines which clip to use.
|
||||
///
|
||||
@ -425,7 +420,7 @@ class ClipPath extends SingleChildRenderObjectWidget {
|
||||
/// size and location of the child. However, rather than use this default,
|
||||
/// consider using a [ClipRect], which can achieve the same effect more
|
||||
/// efficiently.
|
||||
ClipPath({ Key key, this.clipper, Widget child }) : super(key: key, child: child);
|
||||
const ClipPath({ Key key, this.clipper, Widget child }) : super(key: key, child: child);
|
||||
|
||||
/// If non-null, determines which clip to use.
|
||||
///
|
||||
@ -451,20 +446,18 @@ class ClipPath extends SingleChildRenderObjectWidget {
|
||||
/// A widget representing a physical layer that clips its children to a shape.
|
||||
class PhysicalModel extends SingleChildRenderObjectWidget {
|
||||
/// Creates a physical model with a rounded-rectangular clip.
|
||||
PhysicalModel({
|
||||
const PhysicalModel({
|
||||
Key key,
|
||||
@required this.shape,
|
||||
this.borderRadius: BorderRadius.zero,
|
||||
@required this.elevation,
|
||||
@required this.color,
|
||||
Widget child,
|
||||
}) : super(key: key, child: child) {
|
||||
if (shape == BoxShape.rectangle)
|
||||
assert(borderRadius != null);
|
||||
assert(shape != null);
|
||||
assert(elevation != null);
|
||||
assert(color != null);
|
||||
}
|
||||
}) : assert(shape != null),
|
||||
assert(borderRadius != null),
|
||||
assert(elevation != null),
|
||||
assert(color != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// The type of shape.
|
||||
final BoxShape shape;
|
||||
@ -473,6 +466,8 @@ class PhysicalModel extends SingleChildRenderObjectWidget {
|
||||
///
|
||||
/// Values are clamped so that horizontal and vertical radii sums do not
|
||||
/// exceed width/height.
|
||||
///
|
||||
/// This is ignored if the [shape] is not [BoxShape.rectangle].
|
||||
final BorderRadius borderRadius;
|
||||
|
||||
/// The z-coordinate at which to place this physical object.
|
||||
@ -501,16 +496,15 @@ class Transform extends SingleChildRenderObjectWidget {
|
||||
/// Creates a widget that transforms its child.
|
||||
///
|
||||
/// The [transform] argument must not be null.
|
||||
Transform({
|
||||
const Transform({
|
||||
Key key,
|
||||
@required this.transform,
|
||||
this.origin,
|
||||
this.alignment,
|
||||
this.transformHitTests: true,
|
||||
Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(transform != null);
|
||||
}
|
||||
}) : assert(transform != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// The matrix to transform the child by during painting.
|
||||
final Matrix4 transform;
|
||||
@ -554,15 +548,14 @@ class FittedBox extends SingleChildRenderObjectWidget {
|
||||
/// Creates a widget that scales and positions its child within itself according to [fit].
|
||||
///
|
||||
/// The [fit] and [alignment] arguments must not be null.
|
||||
FittedBox({
|
||||
const FittedBox({
|
||||
Key key,
|
||||
this.fit: BoxFit.contain,
|
||||
this.alignment: FractionalOffset.center,
|
||||
Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(fit != null);
|
||||
assert(alignment != null && alignment.dx != null && alignment.dy != null);
|
||||
}
|
||||
}) : assert(fit != null),
|
||||
assert(alignment != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// How to inscribe the child into the space allocated during layout.
|
||||
final BoxFit fit;
|
||||
@ -591,14 +584,13 @@ class FractionalTranslation extends SingleChildRenderObjectWidget {
|
||||
/// Creates a widget that translates its child's painting.
|
||||
///
|
||||
/// The [translation] argument must not be null.
|
||||
FractionalTranslation({
|
||||
const FractionalTranslation({
|
||||
Key key,
|
||||
@required this.translation,
|
||||
this.transformHitTests: true,
|
||||
Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(translation != null);
|
||||
}
|
||||
}) : assert(translation != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// The offset by which to translate the child, as a multiple of its size.
|
||||
final FractionalOffset translation;
|
||||
@ -626,13 +618,12 @@ class RotatedBox extends SingleChildRenderObjectWidget {
|
||||
/// A widget that rotates its child.
|
||||
///
|
||||
/// The [quarterTurns] argument must not be null.
|
||||
RotatedBox({
|
||||
const RotatedBox({
|
||||
Key key,
|
||||
@required this.quarterTurns,
|
||||
Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(quarterTurns != null);
|
||||
}
|
||||
}) : assert(quarterTurns != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// The number of clockwise quarter turns the child should be rotated.
|
||||
final int quarterTurns;
|
||||
@ -656,13 +647,12 @@ class Padding extends SingleChildRenderObjectWidget {
|
||||
/// Creates a widget that insets its child.
|
||||
///
|
||||
/// The [padding] argument must not be null.
|
||||
Padding({
|
||||
const Padding({
|
||||
Key key,
|
||||
@required this.padding,
|
||||
Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(padding != null);
|
||||
}
|
||||
}) : assert(padding != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// The amount of space by which to inset the child.
|
||||
final EdgeInsets padding;
|
||||
@ -703,17 +693,16 @@ class Align extends SingleChildRenderObjectWidget {
|
||||
/// Creates an alignment widget.
|
||||
///
|
||||
/// The alignment defaults to [FractionalOffset.center].
|
||||
Align({
|
||||
const Align({
|
||||
Key key,
|
||||
this.alignment: FractionalOffset.center,
|
||||
this.widthFactor,
|
||||
this.heightFactor,
|
||||
Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(alignment != null && alignment.dx != null && alignment.dy != null);
|
||||
assert(widthFactor == null || widthFactor >= 0.0);
|
||||
assert(heightFactor == null || heightFactor >= 0.0);
|
||||
}
|
||||
}) : assert(alignment != null),
|
||||
assert(widthFactor == null || widthFactor >= 0.0),
|
||||
assert(heightFactor == null || heightFactor >= 0.0),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// How to align the child.
|
||||
///
|
||||
@ -774,7 +763,7 @@ class Align extends SingleChildRenderObjectWidget {
|
||||
/// rather than just centering it.
|
||||
class Center extends Align {
|
||||
/// Creates a widget that centers its child.
|
||||
Center({ Key key, double widthFactor, double heightFactor, Widget child })
|
||||
const Center({ Key key, double widthFactor, double heightFactor, Widget child })
|
||||
: super(key: key, widthFactor: widthFactor, heightFactor: heightFactor, child: child);
|
||||
}
|
||||
|
||||
@ -798,13 +787,12 @@ class CustomSingleChildLayout extends SingleChildRenderObjectWidget {
|
||||
/// Creates a custom single child layout.
|
||||
///
|
||||
/// The [delegate] argument must not be null.
|
||||
CustomSingleChildLayout({
|
||||
const CustomSingleChildLayout({
|
||||
Key key,
|
||||
@required this.delegate,
|
||||
Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(delegate != null);
|
||||
}
|
||||
}) : assert(delegate != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// The delegate that controls the layout of the child.
|
||||
final SingleChildLayoutDelegate delegate;
|
||||
@ -830,10 +818,9 @@ class LayoutId extends ParentDataWidget<CustomMultiChildLayout> {
|
||||
Key key,
|
||||
@required this.id,
|
||||
@required Widget child
|
||||
}) : super(key: key ?? new ValueKey<Object>(id), child: child) {
|
||||
assert(child != null);
|
||||
assert(id != null);
|
||||
}
|
||||
}) : assert(child != null),
|
||||
assert(id != null),
|
||||
super(key: key ?? new ValueKey<Object>(id), child: child);
|
||||
|
||||
/// An object representing the identity of this child.
|
||||
final Object id;
|
||||
@ -890,9 +877,8 @@ class CustomMultiChildLayout extends MultiChildRenderObjectWidget {
|
||||
Key key,
|
||||
@required this.delegate,
|
||||
List<Widget> children: const <Widget>[],
|
||||
}) : super(key: key, children: children) {
|
||||
assert(delegate != null);
|
||||
}
|
||||
}) : assert(delegate != null),
|
||||
super(key: key, children: children);
|
||||
|
||||
/// The delegate that controls the layout of the children.
|
||||
final MultiChildLayoutDelegate delegate;
|
||||
@ -992,8 +978,8 @@ class ConstrainedBox extends SingleChildRenderObjectWidget {
|
||||
Key key,
|
||||
@required this.constraints,
|
||||
Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(constraints != null);
|
||||
}) : assert(constraints != null),
|
||||
super(key: key, child: child) {
|
||||
assert(constraints.debugAssertIsValid());
|
||||
}
|
||||
|
||||
@ -1028,17 +1014,16 @@ class FractionallySizedBox extends SingleChildRenderObjectWidget {
|
||||
///
|
||||
/// If non-null, the [widthFactor] and [heightFactor] arguments must be
|
||||
/// non-negative.
|
||||
FractionallySizedBox({
|
||||
const FractionallySizedBox({
|
||||
Key key,
|
||||
this.alignment: FractionalOffset.center,
|
||||
this.widthFactor,
|
||||
this.heightFactor,
|
||||
Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(alignment != null && alignment.dx != null && alignment.dy != null);
|
||||
assert(widthFactor == null || widthFactor >= 0.0);
|
||||
assert(heightFactor == null || heightFactor >= 0.0);
|
||||
}
|
||||
}) : assert(alignment != null),
|
||||
assert(widthFactor == null || widthFactor >= 0.0),
|
||||
assert(heightFactor == null || heightFactor >= 0.0),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// If non-null, the fraction of the incoming width given to the child.
|
||||
///
|
||||
@ -1105,15 +1090,14 @@ class LimitedBox extends SingleChildRenderObjectWidget {
|
||||
///
|
||||
/// The [maxWidth] and [maxHeight] arguments must not be null and must not be
|
||||
/// negative.
|
||||
LimitedBox({
|
||||
const LimitedBox({
|
||||
Key key,
|
||||
this.maxWidth: double.INFINITY,
|
||||
this.maxHeight: double.INFINITY,
|
||||
Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(maxWidth != null && maxWidth >= 0.0);
|
||||
assert(maxHeight != null && maxHeight >= 0.0);
|
||||
}
|
||||
}) : assert(maxWidth != null && maxWidth >= 0.0),
|
||||
assert(maxHeight != null && maxHeight >= 0.0),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// The maximum width limit to apply in the absence of a maxWidth constraint.
|
||||
final double maxWidth;
|
||||
@ -1150,7 +1134,7 @@ class LimitedBox extends SingleChildRenderObjectWidget {
|
||||
/// See [RenderOverflowBox] for details.
|
||||
class OverflowBox extends SingleChildRenderObjectWidget {
|
||||
/// Creates a widget that lets its child overflow itself.
|
||||
OverflowBox({
|
||||
const OverflowBox({
|
||||
Key key,
|
||||
this.alignment: FractionalOffset.center,
|
||||
this.minWidth,
|
||||
@ -1227,15 +1211,14 @@ class SizedOverflowBox extends SingleChildRenderObjectWidget {
|
||||
/// Creates a widget of a given size that lets its child overflow.
|
||||
///
|
||||
/// The [size] argument must not be null.
|
||||
SizedOverflowBox({
|
||||
const SizedOverflowBox({
|
||||
Key key,
|
||||
@required this.size,
|
||||
this.alignment: FractionalOffset.center,
|
||||
Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(size != null);
|
||||
assert(alignment != null && alignment.dx != null && alignment.dy != null);
|
||||
}
|
||||
}) : assert(size != null),
|
||||
assert(alignment != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// How to align the child.
|
||||
///
|
||||
@ -1280,10 +1263,9 @@ class SizedOverflowBox extends SingleChildRenderObjectWidget {
|
||||
/// room in the parent.
|
||||
class Offstage extends SingleChildRenderObjectWidget {
|
||||
/// Creates a widget that visually hides its child.
|
||||
Offstage({ Key key, this.offstage: true, Widget child })
|
||||
: super(key: key, child: child) {
|
||||
assert(offstage != null);
|
||||
}
|
||||
const Offstage({ Key key, this.offstage: true, Widget child })
|
||||
: assert(offstage != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// Whether the child is hidden from the rest of the tree.
|
||||
///
|
||||
@ -1355,13 +1337,12 @@ class AspectRatio extends SingleChildRenderObjectWidget {
|
||||
/// Creates a widget with a specific aspect ratio.
|
||||
///
|
||||
/// The [aspectRatio] argument must not be null.
|
||||
AspectRatio({
|
||||
const AspectRatio({
|
||||
Key key,
|
||||
@required this.aspectRatio,
|
||||
Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(aspectRatio != null);
|
||||
}
|
||||
}) : assert(aspectRatio != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// The aspect ratio to attempt to use.
|
||||
///
|
||||
@ -1400,7 +1381,7 @@ class IntrinsicWidth extends SingleChildRenderObjectWidget {
|
||||
/// Creates a widget that sizes its child to the child's intrinsic width.
|
||||
///
|
||||
/// This class is relatively expensive. Avoid using it where possible.
|
||||
IntrinsicWidth({ Key key, this.stepWidth, this.stepHeight, Widget child })
|
||||
const IntrinsicWidth({ Key key, this.stepWidth, this.stepHeight, Widget child })
|
||||
: super(key: key, child: child);
|
||||
|
||||
/// If non-null, force the child's width to be a multiple of this value.
|
||||
@ -1431,7 +1412,7 @@ class IntrinsicHeight extends SingleChildRenderObjectWidget {
|
||||
/// Creates a widget that sizes its child to the child's intrinsic height.
|
||||
///
|
||||
/// This class is relatively expensive. Avoid using it where possible.
|
||||
IntrinsicHeight({ Key key, Widget child }) : super(key: key, child: child);
|
||||
const IntrinsicHeight({ Key key, Widget child }) : super(key: key, child: child);
|
||||
|
||||
@override
|
||||
RenderIntrinsicHeight createRenderObject(BuildContext context) => new RenderIntrinsicHeight();
|
||||
@ -1449,15 +1430,14 @@ class Baseline extends SingleChildRenderObjectWidget {
|
||||
/// Creates a widget that positions its child according to the child's baseline.
|
||||
///
|
||||
/// The [baseline] and [baselineType] arguments must not be null.
|
||||
Baseline({
|
||||
const Baseline({
|
||||
Key key,
|
||||
@required this.baseline,
|
||||
@required this.baselineType,
|
||||
Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(baseline != null);
|
||||
assert(baselineType != null);
|
||||
}
|
||||
}) : assert(baseline != null),
|
||||
assert(baselineType != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// The number of logical pixels from the top of this box at which to position
|
||||
/// the child's baseline.
|
||||
@ -1502,7 +1482,7 @@ class Baseline extends SingleChildRenderObjectWidget {
|
||||
/// * [SliverGrid], which displays multiple box widgets in arbitrary positions.
|
||||
class SliverToBoxAdapter extends SingleChildRenderObjectWidget {
|
||||
/// Creates a sliver that contains a single box widget.
|
||||
SliverToBoxAdapter({
|
||||
const SliverToBoxAdapter({
|
||||
Key key,
|
||||
Widget child,
|
||||
}) : super(key: key, child: child);
|
||||
@ -1531,13 +1511,12 @@ class SliverPadding extends SingleChildRenderObjectWidget {
|
||||
/// Creates a sliver that applies padding on each side of another sliver.
|
||||
///
|
||||
/// The [padding] argument must not be null.
|
||||
SliverPadding({
|
||||
const SliverPadding({
|
||||
Key key,
|
||||
@required this.padding,
|
||||
Widget sliver,
|
||||
}) : super(key: key, child: sliver) {
|
||||
assert(padding != null);
|
||||
}
|
||||
}) : assert(padding != null),
|
||||
super(key: key, child: sliver);
|
||||
|
||||
/// The amount of space by which to inset the child sliver.
|
||||
final EdgeInsets padding;
|
||||
@ -1576,9 +1555,8 @@ class BlockBody extends MultiChildRenderObjectWidget {
|
||||
Key key,
|
||||
this.mainAxis: Axis.vertical,
|
||||
List<Widget> children: const <Widget>[],
|
||||
}) : super(key: key, children: children) {
|
||||
assert(mainAxis != null);
|
||||
}
|
||||
}) : assert(mainAxis != null),
|
||||
super(key: key, children: children);
|
||||
|
||||
/// The direction to use as the main axis.
|
||||
final Axis mainAxis;
|
||||
@ -1730,7 +1708,7 @@ class Positioned extends ParentDataWidget<Stack> {
|
||||
/// [width]), and only two out of the three vertical values ([top],
|
||||
/// [bottom], [height]), can be set. In each case, at least one of
|
||||
/// the three must be null.
|
||||
Positioned({
|
||||
const Positioned({
|
||||
Key key,
|
||||
this.left,
|
||||
this.top,
|
||||
@ -1739,10 +1717,9 @@ class Positioned extends ParentDataWidget<Stack> {
|
||||
this.width,
|
||||
this.height,
|
||||
@required Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
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, child: child);
|
||||
|
||||
/// Creates a Positioned object with the values from the given [Rect].
|
||||
///
|
||||
@ -1956,12 +1933,12 @@ class Flex extends MultiChildRenderObjectWidget {
|
||||
this.crossAxisAlignment: CrossAxisAlignment.center,
|
||||
this.textBaseline,
|
||||
List<Widget> children: const <Widget>[],
|
||||
}) : super(key: key, children: children) {
|
||||
assert(direction != null);
|
||||
assert(mainAxisAlignment != null);
|
||||
assert(mainAxisSize != null);
|
||||
assert(crossAxisAlignment != null);
|
||||
assert(crossAxisAlignment != CrossAxisAlignment.baseline || textBaseline != null);
|
||||
}) : assert(direction != null),
|
||||
assert(mainAxisAlignment != null),
|
||||
assert(mainAxisSize != null),
|
||||
assert(crossAxisAlignment != null),
|
||||
super(key: key, children: children) {
|
||||
assert(crossAxisAlignment != CrossAxisAlignment.baseline || textBaseline != null); // https://github.com/dart-lang/sdk/issues/29278
|
||||
}
|
||||
|
||||
/// The direction to use as the main axis.
|
||||
@ -2185,7 +2162,7 @@ class Column extends Flex {
|
||||
class Flexible extends ParentDataWidget<Flex> {
|
||||
/// Creates a widget that controls how a child of a [Row], [Column], or [Flex]
|
||||
/// flexes.
|
||||
Flexible({
|
||||
const Flexible({
|
||||
Key key,
|
||||
this.flex: 1,
|
||||
this.fit: FlexFit.loose,
|
||||
@ -2257,7 +2234,7 @@ class Flexible extends ParentDataWidget<Flex> {
|
||||
class Expanded extends Flexible {
|
||||
/// Creates a widget that expands a child of a [Row], [Column], or [Flex]
|
||||
/// expand to fill the available space in the main axis.
|
||||
Expanded({
|
||||
const Expanded({
|
||||
Key key,
|
||||
int flex: 1,
|
||||
@required Widget child,
|
||||
@ -2419,9 +2396,9 @@ class Flow extends MultiChildRenderObjectWidget {
|
||||
Key key,
|
||||
@required this.delegate,
|
||||
List<Widget> children: const <Widget>[],
|
||||
}) : super(key: key, children: RepaintBoundary.wrapAll(children)) {
|
||||
assert(delegate != null);
|
||||
}
|
||||
}) : assert(delegate != null),
|
||||
super(key: key, children: RepaintBoundary.wrapAll(children));
|
||||
// https://github.com/dart-lang/sdk/issues/29277
|
||||
|
||||
/// Creates a flow layout.
|
||||
///
|
||||
@ -2491,7 +2468,7 @@ class RichText extends LeafRenderObjectWidget {
|
||||
/// Creates a paragraph of rich text.
|
||||
///
|
||||
/// The [text], [softWrap], and [overflow] arguments must not be null.
|
||||
RichText({
|
||||
const RichText({
|
||||
Key key,
|
||||
@required this.text,
|
||||
this.textAlign,
|
||||
@ -2499,12 +2476,11 @@ class RichText extends LeafRenderObjectWidget {
|
||||
this.overflow: TextOverflow.clip,
|
||||
this.textScaleFactor: 1.0,
|
||||
this.maxLines,
|
||||
}) : super(key: key) {
|
||||
assert(text != null);
|
||||
assert(softWrap != null);
|
||||
assert(overflow != null);
|
||||
assert(textScaleFactor != null);
|
||||
}
|
||||
}) : assert(text != null),
|
||||
assert(softWrap != null),
|
||||
assert(overflow != null),
|
||||
assert(textScaleFactor != null),
|
||||
super(key: key);
|
||||
|
||||
/// The text to display in this widget.
|
||||
final TextSpan text;
|
||||
@ -2564,7 +2540,7 @@ class RawImage extends LeafRenderObjectWidget {
|
||||
/// Creates a widget that displays an image.
|
||||
///
|
||||
/// The [scale] and [repeat] arguments must not be null.
|
||||
RawImage({
|
||||
const RawImage({
|
||||
Key key,
|
||||
this.image,
|
||||
this.width,
|
||||
@ -2575,10 +2551,9 @@ class RawImage extends LeafRenderObjectWidget {
|
||||
this.alignment,
|
||||
this.repeat: ImageRepeat.noRepeat,
|
||||
this.centerSlice
|
||||
}) : super(key: key) {
|
||||
assert(scale != null);
|
||||
assert(repeat != null);
|
||||
}
|
||||
}) : assert(scale != null),
|
||||
assert(repeat != null),
|
||||
super(key: key);
|
||||
|
||||
/// The image to display.
|
||||
final ui.Image image;
|
||||
@ -2686,14 +2661,13 @@ class DefaultAssetBundle extends InheritedWidget {
|
||||
/// Creates a widget that determines the default asset bundle for its descendants.
|
||||
///
|
||||
/// The [bundle] and [child] arguments must not be null.
|
||||
DefaultAssetBundle({
|
||||
const DefaultAssetBundle({
|
||||
Key key,
|
||||
@required this.bundle,
|
||||
@required Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(bundle != null);
|
||||
assert(child != null);
|
||||
}
|
||||
}) : assert(bundle != null),
|
||||
assert(child != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// The bundle to use as a default.
|
||||
final AssetBundle bundle;
|
||||
@ -2729,15 +2703,13 @@ class WidgetToRenderBoxAdapter extends LeafRenderObjectWidget {
|
||||
/// The [renderBox] argument must not be null.
|
||||
WidgetToRenderBoxAdapter({
|
||||
@required this.renderBox,
|
||||
this.onBuild
|
||||
}) :
|
||||
this.onBuild,
|
||||
}) : assert(renderBox != null),
|
||||
// WidgetToRenderBoxAdapter objects are keyed to their render box. This
|
||||
// prevents the widget being used in the widget hierarchy in two different
|
||||
// places, which would cause the RenderBox to get inserted in multiple
|
||||
// places in the RenderObject tree.
|
||||
super(key: new GlobalObjectKey(renderBox)) {
|
||||
assert(renderBox != null);
|
||||
}
|
||||
super(key: new GlobalObjectKey(renderBox));
|
||||
|
||||
/// The render box to place in the widget tree.
|
||||
final RenderBox renderBox;
|
||||
@ -2772,7 +2744,7 @@ class Listener extends SingleChildRenderObjectWidget {
|
||||
/// Creates a widget that forwards point events to callbacks.
|
||||
///
|
||||
/// The [behavior] argument defaults to [HitTestBehavior.deferToChild].
|
||||
Listener({
|
||||
const Listener({
|
||||
Key key,
|
||||
this.onPointerDown,
|
||||
this.onPointerMove,
|
||||
@ -2780,9 +2752,8 @@ class Listener extends SingleChildRenderObjectWidget {
|
||||
this.onPointerCancel,
|
||||
this.behavior: HitTestBehavior.deferToChild,
|
||||
Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(behavior != null);
|
||||
}
|
||||
}) : assert(behavior != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// Called when a pointer comes into contact with the screen at this object.
|
||||
final PointerDownEventListener onPointerDown;
|
||||
@ -2858,7 +2829,7 @@ class Listener extends SingleChildRenderObjectWidget {
|
||||
/// for the surround tree.
|
||||
class RepaintBoundary extends SingleChildRenderObjectWidget {
|
||||
/// Creates a widget that isolates repaints.
|
||||
RepaintBoundary({ Key key, Widget child }) : super(key: key, child: child);
|
||||
const RepaintBoundary({ Key key, Widget child }) : super(key: key, child: child);
|
||||
|
||||
/// Wraps the given child in a [RepaintBoundary].
|
||||
///
|
||||
@ -2906,14 +2877,13 @@ class IgnorePointer extends SingleChildRenderObjectWidget {
|
||||
///
|
||||
/// The [ignoring] argument must not be null. If [ignoringSemantics], this
|
||||
/// render object will be ignored for semantics if [ignoring] is true.
|
||||
IgnorePointer({
|
||||
const IgnorePointer({
|
||||
Key key,
|
||||
this.ignoring: true,
|
||||
this.ignoringSemantics,
|
||||
Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(ignoring != null);
|
||||
}
|
||||
}) : assert(ignoring != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// Whether this widget is ignored during hit testing.
|
||||
///
|
||||
@ -2966,13 +2936,12 @@ class AbsorbPointer extends SingleChildRenderObjectWidget {
|
||||
/// Creates a widget that absorbs pointers during hit testing.
|
||||
///
|
||||
/// The [absorbing] argument must not be null
|
||||
AbsorbPointer({
|
||||
const AbsorbPointer({
|
||||
Key key,
|
||||
this.absorbing: true,
|
||||
Widget child
|
||||
}) : super(key: key, child: child) {
|
||||
assert(absorbing != null);
|
||||
}
|
||||
}) : assert(absorbing != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// Whether this widget absorbs pointers during hit testing.
|
||||
///
|
||||
@ -3000,7 +2969,7 @@ class MetaData extends SingleChildRenderObjectWidget {
|
||||
/// Creates a widget that hold opaque meta data.
|
||||
///
|
||||
/// The [behavior] argument defaults to [HitTestBehavior.deferToChild].
|
||||
MetaData({
|
||||
const MetaData({
|
||||
Key key,
|
||||
this.metaData,
|
||||
this.behavior: HitTestBehavior.deferToChild,
|
||||
@ -3061,15 +3030,14 @@ class Semantics extends SingleChildRenderObjectWidget {
|
||||
/// Creates a semantic annotation.
|
||||
///
|
||||
/// The [container] argument must not be null.
|
||||
Semantics({
|
||||
const Semantics({
|
||||
Key key,
|
||||
Widget child,
|
||||
this.container: false,
|
||||
this.checked,
|
||||
this.label
|
||||
}) : super(key: key, child: child) {
|
||||
assert(container != null);
|
||||
}
|
||||
}) : assert(container != null),
|
||||
super(key: key, child: child);
|
||||
|
||||
/// If 'container' is true, this Widget will introduce a new node in
|
||||
/// the semantics tree. Otherwise, the semantics will be merged with
|
||||
@ -3138,7 +3106,7 @@ class Semantics extends SingleChildRenderObjectWidget {
|
||||
/// callbacks.
|
||||
class MergeSemantics extends SingleChildRenderObjectWidget {
|
||||
/// Creates a widget that merges the semantics of its descendants.
|
||||
MergeSemantics({ Key key, Widget child }) : super(key: key, child: child);
|
||||
const MergeSemantics({ Key key, Widget child }) : super(key: key, child: child);
|
||||
|
||||
@override
|
||||
RenderMergeSemantics createRenderObject(BuildContext context) => new RenderMergeSemantics();
|
||||
@ -3152,7 +3120,7 @@ class MergeSemantics extends SingleChildRenderObjectWidget {
|
||||
/// redundant with the chip label.
|
||||
class ExcludeSemantics extends SingleChildRenderObjectWidget {
|
||||
/// Creates a widget that drops all the semantics of its descendants.
|
||||
ExcludeSemantics({ Key key, Widget child }) : super(key: key, child: child);
|
||||
const ExcludeSemantics({ Key key, Widget child }) : super(key: key, child: child);
|
||||
|
||||
@override
|
||||
RenderExcludeSemantics createRenderObject(BuildContext context) => new RenderExcludeSemantics();
|
||||
@ -3163,12 +3131,11 @@ class ExcludeSemantics extends SingleChildRenderObjectWidget {
|
||||
/// Useful for attaching a key to an existing widget.
|
||||
class KeyedSubtree extends StatelessWidget {
|
||||
/// Creates a widget that builds its child.
|
||||
KeyedSubtree({
|
||||
const KeyedSubtree({
|
||||
Key key,
|
||||
@required this.child
|
||||
}) : super(key: key) {
|
||||
assert(child != null);
|
||||
}
|
||||
}) : assert(child != null),
|
||||
super(key: key);
|
||||
|
||||
/// The widget below this widget in the tree.
|
||||
final Widget child;
|
||||
@ -3209,12 +3176,11 @@ class Builder extends StatelessWidget {
|
||||
/// Creates a widget that delegates its build to a callback.
|
||||
///
|
||||
/// The [builder] argument must not be null.
|
||||
Builder({
|
||||
const Builder({
|
||||
Key key,
|
||||
@required this.builder
|
||||
}) : super(key: key) {
|
||||
assert(builder != null);
|
||||
}
|
||||
}) : assert(builder != null),
|
||||
super(key: key);
|
||||
|
||||
/// Called to obtain the child widget.
|
||||
///
|
||||
@ -3243,12 +3209,11 @@ class StatefulBuilder extends StatefulWidget {
|
||||
/// Creates a widget that both has state and delegates its build to a callback.
|
||||
///
|
||||
/// The [builder] argument must not be null.
|
||||
StatefulBuilder({
|
||||
const StatefulBuilder({
|
||||
Key key,
|
||||
@required this.builder
|
||||
}) : super(key: key) {
|
||||
assert(builder != null);
|
||||
}
|
||||
}) : assert(builder != null),
|
||||
super(key: key);
|
||||
|
||||
/// Called to obtain the child widget.
|
||||
///
|
||||
|
@ -1339,9 +1339,9 @@ abstract class MultiChildRenderObjectWidget extends RenderObjectWidget {
|
||||
/// The [children] argument must not be null and must not contain any null
|
||||
/// objects.
|
||||
MultiChildRenderObjectWidget({ Key key, this.children: const <Widget>[] })
|
||||
: super(key: key) {
|
||||
assert(children != null);
|
||||
assert(!children.any((Widget child) => child == null));
|
||||
: assert(children != null),
|
||||
super(key: key) {
|
||||
assert(!children.any((Widget child) => child == null)); // https://github.com/dart-lang/sdk/issues/29276
|
||||
}
|
||||
|
||||
/// The widgets below this widget in the tree.
|
||||
|
Loading…
x
Reference in New Issue
Block a user