mirror of
https://github.com/flutter/flutter
synced 2024-10-13 19:52:53 +00:00
apply upcoming lint cast_nullable_to_non_nullable (#66455)
* apply upcoming lint cast_nullable_to_non_nullable * make RenderObjectElement.renderObject non-nullable
This commit is contained in:
parent
ec40df9576
commit
c2e43403af
|
@ -2507,7 +2507,7 @@ class FlagsSummary<T> extends DiagnosticsProperty<Map<String, T>> {
|
|||
);
|
||||
|
||||
@override
|
||||
Map<String, T> get value => super.value as Map<String, T>;
|
||||
Map<String, T> get value => super.value!;
|
||||
|
||||
@override
|
||||
String valueToString({TextTreeConfiguration? parentConfiguration}) {
|
||||
|
|
|
@ -251,7 +251,7 @@ class BoxDecoration extends Decoration {
|
|||
return scale(t);
|
||||
if (a is BoxDecoration)
|
||||
return BoxDecoration.lerp(a, this, t);
|
||||
return super.lerpFrom(a, t) as BoxDecoration;
|
||||
return super.lerpFrom(a, t) as BoxDecoration?;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -260,7 +260,7 @@ class BoxDecoration extends Decoration {
|
|||
return scale(1.0 - t);
|
||||
if (b is BoxDecoration)
|
||||
return BoxDecoration.lerp(this, b, t);
|
||||
return super.lerpTo(b, t) as BoxDecoration;
|
||||
return super.lerpTo(b, t) as BoxDecoration?;
|
||||
}
|
||||
|
||||
/// Linearly interpolate between two box decorations.
|
||||
|
@ -486,7 +486,7 @@ class _BoxDecorationPainter extends BoxPainter {
|
|||
canvas,
|
||||
rect,
|
||||
shape: _decoration.shape,
|
||||
borderRadius: _decoration.borderRadius as BorderRadius,
|
||||
borderRadius: _decoration.borderRadius as BorderRadius?,
|
||||
textDirection: configuration.textDirection,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ class FlutterLogoDecoration extends Decoration {
|
|||
assert(debugAssertIsValid());
|
||||
if (a == null || a is FlutterLogoDecoration) {
|
||||
assert(a == null || a.debugAssertIsValid());
|
||||
return FlutterLogoDecoration.lerp(a as FlutterLogoDecoration, this, t);
|
||||
return FlutterLogoDecoration.lerp(a as FlutterLogoDecoration?, this, t);
|
||||
}
|
||||
return super.lerpFrom(a, t) as FlutterLogoDecoration?;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ class FlutterLogoDecoration extends Decoration {
|
|||
assert(debugAssertIsValid());
|
||||
if (b == null || b is FlutterLogoDecoration) {
|
||||
assert(b == null || b.debugAssertIsValid());
|
||||
return FlutterLogoDecoration.lerp(this, b as FlutterLogoDecoration, t);
|
||||
return FlutterLogoDecoration.lerp(this, b as FlutterLogoDecoration?, t);
|
||||
}
|
||||
return super.lerpTo(b, t) as FlutterLogoDecoration?;
|
||||
}
|
||||
|
|
|
@ -442,14 +442,14 @@ class LinearGradient extends Gradient {
|
|||
@override
|
||||
Gradient? lerpFrom(Gradient? a, double t) {
|
||||
if (a == null || (a is LinearGradient))
|
||||
return LinearGradient.lerp(a as LinearGradient, this, t);
|
||||
return LinearGradient.lerp(a as LinearGradient?, this, t);
|
||||
return super.lerpFrom(a, t);
|
||||
}
|
||||
|
||||
@override
|
||||
Gradient? lerpTo(Gradient? b, double t) {
|
||||
if (b == null || (b is LinearGradient))
|
||||
return LinearGradient.lerp(this, b as LinearGradient, t);
|
||||
return LinearGradient.lerp(this, b as LinearGradient?, t);
|
||||
return super.lerpTo(b, t);
|
||||
}
|
||||
|
||||
|
@ -700,14 +700,14 @@ class RadialGradient extends Gradient {
|
|||
@override
|
||||
Gradient? lerpFrom(Gradient? a, double t) {
|
||||
if (a == null || (a is RadialGradient))
|
||||
return RadialGradient.lerp(a as RadialGradient, this, t);
|
||||
return RadialGradient.lerp(a as RadialGradient?, this, t);
|
||||
return super.lerpFrom(a, t);
|
||||
}
|
||||
|
||||
@override
|
||||
Gradient? lerpTo(Gradient? b, double t) {
|
||||
if (b == null || (b is RadialGradient))
|
||||
return RadialGradient.lerp(this, b as RadialGradient, t);
|
||||
return RadialGradient.lerp(this, b as RadialGradient?, t);
|
||||
return super.lerpTo(b, t);
|
||||
}
|
||||
|
||||
|
@ -948,14 +948,14 @@ class SweepGradient extends Gradient {
|
|||
@override
|
||||
Gradient? lerpFrom(Gradient? a, double t) {
|
||||
if (a == null || (a is SweepGradient))
|
||||
return SweepGradient.lerp(a as SweepGradient, this, t);
|
||||
return SweepGradient.lerp(a as SweepGradient?, this, t);
|
||||
return super.lerpFrom(a, t);
|
||||
}
|
||||
|
||||
@override
|
||||
Gradient? lerpTo(Gradient? b, double t) {
|
||||
if (b == null || (b is SweepGradient))
|
||||
return SweepGradient.lerp(this, b as SweepGradient, t);
|
||||
return SweepGradient.lerp(this, b as SweepGradient?, t);
|
||||
return super.lerpTo(b, t);
|
||||
}
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ class ShapeDecoration extends Decoration {
|
|||
if (a is BoxDecoration) {
|
||||
return ShapeDecoration.lerp(ShapeDecoration.fromBoxDecoration(a), this, t);
|
||||
} else if (a == null || a is ShapeDecoration) {
|
||||
return ShapeDecoration.lerp(a as ShapeDecoration, this, t);
|
||||
return ShapeDecoration.lerp(a as ShapeDecoration?, this, t);
|
||||
}
|
||||
return super.lerpFrom(a, t) as ShapeDecoration?;
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ class ShapeDecoration extends Decoration {
|
|||
if (b is BoxDecoration) {
|
||||
return ShapeDecoration.lerp(this, ShapeDecoration.fromBoxDecoration(b), t);
|
||||
} else if (b == null || b is ShapeDecoration) {
|
||||
return ShapeDecoration.lerp(this, b as ShapeDecoration, t);
|
||||
return ShapeDecoration.lerp(this, b as ShapeDecoration?, t);
|
||||
}
|
||||
return super.lerpTo(b, t) as ShapeDecoration?;
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
|
|||
late PipelineOwner _pipelineOwner;
|
||||
|
||||
/// The render tree that's attached to the output surface.
|
||||
RenderView get renderView => _pipelineOwner.rootNode as RenderView;
|
||||
RenderView get renderView => _pipelineOwner.rootNode! as RenderView;
|
||||
/// Sets the given [RenderView] object (which must not be null), and its tree, to
|
||||
/// be the new render tree to display. The previous tree, if any, is detached.
|
||||
set renderView(RenderView value) {
|
||||
|
|
|
@ -2046,14 +2046,14 @@ abstract class RenderBox extends RenderObject {
|
|||
if (!constraints.hasBoundedWidth) {
|
||||
RenderBox node = this;
|
||||
while (!node.constraints.hasBoundedWidth && node.parent is RenderBox)
|
||||
node = node.parent as RenderBox;
|
||||
node = node.parent! as RenderBox;
|
||||
|
||||
information.add(node.describeForError('The nearest ancestor providing an unbounded width constraint is'));
|
||||
}
|
||||
if (!constraints.hasBoundedHeight) {
|
||||
RenderBox node = this;
|
||||
while (!node.constraints.hasBoundedHeight && node.parent is RenderBox)
|
||||
node = node.parent as RenderBox;
|
||||
node = node.parent! as RenderBox;
|
||||
|
||||
information.add(node.describeForError('The nearest ancestor providing an unbounded height constraint is'));
|
||||
}
|
||||
|
@ -2314,7 +2314,7 @@ abstract class RenderBox extends RenderObject {
|
|||
}
|
||||
return true;
|
||||
}());
|
||||
final BoxParentData childParentData = child.parentData as BoxParentData;
|
||||
final BoxParentData childParentData = child.parentData! as BoxParentData;
|
||||
final Offset offset = childParentData.offset;
|
||||
transform.translate(offset.dx, offset.dy);
|
||||
}
|
||||
|
@ -2560,7 +2560,7 @@ mixin RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, ParentDataTyp
|
|||
double? result;
|
||||
ChildType? child = firstChild;
|
||||
while (child != null) {
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
final ParentDataType childParentData = child.parentData! as ParentDataType;
|
||||
double? candidate = child.getDistanceToActualBaseline(baseline);
|
||||
if (candidate != null) {
|
||||
candidate += childParentData.offset.dy;
|
||||
|
@ -2587,7 +2587,7 @@ mixin RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, ParentDataTyp
|
|||
// The x, y parameters have the top left of the node's box as the origin.
|
||||
ChildType? child = lastChild;
|
||||
while (child != null) {
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
final ParentDataType childParentData = child.parentData! as ParentDataType;
|
||||
final bool isHit = result.addWithPaintOffset(
|
||||
offset: childParentData.offset,
|
||||
position: position,
|
||||
|
@ -2612,7 +2612,7 @@ mixin RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, ParentDataTyp
|
|||
void defaultPaint(PaintingContext context, Offset offset) {
|
||||
ChildType? child = firstChild;
|
||||
while (child != null) {
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
final ParentDataType childParentData = child.parentData! as ParentDataType;
|
||||
context.paintChild(child, childParentData.offset + offset);
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
|
@ -2627,7 +2627,7 @@ mixin RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, ParentDataTyp
|
|||
final List<ChildType> result = <ChildType>[];
|
||||
RenderBox? child = firstChild;
|
||||
while (child != null) {
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
final ParentDataType childParentData = child.parentData! as ParentDataType;
|
||||
result.add(child as ChildType);
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
|
|
|
@ -197,12 +197,12 @@ abstract class MultiChildLayoutDelegate {
|
|||
}
|
||||
return true;
|
||||
}());
|
||||
final MultiChildLayoutParentData childParentData = child!.parentData as MultiChildLayoutParentData;
|
||||
final MultiChildLayoutParentData childParentData = child!.parentData! as MultiChildLayoutParentData;
|
||||
childParentData.offset = offset;
|
||||
}
|
||||
|
||||
DiagnosticsNode _debugDescribeChild(RenderBox child) {
|
||||
final MultiChildLayoutParentData childParentData = child.parentData as MultiChildLayoutParentData;
|
||||
final MultiChildLayoutParentData childParentData = child.parentData! as MultiChildLayoutParentData;
|
||||
return DiagnosticsProperty<RenderBox>('${childParentData.id}', child);
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ abstract class MultiChildLayoutDelegate {
|
|||
_idToChild = <Object, RenderBox>{};
|
||||
RenderBox? child = firstChild;
|
||||
while (child != null) {
|
||||
final MultiChildLayoutParentData childParentData = child.parentData as MultiChildLayoutParentData;
|
||||
final MultiChildLayoutParentData childParentData = child.parentData! as MultiChildLayoutParentData;
|
||||
assert(() {
|
||||
if (childParentData.id == null) {
|
||||
throw FlutterError.fromParts(<DiagnosticsNode>[
|
||||
|
|
|
@ -246,7 +246,7 @@ mixin DebugOverflowIndicatorMixin on RenderObject {
|
|||
context: ErrorDescription('during layout'),
|
||||
informationCollector: () sync* {
|
||||
if (debugCreator != null)
|
||||
yield DiagnosticsDebugCreator(debugCreator as Object);
|
||||
yield DiagnosticsDebugCreator(debugCreator!);
|
||||
yield* overflowHints!;
|
||||
yield describeForError('The specific $runtimeType in question is');
|
||||
// TODO(jacobr): this line is ascii art that it would be nice to
|
||||
|
|
|
@ -528,7 +528,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
|||
} else {
|
||||
inflexibleSpace += childSize(child, extent);
|
||||
}
|
||||
final FlexParentData childParentData = child.parentData as FlexParentData;
|
||||
final FlexParentData childParentData = child.parentData! as FlexParentData;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
return maxFlexFractionSoFar * totalFlex + inflexibleSpace;
|
||||
|
@ -563,7 +563,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
|||
inflexibleSpace += mainSize;
|
||||
maxCrossSize = math.max(maxCrossSize, crossSize);
|
||||
}
|
||||
final FlexParentData childParentData = child.parentData as FlexParentData;
|
||||
final FlexParentData childParentData = child.parentData! as FlexParentData;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
|
||||
|
@ -578,7 +578,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
|||
final int flex = _getFlex(child);
|
||||
if (flex > 0)
|
||||
maxCrossSize = math.max(maxCrossSize, childSize(child, spacePerFlex * flex));
|
||||
final FlexParentData childParentData = child.parentData as FlexParentData;
|
||||
final FlexParentData childParentData = child.parentData! as FlexParentData;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
|
||||
|
@ -630,12 +630,12 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
|||
}
|
||||
|
||||
int _getFlex(RenderBox child) {
|
||||
final FlexParentData childParentData = child.parentData as FlexParentData;
|
||||
final FlexParentData childParentData = child.parentData! as FlexParentData;
|
||||
return childParentData.flex ?? 0;
|
||||
}
|
||||
|
||||
FlexFit _getFit(RenderBox child) {
|
||||
final FlexParentData childParentData = child.parentData as FlexParentData;
|
||||
final FlexParentData childParentData = child.parentData! as FlexParentData;
|
||||
return childParentData.fit ?? FlexFit.tight;
|
||||
}
|
||||
|
||||
|
@ -674,7 +674,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
|||
RenderBox? child = firstChild;
|
||||
RenderBox? lastFlexChild;
|
||||
while (child != null) {
|
||||
final FlexParentData childParentData = child.parentData as FlexParentData;
|
||||
final FlexParentData childParentData = child.parentData! as FlexParentData;
|
||||
totalChildren++;
|
||||
final int flex = _getFlex(child);
|
||||
if (flex > 0) {
|
||||
|
@ -696,13 +696,13 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
|||
switch (_direction) {
|
||||
case Axis.horizontal:
|
||||
while (!node!.constraints.hasBoundedWidth && node.parent is RenderBox)
|
||||
node = node.parent as RenderBox;
|
||||
node = node.parent! as RenderBox;
|
||||
if (!node.constraints.hasBoundedWidth)
|
||||
node = null;
|
||||
break;
|
||||
case Axis.vertical:
|
||||
while (!node!.constraints.hasBoundedHeight && node.parent is RenderBox)
|
||||
node = node.parent as RenderBox;
|
||||
node = node.parent! as RenderBox;
|
||||
if (!node.constraints.hasBoundedHeight)
|
||||
node = null;
|
||||
break;
|
||||
|
@ -854,7 +854,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
|||
crossSize = math.max(maxSizeAboveBaseline + maxSizeBelowBaseline, crossSize);
|
||||
}
|
||||
}
|
||||
final FlexParentData childParentData = child.parentData as FlexParentData;
|
||||
final FlexParentData childParentData = child.parentData! as FlexParentData;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
}
|
||||
|
@ -915,7 +915,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
|||
double childMainPosition = flipMainAxis ? actualSize - leadingSpace : leadingSpace;
|
||||
child = firstChild;
|
||||
while (child != null) {
|
||||
final FlexParentData childParentData = child.parentData as FlexParentData;
|
||||
final FlexParentData childParentData = child.parentData! as FlexParentData;
|
||||
double childCrossPosition;
|
||||
switch (_crossAxisAlignment) {
|
||||
case CrossAxisAlignment.start:
|
||||
|
|
|
@ -305,7 +305,7 @@ class RenderFlow extends RenderBox
|
|||
_randomAccessChildren.add(child);
|
||||
final BoxConstraints innerConstraints = _delegate.getConstraintsForChild(i, constraints);
|
||||
child.layout(innerConstraints, parentUsesSize: true);
|
||||
final FlowParentData childParentData = child.parentData as FlowParentData;
|
||||
final FlowParentData childParentData = child.parentData! as FlowParentData;
|
||||
childParentData.offset = Offset.zero;
|
||||
child = childParentData.nextSibling;
|
||||
i += 1;
|
||||
|
@ -333,7 +333,7 @@ class RenderFlow extends RenderBox
|
|||
void paintChild(int i, { Matrix4? transform, double opacity = 1.0 }) {
|
||||
transform ??= Matrix4.identity();
|
||||
final RenderBox child = _randomAccessChildren[i];
|
||||
final FlowParentData childParentData = child.parentData as FlowParentData;
|
||||
final FlowParentData childParentData = child.parentData! as FlowParentData;
|
||||
assert(() {
|
||||
if (childParentData._transform != null) {
|
||||
throw FlutterError(
|
||||
|
@ -369,7 +369,7 @@ class RenderFlow extends RenderBox
|
|||
_paintingContext = context;
|
||||
_paintingOffset = offset;
|
||||
for (final RenderBox child in _randomAccessChildren) {
|
||||
final FlowParentData childParentData = child.parentData as FlowParentData;
|
||||
final FlowParentData childParentData = child.parentData! as FlowParentData;
|
||||
childParentData._transform = null;
|
||||
}
|
||||
try {
|
||||
|
@ -397,7 +397,7 @@ class RenderFlow extends RenderBox
|
|||
if (childIndex >= children.length)
|
||||
continue;
|
||||
final RenderBox child = children[childIndex];
|
||||
final FlowParentData childParentData = child.parentData as FlowParentData;
|
||||
final FlowParentData childParentData = child.parentData! as FlowParentData;
|
||||
final Matrix4? transform = childParentData._transform;
|
||||
if (transform == null)
|
||||
continue;
|
||||
|
@ -416,7 +416,7 @@ class RenderFlow extends RenderBox
|
|||
|
||||
@override
|
||||
void applyPaintTransform(RenderBox child, Matrix4 transform) {
|
||||
final FlowParentData childParentData = child.parentData as FlowParentData;
|
||||
final FlowParentData childParentData = child.parentData! as FlowParentData;
|
||||
if (childParentData._transform != null)
|
||||
transform.multiply(childParentData._transform!);
|
||||
super.applyPaintTransform(child, transform);
|
||||
|
|
|
@ -2350,7 +2350,7 @@ class FollowerLayer extends ContainerLayer {
|
|||
if (_lastTransform != null) {
|
||||
engineLayer = builder.pushTransform(
|
||||
_lastTransform!.storage,
|
||||
oldLayer: _engineLayer as ui.TransformEngineLayer,
|
||||
oldLayer: _engineLayer as ui.TransformEngineLayer?,
|
||||
);
|
||||
addChildrenToScene(builder);
|
||||
builder.pop();
|
||||
|
@ -2360,7 +2360,7 @@ class FollowerLayer extends ContainerLayer {
|
|||
final Matrix4 matrix = Matrix4.translationValues(unlinkedOffset!.dx, unlinkedOffset!.dy, .0);
|
||||
engineLayer = builder.pushTransform(
|
||||
matrix.storage,
|
||||
oldLayer: _engineLayer as ui.TransformEngineLayer,
|
||||
oldLayer: _engineLayer as ui.TransformEngineLayer?,
|
||||
);
|
||||
addChildrenToScene(builder);
|
||||
builder.pop();
|
||||
|
|
|
@ -127,7 +127,7 @@ class RenderListBody extends RenderBox
|
|||
final BoxConstraints innerConstraints = BoxConstraints.tightFor(height: constraints.maxHeight);
|
||||
while (child != null) {
|
||||
child.layout(innerConstraints, parentUsesSize: true);
|
||||
final ListBodyParentData childParentData = child.parentData as ListBodyParentData;
|
||||
final ListBodyParentData childParentData = child.parentData! as ListBodyParentData;
|
||||
childParentData.offset = Offset(mainAxisExtent, 0.0);
|
||||
mainAxisExtent += child.size.width;
|
||||
assert(child.parentData == childParentData);
|
||||
|
@ -139,7 +139,7 @@ class RenderListBody extends RenderBox
|
|||
final BoxConstraints innerConstraints = BoxConstraints.tightFor(height: constraints.maxHeight);
|
||||
while (child != null) {
|
||||
child.layout(innerConstraints, parentUsesSize: true);
|
||||
final ListBodyParentData childParentData = child.parentData as ListBodyParentData;
|
||||
final ListBodyParentData childParentData = child.parentData! as ListBodyParentData;
|
||||
mainAxisExtent += child.size.width;
|
||||
assert(child.parentData == childParentData);
|
||||
child = childParentData.nextSibling;
|
||||
|
@ -147,7 +147,7 @@ class RenderListBody extends RenderBox
|
|||
double position = 0.0;
|
||||
child = firstChild;
|
||||
while (child != null) {
|
||||
final ListBodyParentData childParentData = child.parentData as ListBodyParentData;
|
||||
final ListBodyParentData childParentData = child.parentData! as ListBodyParentData;
|
||||
position += child.size.width;
|
||||
childParentData.offset = Offset(mainAxisExtent - position, 0.0);
|
||||
assert(child.parentData == childParentData);
|
||||
|
@ -159,7 +159,7 @@ class RenderListBody extends RenderBox
|
|||
final BoxConstraints innerConstraints = BoxConstraints.tightFor(width: constraints.maxWidth);
|
||||
while (child != null) {
|
||||
child.layout(innerConstraints, parentUsesSize: true);
|
||||
final ListBodyParentData childParentData = child.parentData as ListBodyParentData;
|
||||
final ListBodyParentData childParentData = child.parentData! as ListBodyParentData;
|
||||
childParentData.offset = Offset(0.0, mainAxisExtent);
|
||||
mainAxisExtent += child.size.height;
|
||||
assert(child.parentData == childParentData);
|
||||
|
@ -171,7 +171,7 @@ class RenderListBody extends RenderBox
|
|||
final BoxConstraints innerConstraints = BoxConstraints.tightFor(width: constraints.maxWidth);
|
||||
while (child != null) {
|
||||
child.layout(innerConstraints, parentUsesSize: true);
|
||||
final ListBodyParentData childParentData = child.parentData as ListBodyParentData;
|
||||
final ListBodyParentData childParentData = child.parentData! as ListBodyParentData;
|
||||
mainAxisExtent += child.size.height;
|
||||
assert(child.parentData == childParentData);
|
||||
child = childParentData.nextSibling;
|
||||
|
@ -179,7 +179,7 @@ class RenderListBody extends RenderBox
|
|||
double position = 0.0;
|
||||
child = firstChild;
|
||||
while (child != null) {
|
||||
final ListBodyParentData childParentData = child.parentData as ListBodyParentData;
|
||||
final ListBodyParentData childParentData = child.parentData! as ListBodyParentData;
|
||||
position += child.size.height;
|
||||
childParentData.offset = Offset(0.0, mainAxisExtent - position);
|
||||
assert(child.parentData == childParentData);
|
||||
|
@ -202,7 +202,7 @@ class RenderListBody extends RenderBox
|
|||
RenderBox? child = firstChild;
|
||||
while (child != null) {
|
||||
extent = math.max(extent, childSize(child));
|
||||
final ListBodyParentData childParentData = child.parentData as ListBodyParentData;
|
||||
final ListBodyParentData childParentData = child.parentData! as ListBodyParentData;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
return extent;
|
||||
|
@ -213,7 +213,7 @@ class RenderListBody extends RenderBox
|
|||
RenderBox? child = firstChild;
|
||||
while (child != null) {
|
||||
extent += childSize(child);
|
||||
final ListBodyParentData childParentData = child.parentData as ListBodyParentData;
|
||||
final ListBodyParentData childParentData = child.parentData! as ListBodyParentData;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
return extent;
|
||||
|
|
|
@ -617,7 +617,7 @@ class RenderListWheelViewport
|
|||
/// This relies on the [childManager] maintaining [ListWheelParentData.index].
|
||||
int indexOf(RenderBox child) {
|
||||
assert(child != null);
|
||||
final ListWheelParentData childParentData = child.parentData as ListWheelParentData;
|
||||
final ListWheelParentData childParentData = child.parentData! as ListWheelParentData;
|
||||
assert(childParentData.index != null);
|
||||
return childParentData.index!;
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ class RenderListWheelViewport
|
|||
|
||||
void _layoutChild(RenderBox child, BoxConstraints constraints, int index) {
|
||||
child.layout(constraints, parentUsesSize: true);
|
||||
final ListWheelParentData childParentData = child.parentData as ListWheelParentData;
|
||||
final ListWheelParentData childParentData = child.parentData! as ListWheelParentData;
|
||||
// Centers the child horizontally.
|
||||
final double crossPosition = size.width / 2.0 - child.size.width / 2.0;
|
||||
childParentData.offset = Offset(crossPosition, indexToScrollOffset(index));
|
||||
|
@ -989,7 +989,7 @@ class RenderListWheelViewport
|
|||
/// painting coordinates** system.
|
||||
@override
|
||||
void applyPaintTransform(RenderBox child, Matrix4 transform) {
|
||||
final ListWheelParentData parentData = child.parentData as ListWheelParentData;
|
||||
final ListWheelParentData parentData = child.parentData! as ListWheelParentData;
|
||||
transform.translate(0.0, _getUntransformedPaintingCoordinateY(parentData.offset.dy));
|
||||
}
|
||||
|
||||
|
@ -1015,9 +1015,9 @@ class RenderListWheelViewport
|
|||
// `child` will be the last RenderObject before the viewport when walking up from `target`.
|
||||
RenderObject child = target;
|
||||
while (child.parent != this)
|
||||
child = child.parent as RenderObject;
|
||||
child = child.parent! as RenderObject;
|
||||
|
||||
final ListWheelParentData parentData = child.parentData as ListWheelParentData;
|
||||
final ListWheelParentData parentData = child.parentData! as ListWheelParentData;
|
||||
final double targetOffset = parentData.offset.dy; // the so-called "centerPosition"
|
||||
|
||||
final Matrix4 transform = target.getTransformTo(child);
|
||||
|
|
|
@ -216,7 +216,7 @@ class PaintingContext extends ClipContext {
|
|||
}());
|
||||
}
|
||||
assert(child._layer is OffsetLayer);
|
||||
final OffsetLayer childOffsetLayer = child._layer as OffsetLayer;
|
||||
final OffsetLayer childOffsetLayer = child._layer! as OffsetLayer;
|
||||
childOffsetLayer.offset = offset;
|
||||
appendLayer(child._layer!);
|
||||
}
|
||||
|
@ -1383,7 +1383,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
|||
result = true;
|
||||
break;
|
||||
}
|
||||
node = node.parent as RenderObject;
|
||||
node = node.parent! as RenderObject;
|
||||
}
|
||||
return true;
|
||||
}());
|
||||
|
@ -1480,7 +1480,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
|||
while (node != _relayoutBoundary) {
|
||||
assert(node._relayoutBoundary == _relayoutBoundary);
|
||||
assert(node.parent != null);
|
||||
node = node.parent as RenderObject;
|
||||
node = node.parent! as RenderObject;
|
||||
if ((!node._needsLayout) && (!node._debugDoingThisLayout))
|
||||
return false;
|
||||
}
|
||||
|
@ -1706,7 +1706,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
|||
if (!parentUsesSize || sizedByParent || constraints.isTight || parent is! RenderObject) {
|
||||
relayoutBoundary = this;
|
||||
} else {
|
||||
relayoutBoundary = (parent as RenderObject)._relayoutBoundary;
|
||||
relayoutBoundary = (parent! as RenderObject)._relayoutBoundary;
|
||||
}
|
||||
assert(() {
|
||||
_debugCanParentUseSize = parentUsesSize;
|
||||
|
@ -2029,7 +2029,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
|||
return;
|
||||
_needsCompositingBitsUpdate = true;
|
||||
if (parent is RenderObject) {
|
||||
final RenderObject parent = this.parent as RenderObject;
|
||||
final RenderObject parent = this.parent! as RenderObject;
|
||||
if (parent._needsCompositingBitsUpdate)
|
||||
return;
|
||||
if (!isRepaintBoundary && !parent.isRepaintBoundary) {
|
||||
|
@ -2141,7 +2141,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
|||
owner!.requestVisualUpdate();
|
||||
}
|
||||
} else if (parent is RenderObject) {
|
||||
final RenderObject parent = this.parent as RenderObject;
|
||||
final RenderObject parent = this.parent! as RenderObject;
|
||||
parent.markNeedsPaint();
|
||||
assert(parent == this.parent);
|
||||
} else {
|
||||
|
@ -2247,7 +2247,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
|||
assert(() {
|
||||
if (_needsCompositingBitsUpdate) {
|
||||
if (parent is RenderObject) {
|
||||
final RenderObject parent = this.parent as RenderObject;
|
||||
final RenderObject parent = this.parent! as RenderObject;
|
||||
bool visitedByParent = false;
|
||||
parent.visitChildren((RenderObject child) {
|
||||
if (child == this) {
|
||||
|
@ -2381,7 +2381,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
|||
ancestor = rootNode;
|
||||
}
|
||||
final List<RenderObject> renderers = <RenderObject>[];
|
||||
for (RenderObject renderer = this; renderer != ancestor; renderer = renderer.parent as RenderObject) {
|
||||
for (RenderObject renderer = this; renderer != ancestor; renderer = renderer.parent! as RenderObject) {
|
||||
assert(renderer != null); // Failed to find ancestor in parent chain.
|
||||
renderers.add(renderer);
|
||||
}
|
||||
|
@ -2505,7 +2505,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
|||
if (_semantics != null && !_semantics!.isMergedIntoParent) {
|
||||
_semantics!.sendEvent(semanticsEvent);
|
||||
} else if (parent != null) {
|
||||
final RenderObject renderParent = parent as RenderObject;
|
||||
final RenderObject renderParent = parent! as RenderObject;
|
||||
renderParent.sendSemanticsEvent(semanticsEvent);
|
||||
}
|
||||
}
|
||||
|
@ -2585,7 +2585,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
|||
break;
|
||||
node._needsSemanticsUpdate = true;
|
||||
|
||||
node = node.parent as RenderObject;
|
||||
node = node.parent! as RenderObject;
|
||||
isEffectiveSemanticsBoundary = node._semanticsConfiguration.isSemanticBoundary;
|
||||
if (isEffectiveSemanticsBoundary && node._semantics == null) {
|
||||
// We have reached a semantics boundary that doesn't own a semantics node.
|
||||
|
@ -2932,7 +2932,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
|||
Curve curve = Curves.ease,
|
||||
}) {
|
||||
if (parent is RenderObject) {
|
||||
final RenderObject renderParent = parent as RenderObject;
|
||||
final RenderObject renderParent = parent! as RenderObject;
|
||||
renderParent.showOnScreen(
|
||||
descendant: descendant ?? this,
|
||||
rect: rect,
|
||||
|
@ -3089,20 +3089,20 @@ mixin ContainerParentDataMixin<ChildType extends RenderObject> on ParentData {
|
|||
/// Moreover, this is a required mixin for render objects returned to [MultiChildRenderObjectWidget].
|
||||
mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType extends ContainerParentDataMixin<ChildType>> on RenderObject {
|
||||
bool _debugUltimatePreviousSiblingOf(ChildType child, { ChildType? equals }) {
|
||||
ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
ParentDataType childParentData = child.parentData! as ParentDataType;
|
||||
while (childParentData.previousSibling != null) {
|
||||
assert(childParentData.previousSibling != child);
|
||||
child = childParentData.previousSibling!;
|
||||
childParentData = child.parentData as ParentDataType;
|
||||
childParentData = child.parentData! as ParentDataType;
|
||||
}
|
||||
return child == equals;
|
||||
}
|
||||
bool _debugUltimateNextSiblingOf(ChildType child, { ChildType? equals }) {
|
||||
ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
ParentDataType childParentData = child.parentData! as ParentDataType;
|
||||
while (childParentData.nextSibling != null) {
|
||||
assert(childParentData.nextSibling != child);
|
||||
child = childParentData.nextSibling!;
|
||||
childParentData = child.parentData as ParentDataType;
|
||||
childParentData = child.parentData! as ParentDataType;
|
||||
}
|
||||
return child == equals;
|
||||
}
|
||||
|
@ -3154,7 +3154,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
|||
ChildType? _firstChild;
|
||||
ChildType? _lastChild;
|
||||
void _insertIntoChildList(ChildType child, { ChildType? after }) {
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
final ParentDataType childParentData = child.parentData! as ParentDataType;
|
||||
assert(childParentData.nextSibling == null);
|
||||
assert(childParentData.previousSibling == null);
|
||||
_childCount += 1;
|
||||
|
@ -3163,7 +3163,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
|||
// insert at the start (_firstChild)
|
||||
childParentData.nextSibling = _firstChild;
|
||||
if (_firstChild != null) {
|
||||
final ParentDataType _firstChildParentData = _firstChild!.parentData as ParentDataType;
|
||||
final ParentDataType _firstChildParentData = _firstChild!.parentData! as ParentDataType;
|
||||
_firstChildParentData.previousSibling = child;
|
||||
}
|
||||
_firstChild = child;
|
||||
|
@ -3173,7 +3173,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
|||
assert(_lastChild != null);
|
||||
assert(_debugUltimatePreviousSiblingOf(after, equals: _firstChild));
|
||||
assert(_debugUltimateNextSiblingOf(after, equals: _lastChild));
|
||||
final ParentDataType afterParentData = after.parentData as ParentDataType;
|
||||
final ParentDataType afterParentData = after.parentData! as ParentDataType;
|
||||
if (afterParentData.nextSibling == null) {
|
||||
// insert at the end (_lastChild); we'll end up with two or more children
|
||||
assert(after == _lastChild);
|
||||
|
@ -3186,8 +3186,8 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
|||
childParentData.nextSibling = afterParentData.nextSibling;
|
||||
childParentData.previousSibling = after;
|
||||
// set up links from siblings to child
|
||||
final ParentDataType childPreviousSiblingParentData = childParentData.previousSibling!.parentData as ParentDataType;
|
||||
final ParentDataType childNextSiblingParentData = childParentData.nextSibling!.parentData as ParentDataType;
|
||||
final ParentDataType childPreviousSiblingParentData = childParentData.previousSibling!.parentData! as ParentDataType;
|
||||
final ParentDataType childNextSiblingParentData = childParentData.nextSibling!.parentData! as ParentDataType;
|
||||
childPreviousSiblingParentData.nextSibling = child;
|
||||
childNextSiblingParentData.previousSibling = child;
|
||||
assert(afterParentData.nextSibling == child);
|
||||
|
@ -3219,7 +3219,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
|||
}
|
||||
|
||||
void _removeFromChildList(ChildType child) {
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
final ParentDataType childParentData = child.parentData! as ParentDataType;
|
||||
assert(_debugUltimatePreviousSiblingOf(child, equals: _firstChild));
|
||||
assert(_debugUltimateNextSiblingOf(child, equals: _lastChild));
|
||||
assert(_childCount >= 0);
|
||||
|
@ -3227,14 +3227,14 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
|||
assert(_firstChild == child);
|
||||
_firstChild = childParentData.nextSibling;
|
||||
} else {
|
||||
final ParentDataType childPreviousSiblingParentData = childParentData.previousSibling!.parentData as ParentDataType;
|
||||
final ParentDataType childPreviousSiblingParentData = childParentData.previousSibling!.parentData! as ParentDataType;
|
||||
childPreviousSiblingParentData.nextSibling = childParentData.nextSibling;
|
||||
}
|
||||
if (childParentData.nextSibling == null) {
|
||||
assert(_lastChild == child);
|
||||
_lastChild = childParentData.previousSibling;
|
||||
} else {
|
||||
final ParentDataType childNextSiblingParentData = childParentData.nextSibling!.parentData as ParentDataType;
|
||||
final ParentDataType childNextSiblingParentData = childParentData.nextSibling!.parentData! as ParentDataType;
|
||||
childNextSiblingParentData.previousSibling = childParentData.previousSibling;
|
||||
}
|
||||
childParentData.previousSibling = null;
|
||||
|
@ -3256,7 +3256,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
|||
void removeAll() {
|
||||
ChildType? child = _firstChild;
|
||||
while (child != null) {
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
final ParentDataType childParentData = child.parentData! as ParentDataType;
|
||||
final ChildType? next = childParentData.nextSibling;
|
||||
childParentData.previousSibling = null;
|
||||
childParentData.nextSibling = null;
|
||||
|
@ -3278,7 +3278,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
|||
assert(after != this);
|
||||
assert(child != after);
|
||||
assert(child.parent == this);
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
final ParentDataType childParentData = child.parentData! as ParentDataType;
|
||||
if (childParentData.previousSibling == after)
|
||||
return;
|
||||
_removeFromChildList(child);
|
||||
|
@ -3292,7 +3292,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
|||
ChildType? child = _firstChild;
|
||||
while (child != null) {
|
||||
child.attach(owner);
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
final ParentDataType childParentData = child.parentData! as ParentDataType;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
}
|
||||
|
@ -3303,7 +3303,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
|||
ChildType? child = _firstChild;
|
||||
while (child != null) {
|
||||
child.detach();
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
final ParentDataType childParentData = child.parentData! as ParentDataType;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
}
|
||||
|
@ -3313,7 +3313,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
|||
ChildType? child = _firstChild;
|
||||
while (child != null) {
|
||||
redepthChild(child);
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
final ParentDataType childParentData = child.parentData! as ParentDataType;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
}
|
||||
|
@ -3323,7 +3323,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
|||
ChildType? child = _firstChild;
|
||||
while (child != null) {
|
||||
visitor(child);
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
final ParentDataType childParentData = child.parentData! as ParentDataType;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
}
|
||||
|
@ -3338,7 +3338,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
|||
ChildType? childBefore(ChildType child) {
|
||||
assert(child != null);
|
||||
assert(child.parent == this);
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
final ParentDataType childParentData = child.parentData! as ParentDataType;
|
||||
return childParentData.previousSibling;
|
||||
}
|
||||
|
||||
|
@ -3346,7 +3346,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
|||
ChildType? childAfter(ChildType child) {
|
||||
assert(child != null);
|
||||
assert(child.parent == this);
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
final ParentDataType childParentData = child.parentData! as ParentDataType;
|
||||
return childParentData.nextSibling;
|
||||
}
|
||||
|
||||
|
@ -3361,7 +3361,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
|||
if (child == lastChild)
|
||||
break;
|
||||
count += 1;
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
final ParentDataType childParentData = child.parentData! as ParentDataType;
|
||||
child = childParentData.nextSibling!;
|
||||
}
|
||||
}
|
||||
|
@ -3897,12 +3897,12 @@ class _SemanticsGeometry {
|
|||
assert(transform != null);
|
||||
assert(clipRectTransform != null);
|
||||
assert(clipRectTransform.isIdentity());
|
||||
RenderObject intermediateParent = child.parent as RenderObject;
|
||||
RenderObject intermediateParent = child.parent! as RenderObject;
|
||||
assert(intermediateParent != null);
|
||||
while (intermediateParent != ancestor) {
|
||||
intermediateParent.applyPaintTransform(child, transform);
|
||||
intermediateParent = intermediateParent.parent as RenderObject;
|
||||
child = child.parent as RenderObject;
|
||||
intermediateParent = intermediateParent.parent! as RenderObject;
|
||||
child = child.parent! as RenderObject;
|
||||
assert(intermediateParent != null);
|
||||
}
|
||||
ancestor.applyPaintTransform(child, transform);
|
||||
|
|
|
@ -435,7 +435,7 @@ class RenderParagraph extends RenderBox
|
|||
bool hitTestChildren(BoxHitTestResult result, { required Offset position }) {
|
||||
RenderBox? child = firstChild;
|
||||
while (child != null) {
|
||||
final TextParentData textParentData = child.parentData as TextParentData;
|
||||
final TextParentData textParentData = child.parentData! as TextParentData;
|
||||
final Matrix4 transform = Matrix4.translationValues(
|
||||
textParentData.offset.dx,
|
||||
textParentData.offset.dy,
|
||||
|
@ -574,7 +574,7 @@ class RenderParagraph extends RenderBox
|
|||
RenderBox? child = firstChild;
|
||||
int childIndex = 0;
|
||||
while (child != null && childIndex < _textPainter.inlinePlaceholderBoxes!.length) {
|
||||
final TextParentData textParentData = child.parentData as TextParentData;
|
||||
final TextParentData textParentData = child.parentData! as TextParentData;
|
||||
textParentData.offset = Offset(
|
||||
_textPainter.inlinePlaceholderBoxes![childIndex].left,
|
||||
_textPainter.inlinePlaceholderBoxes![childIndex].top,
|
||||
|
@ -706,7 +706,7 @@ class RenderParagraph extends RenderBox
|
|||
// it until we finish layout, and RenderObject is in immutable state at
|
||||
// this point.
|
||||
while (child != null && childIndex < _textPainter.inlinePlaceholderBoxes!.length) {
|
||||
final TextParentData textParentData = child.parentData as TextParentData;
|
||||
final TextParentData textParentData = child.parentData! as TextParentData;
|
||||
|
||||
final double scale = textParentData.scale!;
|
||||
context.pushTransform(
|
||||
|
@ -920,7 +920,7 @@ class RenderParagraph extends RenderBox
|
|||
if (info.isPlaceholder) {
|
||||
if (children.isNotEmpty) {
|
||||
final SemanticsNode childNode = children.elementAt(placeholderIndex++);
|
||||
final TextParentData parentData = child!.parentData as TextParentData;
|
||||
final TextParentData parentData = child!.parentData! as TextParentData;
|
||||
childNode.rect = Rect.fromLTWH(
|
||||
childNode.rect.left,
|
||||
childNode.rect.top,
|
||||
|
|
|
@ -954,7 +954,7 @@ mixin RenderAnimatedOpacityMixin<T extends RenderObject> on RenderObjectWithChil
|
|||
return;
|
||||
}
|
||||
assert(needsCompositing);
|
||||
layer = context.pushOpacity(offset, _alpha!, super.paint, oldLayer: layer as OpacityLayer);
|
||||
layer = context.pushOpacity(offset, _alpha!, super.paint, oldLayer: layer as OpacityLayer?);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1392,7 +1392,7 @@ class RenderClipRect extends _RenderCustomClip<Rect> {
|
|||
_clip!,
|
||||
super.paint,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: layer as ClipRectLayer,
|
||||
oldLayer: layer as ClipRectLayer?,
|
||||
);
|
||||
} else {
|
||||
layer = null;
|
||||
|
@ -1480,7 +1480,7 @@ class RenderClipRRect extends _RenderCustomClip<RRect> {
|
|||
offset,
|
||||
_clip!.outerRect,
|
||||
_clip!,
|
||||
super.paint, clipBehavior: clipBehavior, oldLayer: layer as ClipRRectLayer,
|
||||
super.paint, clipBehavior: clipBehavior, oldLayer: layer as ClipRRectLayer?,
|
||||
);
|
||||
} else {
|
||||
layer = null;
|
||||
|
@ -1559,7 +1559,7 @@ class RenderClipOval extends _RenderCustomClip<Rect> {
|
|||
_getClipPath(_clip!),
|
||||
super.paint,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: layer as ClipPathLayer,
|
||||
oldLayer: layer as ClipPathLayer?,
|
||||
);
|
||||
} else {
|
||||
layer = null;
|
||||
|
@ -1632,7 +1632,7 @@ class RenderClipPath extends _RenderCustomClip<Path> {
|
|||
_clip!,
|
||||
super.paint,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: layer as ClipPathLayer,
|
||||
oldLayer: layer as ClipPathLayer?,
|
||||
);
|
||||
} else {
|
||||
layer = null;
|
||||
|
@ -2298,7 +2298,7 @@ class RenderTransform extends RenderProxyBox {
|
|||
offset,
|
||||
transform,
|
||||
super.paint,
|
||||
oldLayer: layer as TransformLayer,
|
||||
oldLayer: layer as TransformLayer?,
|
||||
);
|
||||
} else {
|
||||
super.paint(context, offset + childOffset);
|
||||
|
@ -2487,7 +2487,7 @@ class RenderFittedBox extends RenderProxyBox {
|
|||
final Offset? childOffset = MatrixUtils.getAsTranslation(_transform!);
|
||||
if (childOffset == null)
|
||||
return context.pushTransform(needsCompositing, offset, _transform!, super.paint,
|
||||
oldLayer: layer is TransformLayer ? layer as TransformLayer : null);
|
||||
oldLayer: layer is TransformLayer ? layer! as TransformLayer : null);
|
||||
else
|
||||
super.paint(context, offset + childOffset);
|
||||
return null;
|
||||
|
@ -2501,7 +2501,7 @@ class RenderFittedBox extends RenderProxyBox {
|
|||
if (child != null) {
|
||||
if (_hasVisualOverflow! && clipBehavior != Clip.none)
|
||||
layer = context.pushClipRect(needsCompositing, offset, Offset.zero & size, _paintChildWithTransform,
|
||||
oldLayer: layer is ClipRectLayer ? layer as ClipRectLayer : null, clipBehavior: clipBehavior);
|
||||
oldLayer: layer is ClipRectLayer ? layer! as ClipRectLayer : null, clipBehavior: clipBehavior);
|
||||
else
|
||||
layer = _paintChildWithTransform(context, offset);
|
||||
}
|
||||
|
@ -2954,7 +2954,7 @@ class RenderRepaintBoundary extends RenderProxyBox {
|
|||
/// * [dart:ui.Scene.toImage] for more information about the image returned.
|
||||
Future<ui.Image> toImage({ double pixelRatio = 1.0 }) {
|
||||
assert(!debugNeedsPaint);
|
||||
final OffsetLayer offsetLayer = layer as OffsetLayer;
|
||||
final OffsetLayer offsetLayer = layer! as OffsetLayer;
|
||||
return offsetLayer.toImage(Offset.zero & size, pixelRatio: pixelRatio);
|
||||
}
|
||||
|
||||
|
@ -4851,7 +4851,7 @@ class RenderLeaderLayer extends RenderProxyBox {
|
|||
if (layer == null) {
|
||||
layer = LeaderLayer(link: link, offset: offset);
|
||||
} else {
|
||||
final LeaderLayer leaderLayer = layer as LeaderLayer;
|
||||
final LeaderLayer leaderLayer = layer! as LeaderLayer;
|
||||
leaderLayer
|
||||
..link = link
|
||||
..offset = offset;
|
||||
|
|
|
@ -80,7 +80,7 @@ abstract class RenderProxySliver extends RenderSliver with RenderObjectWithChild
|
|||
@override
|
||||
void applyPaintTransform(RenderObject child, Matrix4 transform) {
|
||||
assert(child != null);
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
final SliverPhysicalParentData childParentData = child.parentData! as SliverPhysicalParentData;
|
||||
childParentData.applyPaintTransform(transform);
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ class RenderSliverOpacity extends RenderProxySliver {
|
|||
offset,
|
||||
_alpha,
|
||||
super.paint,
|
||||
oldLayer: layer as OpacityLayer,
|
||||
oldLayer: layer as OpacityLayer?,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ abstract class RenderShiftedBox extends RenderBox with RenderObjectWithChildMixi
|
|||
if (child != null) {
|
||||
assert(!debugNeedsLayout);
|
||||
result = child!.getDistanceToActualBaseline(baseline);
|
||||
final BoxParentData childParentData = child!.parentData as BoxParentData;
|
||||
final BoxParentData childParentData = child!.parentData! as BoxParentData;
|
||||
if (result != null)
|
||||
result += childParentData.offset.dy;
|
||||
} else {
|
||||
|
@ -66,7 +66,7 @@ abstract class RenderShiftedBox extends RenderBox with RenderObjectWithChildMixi
|
|||
@override
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
if (child != null) {
|
||||
final BoxParentData childParentData = child!.parentData as BoxParentData;
|
||||
final BoxParentData childParentData = child!.parentData! as BoxParentData;
|
||||
context.paintChild(child!, childParentData.offset + offset);
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ abstract class RenderShiftedBox extends RenderBox with RenderObjectWithChildMixi
|
|||
@override
|
||||
bool hitTestChildren(BoxHitTestResult result, { required Offset position }) {
|
||||
if (child != null) {
|
||||
final BoxParentData childParentData = child!.parentData as BoxParentData;
|
||||
final BoxParentData childParentData = child!.parentData! as BoxParentData;
|
||||
return result.addWithPaintOffset(
|
||||
offset: childParentData.offset,
|
||||
position: position,
|
||||
|
@ -205,7 +205,7 @@ class RenderPadding extends RenderShiftedBox {
|
|||
}
|
||||
final BoxConstraints innerConstraints = constraints.deflate(_resolvedPadding!);
|
||||
child!.layout(innerConstraints, parentUsesSize: true);
|
||||
final BoxParentData childParentData = child!.parentData as BoxParentData;
|
||||
final BoxParentData childParentData = child!.parentData! as BoxParentData;
|
||||
childParentData.offset = Offset(_resolvedPadding!.left, _resolvedPadding!.top);
|
||||
size = constraints.constrain(Size(
|
||||
_resolvedPadding!.left + child!.size.width + _resolvedPadding!.right,
|
||||
|
@ -322,7 +322,7 @@ abstract class RenderAligningShiftedBox extends RenderShiftedBox {
|
|||
assert(child!.hasSize);
|
||||
assert(hasSize);
|
||||
assert(_resolvedAlignment != null);
|
||||
final BoxParentData childParentData = child!.parentData as BoxParentData;
|
||||
final BoxParentData childParentData = child!.parentData! as BoxParentData;
|
||||
childParentData.offset = _resolvedAlignment!.alongOffset(size - child!.size as Offset);
|
||||
}
|
||||
|
||||
|
@ -413,7 +413,7 @@ class RenderPositionedBox extends RenderAligningShiftedBox {
|
|||
..strokeWidth = 1.0
|
||||
..color = const Color(0xFFFFFF00);
|
||||
path = Path();
|
||||
final BoxParentData childParentData = child!.parentData as BoxParentData;
|
||||
final BoxParentData childParentData = child!.parentData! as BoxParentData;
|
||||
if (childParentData.offset.dy > 0.0) {
|
||||
// vertical alignment arrows
|
||||
final double headSize = math.min(childParentData.offset.dy * 0.2, 10.0);
|
||||
|
@ -688,7 +688,7 @@ class RenderUnconstrainedBox extends RenderAligningShiftedBox with DebugOverflow
|
|||
child!.layout(childConstraints, parentUsesSize: true);
|
||||
size = constraints.constrain(child!.size);
|
||||
alignChild();
|
||||
final BoxParentData childParentData = child!.parentData as BoxParentData;
|
||||
final BoxParentData childParentData = child!.parentData! as BoxParentData;
|
||||
_overflowContainerRect = Offset.zero & size;
|
||||
_overflowChildRect = childParentData.offset & child!.size;
|
||||
} else {
|
||||
|
@ -1145,7 +1145,7 @@ class RenderCustomSingleChildLayoutBox extends RenderShiftedBox {
|
|||
final BoxConstraints childConstraints = delegate.getConstraintsForChild(constraints);
|
||||
assert(childConstraints.debugAssertIsValid(isAppliedConstraint: true));
|
||||
child!.layout(childConstraints, parentUsesSize: !childConstraints.isTight);
|
||||
final BoxParentData childParentData = child!.parentData as BoxParentData;
|
||||
final BoxParentData childParentData = child!.parentData! as BoxParentData;
|
||||
childParentData.offset = delegate.getPositionForChild(size, childConstraints.isTight ? childConstraints.smallest : child!.size);
|
||||
}
|
||||
}
|
||||
|
@ -1212,7 +1212,7 @@ class RenderBaseline extends RenderShiftedBox {
|
|||
final double childBaseline = child!.getDistanceToBaseline(baselineType)!;
|
||||
final double actualBaseline = baseline;
|
||||
final double top = actualBaseline - childBaseline;
|
||||
final BoxParentData childParentData = child!.parentData as BoxParentData;
|
||||
final BoxParentData childParentData = child!.parentData! as BoxParentData;
|
||||
childParentData.offset = Offset(0.0, top);
|
||||
final Size childSize = child!.size;
|
||||
size = constraints.constrain(Size(childSize.width, top + childSize.height));
|
||||
|
|
|
@ -1734,7 +1734,7 @@ abstract class RenderSliverSingleBoxAdapter extends RenderSliver with RenderObje
|
|||
/// [SliverConstraints.growthDirection] and the given geometry.
|
||||
@protected
|
||||
void setChildParentData(RenderObject child, SliverConstraints constraints, SliverGeometry geometry) {
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
final SliverPhysicalParentData childParentData = child.parentData! as SliverPhysicalParentData;
|
||||
assert(constraints.axisDirection != null);
|
||||
assert(constraints.growthDirection != null);
|
||||
switch (applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
|
||||
|
@ -1771,14 +1771,14 @@ abstract class RenderSliverSingleBoxAdapter extends RenderSliver with RenderObje
|
|||
void applyPaintTransform(RenderObject child, Matrix4 transform) {
|
||||
assert(child != null);
|
||||
assert(child == this.child);
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
final SliverPhysicalParentData childParentData = child.parentData! as SliverPhysicalParentData;
|
||||
childParentData.applyPaintTransform(transform);
|
||||
}
|
||||
|
||||
@override
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
if (child != null && geometry!.visible) {
|
||||
final SliverPhysicalParentData childParentData = child!.parentData as SliverPhysicalParentData;
|
||||
final SliverPhysicalParentData childParentData = child!.parentData! as SliverPhysicalParentData;
|
||||
context.paintChild(child!, offset + childParentData.paintOffset);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ abstract class RenderSliverFixedExtentBoxAdaptor extends RenderSliverMultiBoxAda
|
|||
geometry = SliverGeometry(scrollOffsetCorrection: index * itemExtent);
|
||||
return;
|
||||
}
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
childParentData.layoutOffset = indexToLayoutOffset(itemExtent, index);
|
||||
assert(childParentData.index == index);
|
||||
trailingChildWithLayout ??= child;
|
||||
|
@ -230,7 +230,7 @@ abstract class RenderSliverFixedExtentBoxAdaptor extends RenderSliverMultiBoxAda
|
|||
|
||||
if (trailingChildWithLayout == null) {
|
||||
firstChild!.layout(childConstraints);
|
||||
final SliverMultiBoxAdaptorParentData childParentData = firstChild!.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = firstChild!.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
childParentData.layoutOffset = indexToLayoutOffset(itemExtent, firstIndex);
|
||||
trailingChildWithLayout = firstChild;
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ abstract class RenderSliverFixedExtentBoxAdaptor extends RenderSliverMultiBoxAda
|
|||
}
|
||||
trailingChildWithLayout = child;
|
||||
assert(child != null);
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
assert(childParentData.index == index);
|
||||
childParentData.layoutOffset = indexToLayoutOffset(itemExtent, childParentData.index!);
|
||||
}
|
||||
|
|
|
@ -508,7 +508,7 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor {
|
|||
|
||||
@override
|
||||
double childCrossAxisPosition(RenderBox child) {
|
||||
final SliverGridParentData childParentData = child.parentData as SliverGridParentData;
|
||||
final SliverGridParentData childParentData = child.parentData! as SliverGridParentData;
|
||||
return childParentData.crossAxisOffset!;
|
||||
}
|
||||
|
||||
|
@ -566,7 +566,7 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor {
|
|||
final RenderBox child = insertAndLayoutLeadingChild(
|
||||
gridGeometry.getBoxConstraints(constraints),
|
||||
)!;
|
||||
final SliverGridParentData childParentData = child.parentData as SliverGridParentData;
|
||||
final SliverGridParentData childParentData = child.parentData! as SliverGridParentData;
|
||||
childParentData.layoutOffset = gridGeometry.scrollOffset;
|
||||
childParentData.crossAxisOffset = gridGeometry.crossAxisOffset;
|
||||
assert(childParentData.index == index);
|
||||
|
@ -576,7 +576,7 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor {
|
|||
|
||||
if (trailingChildWithLayout == null) {
|
||||
firstChild!.layout(firstChildGridGeometry.getBoxConstraints(constraints));
|
||||
final SliverGridParentData childParentData = firstChild!.parentData as SliverGridParentData;
|
||||
final SliverGridParentData childParentData = firstChild!.parentData! as SliverGridParentData;
|
||||
childParentData.layoutOffset = firstChildGridGeometry.scrollOffset;
|
||||
childParentData.crossAxisOffset = firstChildGridGeometry.crossAxisOffset;
|
||||
trailingChildWithLayout = firstChild;
|
||||
|
@ -597,7 +597,7 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor {
|
|||
}
|
||||
trailingChildWithLayout = child;
|
||||
assert(child != null);
|
||||
final SliverGridParentData childParentData = child.parentData as SliverGridParentData;
|
||||
final SliverGridParentData childParentData = child.parentData! as SliverGridParentData;
|
||||
childParentData.layoutOffset = gridGeometry.scrollOffset;
|
||||
childParentData.crossAxisOffset = gridGeometry.crossAxisOffset;
|
||||
assert(childParentData.index == index);
|
||||
|
|
|
@ -127,7 +127,7 @@ class RenderSliverList extends RenderSliverMultiBoxAdaptor {
|
|||
// We have to add children before the earliestUsefulChild.
|
||||
earliestUsefulChild = insertAndLayoutLeadingChild(childConstraints, parentUsesSize: true);
|
||||
if (earliestUsefulChild == null) {
|
||||
final SliverMultiBoxAdaptorParentData childParentData = firstChild!.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = firstChild!.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
childParentData.layoutOffset = 0.0;
|
||||
|
||||
if (scrollOffset == 0.0) {
|
||||
|
@ -158,12 +158,12 @@ class RenderSliverList extends RenderSliverMultiBoxAdaptor {
|
|||
geometry = SliverGeometry(
|
||||
scrollOffsetCorrection: -firstChildScrollOffset,
|
||||
);
|
||||
final SliverMultiBoxAdaptorParentData childParentData = firstChild!.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = firstChild!.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
childParentData.layoutOffset = 0.0;
|
||||
return;
|
||||
}
|
||||
|
||||
final SliverMultiBoxAdaptorParentData childParentData = earliestUsefulChild.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = earliestUsefulChild.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
childParentData.layoutOffset = firstChildScrollOffset;
|
||||
assert(earliestUsefulChild == firstChild);
|
||||
leadingChildWithLayout = earliestUsefulChild;
|
||||
|
@ -185,7 +185,7 @@ class RenderSliverList extends RenderSliverMultiBoxAdaptor {
|
|||
earliestUsefulChild = insertAndLayoutLeadingChild(childConstraints, parentUsesSize: true);
|
||||
assert(earliestUsefulChild != null);
|
||||
final double firstChildScrollOffset = earliestScrollOffset - paintExtentOf(firstChild!);
|
||||
final SliverMultiBoxAdaptorParentData childParentData = firstChild!.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = firstChild!.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
childParentData.layoutOffset = 0.0;
|
||||
// We only need to correct if the leading child actually has a
|
||||
// paint extent.
|
||||
|
@ -251,7 +251,7 @@ class RenderSliverList extends RenderSliverMultiBoxAdaptor {
|
|||
trailingChildWithLayout = child;
|
||||
}
|
||||
assert(child != null);
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child!.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child!.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
childParentData.layoutOffset = endScrollOffset;
|
||||
assert(childParentData.index == index);
|
||||
endScrollOffset = childScrollOffset(child!)! + paintExtentOf(child!);
|
||||
|
|
|
@ -239,7 +239,7 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
|
|||
@override
|
||||
void adoptChild(RenderObject child) {
|
||||
super.adoptChild(child);
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
if (!childParentData._keptAlive)
|
||||
childManager.didAdoptChild(child as RenderBox);
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
|
|||
// 2. The child is keptAlive.
|
||||
// In this case, the child is no longer in the childList but might be stored in
|
||||
// [_keepAliveBucket]. We need to update the location of the child in the bucket.
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
if (!childParentData.keptAlive) {
|
||||
super.move(child, after: after);
|
||||
childManager.didAdoptChild(child); // updates the slot in the parentData
|
||||
|
@ -314,7 +314,7 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
|
|||
|
||||
@override
|
||||
void remove(RenderBox child) {
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
if (!childParentData._keptAlive) {
|
||||
super.remove(child);
|
||||
return;
|
||||
|
@ -340,7 +340,7 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
|
|||
assert(constraints == this.constraints);
|
||||
if (_keepAliveBucket.containsKey(index)) {
|
||||
final RenderBox child = _keepAliveBucket.remove(index)!;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
assert(childParentData._keptAlive);
|
||||
dropChild(child);
|
||||
child.parentData = childParentData;
|
||||
|
@ -353,7 +353,7 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
|
|||
}
|
||||
|
||||
void _destroyOrCacheChild(RenderBox child) {
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
if (childParentData.keepAlive) {
|
||||
assert(!childParentData._keptAlive);
|
||||
remove(child);
|
||||
|
@ -424,7 +424,7 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
|
|||
if (firstChild != null) {
|
||||
assert(firstChild == lastChild);
|
||||
assert(indexOf(firstChild!) == index);
|
||||
final SliverMultiBoxAdaptorParentData firstChildParentData = firstChild!.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData firstChildParentData = firstChild!.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
firstChildParentData.layoutOffset = layoutOffset;
|
||||
return true;
|
||||
}
|
||||
|
@ -518,11 +518,11 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
|
|||
// kept alive. (This should cause _keepAliveBucket to change, so we have
|
||||
// to prepare our list ahead of time.)
|
||||
_keepAliveBucket.values.where((RenderBox child) {
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
return !childParentData.keepAlive;
|
||||
}).toList().forEach(_childManager.removeChild);
|
||||
assert(_keepAliveBucket.values.where((RenderBox child) {
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
return !childParentData.keepAlive;
|
||||
}).isEmpty);
|
||||
});
|
||||
|
@ -532,7 +532,7 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
|
|||
/// [SliverMultiBoxAdaptorParentData.index] field of the child's [parentData].
|
||||
int indexOf(RenderBox child) {
|
||||
assert(child != null);
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
assert(childParentData.index != null);
|
||||
return childParentData.index!;
|
||||
}
|
||||
|
@ -572,7 +572,7 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
|
|||
double? childScrollOffset(RenderObject child) {
|
||||
assert(child != null);
|
||||
assert(child.parent == this);
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
return childParentData.layoutOffset;
|
||||
}
|
||||
|
||||
|
@ -676,7 +676,7 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
|
|||
if (firstChild != null) {
|
||||
RenderBox? child = firstChild;
|
||||
while (true) {
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child!.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child!.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
children.add(child.toDiagnosticsNode(name: 'child with index ${childParentData.index}'));
|
||||
if (child == lastChild)
|
||||
break;
|
||||
|
|
|
@ -187,7 +187,7 @@ abstract class RenderSliverEdgeInsetsPadding extends RenderSliver with RenderObj
|
|||
hasVisualOverflow: childLayoutGeometry.hasVisualOverflow,
|
||||
);
|
||||
|
||||
final SliverPhysicalParentData childParentData = child!.parentData as SliverPhysicalParentData;
|
||||
final SliverPhysicalParentData childParentData = child!.parentData! as SliverPhysicalParentData;
|
||||
assert(constraints.axisDirection != null);
|
||||
assert(constraints.growthDirection != null);
|
||||
switch (applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
|
||||
|
@ -214,7 +214,7 @@ abstract class RenderSliverEdgeInsetsPadding extends RenderSliver with RenderObj
|
|||
@override
|
||||
bool hitTestChildren(SliverHitTestResult result, { required double mainAxisPosition, required double crossAxisPosition }) {
|
||||
if (child != null && child!.geometry!.hitTestExtent > 0.0) {
|
||||
final SliverPhysicalParentData childParentData = child!.parentData as SliverPhysicalParentData;
|
||||
final SliverPhysicalParentData childParentData = child!.parentData! as SliverPhysicalParentData;
|
||||
result.addWithAxisOffset(
|
||||
mainAxisPosition: mainAxisPosition,
|
||||
crossAxisPosition: crossAxisPosition,
|
||||
|
@ -262,14 +262,14 @@ abstract class RenderSliverEdgeInsetsPadding extends RenderSliver with RenderObj
|
|||
void applyPaintTransform(RenderObject child, Matrix4 transform) {
|
||||
assert(child != null);
|
||||
assert(child == this.child);
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
final SliverPhysicalParentData childParentData = child.parentData! as SliverPhysicalParentData;
|
||||
childParentData.applyPaintTransform(transform);
|
||||
}
|
||||
|
||||
@override
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
if (child != null && child!.geometry!.visible) {
|
||||
final SliverPhysicalParentData childParentData = child!.parentData as SliverPhysicalParentData;
|
||||
final SliverPhysicalParentData childParentData = child!.parentData! as SliverPhysicalParentData;
|
||||
context.paintChild(child!, offset + childParentData.paintOffset);
|
||||
}
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ abstract class RenderSliverEdgeInsetsPadding extends RenderSliver with RenderObj
|
|||
Rect? innerRect;
|
||||
if (child != null) {
|
||||
childSize = child!.getAbsoluteSize();
|
||||
final SliverPhysicalParentData childParentData = child!.parentData as SliverPhysicalParentData;
|
||||
final SliverPhysicalParentData childParentData = child!.parentData! as SliverPhysicalParentData;
|
||||
innerRect = (offset + childParentData.paintOffset) & childSize;
|
||||
assert(innerRect.top >= outerRect.top);
|
||||
assert(innerRect.left >= outerRect.left);
|
||||
|
|
|
@ -438,7 +438,7 @@ class RenderStack extends RenderBox
|
|||
double extent = 0.0;
|
||||
RenderBox? child = firstChild;
|
||||
while (child != null) {
|
||||
final StackParentData childParentData = child.parentData as StackParentData;
|
||||
final StackParentData childParentData = child.parentData! as StackParentData;
|
||||
if (!childParentData.isPositioned)
|
||||
extent = math.max(extent, mainChildSizeGetter(child));
|
||||
assert(child.parentData == childParentData);
|
||||
|
@ -556,7 +556,7 @@ class RenderStack extends RenderBox
|
|||
|
||||
RenderBox? child = firstChild;
|
||||
while (child != null) {
|
||||
final StackParentData childParentData = child.parentData as StackParentData;
|
||||
final StackParentData childParentData = child.parentData! as StackParentData;
|
||||
|
||||
if (!childParentData.isPositioned) {
|
||||
hasNonPositionedChildren = true;
|
||||
|
@ -583,7 +583,7 @@ class RenderStack extends RenderBox
|
|||
|
||||
child = firstChild;
|
||||
while (child != null) {
|
||||
final StackParentData childParentData = child.parentData as StackParentData;
|
||||
final StackParentData childParentData = child.parentData! as StackParentData;
|
||||
|
||||
if (!childParentData.isPositioned) {
|
||||
childParentData.offset = _resolvedAlignment!.alongOffset(size - child.size as Offset);
|
||||
|
@ -674,7 +674,7 @@ class RenderIndexedStack extends RenderStack {
|
|||
RenderBox? child = firstChild;
|
||||
int i = 0;
|
||||
while (child != null && i < index!) {
|
||||
final StackParentData childParentData = child.parentData as StackParentData;
|
||||
final StackParentData childParentData = child.parentData! as StackParentData;
|
||||
child = childParentData.nextSibling;
|
||||
i += 1;
|
||||
}
|
||||
|
@ -689,7 +689,7 @@ class RenderIndexedStack extends RenderStack {
|
|||
return false;
|
||||
assert(position != null);
|
||||
final RenderBox child = _childAtIndex();
|
||||
final StackParentData childParentData = child.parentData as StackParentData;
|
||||
final StackParentData childParentData = child.parentData! as StackParentData;
|
||||
return result.addWithPaintOffset(
|
||||
offset: childParentData.offset,
|
||||
position: position,
|
||||
|
@ -705,7 +705,7 @@ class RenderIndexedStack extends RenderStack {
|
|||
if (firstChild == null || index == null)
|
||||
return;
|
||||
final RenderBox child = _childAtIndex();
|
||||
final StackParentData childParentData = child.parentData as StackParentData;
|
||||
final StackParentData childParentData = child.parentData! as StackParentData;
|
||||
context.paintChild(child, childParentData.offset + offset);
|
||||
}
|
||||
|
||||
|
|
|
@ -1043,7 +1043,7 @@ class RenderTable extends RenderBox {
|
|||
final int xy = x + y * columns;
|
||||
final RenderBox? child = _children[xy];
|
||||
if (child != null) {
|
||||
final TableCellParentData childParentData = child.parentData as TableCellParentData;
|
||||
final TableCellParentData childParentData = child.parentData! as TableCellParentData;
|
||||
assert(childParentData != null);
|
||||
childParentData.x = x;
|
||||
childParentData.y = y;
|
||||
|
@ -1082,7 +1082,7 @@ class RenderTable extends RenderBox {
|
|||
final int xy = x + y * columns;
|
||||
final RenderBox? child = _children[xy];
|
||||
if (child != null) {
|
||||
final TableCellParentData childParentData = child.parentData as TableCellParentData;
|
||||
final TableCellParentData childParentData = child.parentData! as TableCellParentData;
|
||||
switch (childParentData.verticalAlignment ?? defaultVerticalAlignment) {
|
||||
case TableCellVerticalAlignment.baseline:
|
||||
if (baselines[x] != null)
|
||||
|
@ -1117,7 +1117,7 @@ class RenderTable extends RenderBox {
|
|||
for (int index = _children.length - 1; index >= 0; index -= 1) {
|
||||
final RenderBox? child = _children[index];
|
||||
if (child != null) {
|
||||
final BoxParentData childParentData = child.parentData as BoxParentData;
|
||||
final BoxParentData childParentData = child.parentData! as BoxParentData;
|
||||
final bool isHit = result.addWithPaintOffset(
|
||||
offset: childParentData.offset,
|
||||
position: position,
|
||||
|
@ -1163,7 +1163,7 @@ class RenderTable extends RenderBox {
|
|||
for (int index = 0; index < _children.length; index += 1) {
|
||||
final RenderBox? child = _children[index];
|
||||
if (child != null) {
|
||||
final BoxParentData childParentData = child.parentData as BoxParentData;
|
||||
final BoxParentData childParentData = child.parentData! as BoxParentData;
|
||||
context.paintChild(child, childParentData.offset + offset);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -736,7 +736,7 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
|
|||
RenderBox? pivot;
|
||||
bool onlySlivers = target is RenderSliver; // ... between viewport and `target` (`target` included).
|
||||
while (child.parent != this) {
|
||||
final RenderObject parent = child.parent as RenderObject;
|
||||
final RenderObject parent = child.parent! as RenderObject;
|
||||
assert(parent != null, '$target must be a descendant of $this');
|
||||
if (child is RenderBox) {
|
||||
pivot = child;
|
||||
|
@ -763,7 +763,7 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
|
|||
assert(pivot.parent != this);
|
||||
assert(pivot != this);
|
||||
assert(pivot.parent is RenderSliver); // TODO(abarth): Support other kinds of render objects besides slivers.
|
||||
final RenderSliver pivotParent = pivot.parent as RenderSliver;
|
||||
final RenderSliver pivotParent = pivot.parent! as RenderSliver;
|
||||
growthDirection = pivotParent.constraints.growthDirection;
|
||||
switch (axis) {
|
||||
case Axis.horizontal:
|
||||
|
@ -1186,7 +1186,7 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
|
|||
} else {
|
||||
// `descendant` is between leading and trailing edge and hence already
|
||||
// fully shown on screen. No action necessary.
|
||||
final Matrix4 transform = descendant.getTransformTo(viewport.parent as RenderObject);
|
||||
final Matrix4 transform = descendant.getTransformTo(viewport.parent! as RenderObject);
|
||||
return MatrixUtils.transformRect(transform, rect ?? descendant.paintBounds);
|
||||
}
|
||||
|
||||
|
@ -1592,13 +1592,13 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
|
|||
|
||||
@override
|
||||
void updateChildLayoutOffset(RenderSliver child, double layoutOffset, GrowthDirection growthDirection) {
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
final SliverPhysicalParentData childParentData = child.parentData! as SliverPhysicalParentData;
|
||||
childParentData.paintOffset = computeAbsolutePaintOffset(child, layoutOffset, growthDirection);
|
||||
}
|
||||
|
||||
@override
|
||||
Offset paintOffsetOf(RenderSliver child) {
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
final SliverPhysicalParentData childParentData = child.parentData! as SliverPhysicalParentData;
|
||||
return childParentData.paintOffset;
|
||||
}
|
||||
|
||||
|
@ -1656,7 +1656,7 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
|
|||
void applyPaintTransform(RenderObject child, Matrix4 transform) {
|
||||
// Hit test logic relies on this always providing an invertible matrix.
|
||||
assert(child != null);
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
final SliverPhysicalParentData childParentData = child.parentData! as SliverPhysicalParentData;
|
||||
childParentData.applyPaintTransform(transform);
|
||||
}
|
||||
|
||||
|
@ -1664,7 +1664,7 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
|
|||
double computeChildMainAxisPosition(RenderSliver child, double parentMainAxisPosition) {
|
||||
assert(child != null);
|
||||
assert(child.constraints != null);
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
final SliverPhysicalParentData childParentData = child.parentData! as SliverPhysicalParentData;
|
||||
switch (applyGrowthDirectionToAxisDirection(child.constraints.axisDirection, child.constraints.growthDirection)) {
|
||||
case AxisDirection.down:
|
||||
return parentMainAxisPosition - childParentData.paintOffset.dy;
|
||||
|
@ -1931,13 +1931,13 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta
|
|||
@override
|
||||
void updateChildLayoutOffset(RenderSliver child, double layoutOffset, GrowthDirection growthDirection) {
|
||||
assert(growthDirection == GrowthDirection.forward);
|
||||
final SliverLogicalParentData childParentData = child.parentData as SliverLogicalParentData;
|
||||
final SliverLogicalParentData childParentData = child.parentData! as SliverLogicalParentData;
|
||||
childParentData.layoutOffset = layoutOffset;
|
||||
}
|
||||
|
||||
@override
|
||||
Offset paintOffsetOf(RenderSliver child) {
|
||||
final SliverLogicalParentData childParentData = child.parentData as SliverLogicalParentData;
|
||||
final SliverLogicalParentData childParentData = child.parentData! as SliverLogicalParentData;
|
||||
return computeAbsolutePaintOffset(child, childParentData.layoutOffset!, GrowthDirection.forward);
|
||||
}
|
||||
|
||||
|
@ -1980,7 +1980,7 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta
|
|||
assert(child != null);
|
||||
assert(child.constraints != null);
|
||||
assert(hasSize);
|
||||
final SliverLogicalParentData childParentData = child.parentData as SliverLogicalParentData;
|
||||
final SliverLogicalParentData childParentData = child.parentData! as SliverLogicalParentData;
|
||||
switch (applyGrowthDirectionToAxisDirection(child.constraints.axisDirection, child.constraints.growthDirection)) {
|
||||
case AxisDirection.down:
|
||||
case AxisDirection.right:
|
||||
|
|
|
@ -630,7 +630,7 @@ class RenderWrap extends RenderBox
|
|||
runMainAxisExtent += spacing;
|
||||
runCrossAxisExtent = math.max(runCrossAxisExtent, childCrossAxisExtent);
|
||||
childCount += 1;
|
||||
final WrapParentData childParentData = child.parentData as WrapParentData;
|
||||
final WrapParentData childParentData = child.parentData! as WrapParentData;
|
||||
childParentData._runIndex = runMetrics.length;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
|
@ -731,7 +731,7 @@ class RenderWrap extends RenderBox
|
|||
crossAxisOffset -= runCrossAxisExtent;
|
||||
|
||||
while (child != null) {
|
||||
final WrapParentData childParentData = child.parentData as WrapParentData;
|
||||
final WrapParentData childParentData = child.parentData! as WrapParentData;
|
||||
if (childParentData._runIndex != i)
|
||||
break;
|
||||
final double childMainAxisExtent = _getMainAxisExtent(child);
|
||||
|
|
|
@ -182,7 +182,7 @@ abstract class CachingAssetBundle extends AssetBundle {
|
|||
assert(key != null);
|
||||
assert(parser != null);
|
||||
if (_structuredDataCache.containsKey(key))
|
||||
return _structuredDataCache[key] as Future<T>;
|
||||
return _structuredDataCache[key]! as Future<T>;
|
||||
Completer<T>? completer;
|
||||
Future<T>? result;
|
||||
loadString(key, cache: false).then<T>(parser).then<void>((T value) {
|
||||
|
|
|
@ -1964,7 +1964,7 @@ class LayoutId extends ParentDataWidget<MultiChildLayoutParentData> {
|
|||
@override
|
||||
void applyParentData(RenderObject renderObject) {
|
||||
assert(renderObject.parentData is MultiChildLayoutParentData);
|
||||
final MultiChildLayoutParentData parentData = renderObject.parentData as MultiChildLayoutParentData;
|
||||
final MultiChildLayoutParentData parentData = renderObject.parentData! as MultiChildLayoutParentData;
|
||||
if (parentData.id != id) {
|
||||
parentData.id = id;
|
||||
final AbstractNode? targetParent = renderObject.parent;
|
||||
|
@ -3654,7 +3654,7 @@ class Positioned extends ParentDataWidget<StackParentData> {
|
|||
@override
|
||||
void applyParentData(RenderObject renderObject) {
|
||||
assert(renderObject.parentData is StackParentData);
|
||||
final StackParentData parentData = renderObject.parentData as StackParentData;
|
||||
final StackParentData parentData = renderObject.parentData! as StackParentData;
|
||||
bool needsLayout = false;
|
||||
|
||||
if (parentData.left != left) {
|
||||
|
@ -4550,7 +4550,7 @@ class Flexible extends ParentDataWidget<FlexParentData> {
|
|||
@override
|
||||
void applyParentData(RenderObject renderObject) {
|
||||
assert(renderObject.parentData is FlexParentData);
|
||||
final FlexParentData parentData = renderObject.parentData as FlexParentData;
|
||||
final FlexParentData parentData = renderObject.parentData! as FlexParentData;
|
||||
bool needsLayout = false;
|
||||
|
||||
if (parentData.flex != flex) {
|
||||
|
|
|
@ -964,7 +964,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
|
|||
container: renderView,
|
||||
debugShortDescription: '[root]',
|
||||
child: rootWidget,
|
||||
).attachToRenderTree(buildOwner!, renderViewElement as RenderObjectToWidgetElement<RenderBox>);
|
||||
).attachToRenderTree(buildOwner!, renderViewElement as RenderObjectToWidgetElement<RenderBox>?);
|
||||
}
|
||||
|
||||
/// Whether the [renderViewElement] has been initialized.
|
||||
|
|
|
@ -57,6 +57,6 @@ class _ColorFilterRenderObject extends RenderProxyBox {
|
|||
|
||||
@override
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
layer = context.pushColorFilter(offset, colorFilter, super.paint, oldLayer: layer as ColorFilterLayer);
|
||||
layer = context.pushColorFilter(offset, colorFilter, super.paint, oldLayer: layer as ColorFilterLayer?);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -379,7 +379,7 @@ class _DraggableState<T extends Object> extends State<Draggable<T>> {
|
|||
Offset dragStartPoint;
|
||||
switch (widget.dragAnchor) {
|
||||
case DragAnchor.child:
|
||||
final RenderBox renderObject = context.findRenderObject() as RenderBox;
|
||||
final RenderBox renderObject = context.findRenderObject()! as RenderBox;
|
||||
dragStartPoint = renderObject.globalToLocal(position);
|
||||
break;
|
||||
case DragAnchor.pointer:
|
||||
|
@ -593,9 +593,9 @@ class _DragTargetState<T extends Object> extends State<DragTarget<T>> {
|
|||
_candidateAvatars.remove(avatar);
|
||||
});
|
||||
if (widget.onAccept != null)
|
||||
widget.onAccept!(avatar.data as T);
|
||||
widget.onAccept!(avatar.data! as T);
|
||||
if (widget.onAcceptWithDetails != null)
|
||||
widget.onAcceptWithDetails!(DragTargetDetails<T>(data: avatar.data as T, offset: avatar._lastOffset!));
|
||||
widget.onAcceptWithDetails!(DragTargetDetails<T>(data: avatar.data! as T, offset: avatar._lastOffset!));
|
||||
}
|
||||
|
||||
void didMove(_DragAvatar<Object> avatar) {
|
||||
|
@ -763,7 +763,7 @@ class _DragAvatar<T extends Object> extends Drag {
|
|||
}
|
||||
|
||||
Widget _build(BuildContext context) {
|
||||
final RenderBox box = overlayState.context.findRenderObject() as RenderBox;
|
||||
final RenderBox box = overlayState.context.findRenderObject()! as RenderBox;
|
||||
final Offset overlayTopLeft = box.localToGlobal(Offset.zero);
|
||||
return Positioned(
|
||||
left: _lastOffset!.dx - overlayTopLeft.dx,
|
||||
|
|
|
@ -453,12 +453,12 @@ class _AnimatedFadeOutFadeInState extends ImplicitlyAnimatedWidgetState<_Animate
|
|||
_targetOpacity,
|
||||
widget.isTargetLoaded ? 1.0 : 0.0,
|
||||
(dynamic value) => Tween<double>(begin: value as double),
|
||||
) as Tween<double>;
|
||||
) as Tween<double>?;
|
||||
_placeholderOpacity = visitor(
|
||||
_placeholderOpacity,
|
||||
widget.isTargetLoaded ? 0.0 : 1.0,
|
||||
(dynamic value) => Tween<double>(begin: value as double),
|
||||
) as Tween<double>;
|
||||
) as Tween<double>?;
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -1745,7 +1745,7 @@ class FocusManager with DiagnosticableTreeMixin, ChangeNotifier {
|
|||
properties.add(FlagProperty('haveScheduledUpdate', value: _haveScheduledUpdate, ifTrue: 'UPDATE SCHEDULED'));
|
||||
properties.add(DiagnosticsProperty<FocusNode>('primaryFocus', primaryFocus, defaultValue: null));
|
||||
properties.add(DiagnosticsProperty<FocusNode>('nextFocus', _markedForFocus, defaultValue: null));
|
||||
final Element element = primaryFocus?.context as Element;
|
||||
final Element? element = primaryFocus?.context as Element?;
|
||||
if (element != null) {
|
||||
properties.add(DiagnosticsProperty<String>('primaryFocusCreator', element.debugGetCreatorChain(20)));
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ abstract class GlobalKey<T extends State<StatefulWidget>> extends Key {
|
|||
assert(element != null);
|
||||
assert(element.widget != null);
|
||||
assert(element.widget.key != null);
|
||||
final GlobalKey key = element.widget.key as GlobalKey;
|
||||
final GlobalKey key = element.widget.key! as GlobalKey;
|
||||
assert(_registry.containsKey(key));
|
||||
duplicates ??= <GlobalKey, Set<Element>>{};
|
||||
// Uses ordered set to produce consistent error message.
|
||||
|
@ -5433,8 +5433,8 @@ abstract class RenderObjectElement extends Element {
|
|||
|
||||
/// The underlying [RenderObject] for this element.
|
||||
@override
|
||||
RenderObject? get renderObject => _renderObject;
|
||||
RenderObject? _renderObject;
|
||||
RenderObject get renderObject => _renderObject;
|
||||
late RenderObject _renderObject;
|
||||
|
||||
bool _debugDoingBuild = false;
|
||||
@override
|
||||
|
@ -5442,11 +5442,11 @@ abstract class RenderObjectElement extends Element {
|
|||
|
||||
RenderObjectElement? _ancestorRenderObjectElement;
|
||||
|
||||
RenderObjectElement _findAncestorRenderObjectElement() {
|
||||
RenderObjectElement? _findAncestorRenderObjectElement() {
|
||||
Element? ancestor = _parent;
|
||||
while (ancestor != null && ancestor is! RenderObjectElement)
|
||||
ancestor = ancestor._parent;
|
||||
return ancestor as RenderObjectElement;
|
||||
return ancestor as RenderObjectElement?;
|
||||
}
|
||||
|
||||
ParentDataElement<ParentData>? _findAncestorParentDataElement() {
|
||||
|
@ -5468,7 +5468,7 @@ abstract class RenderObjectElement extends Element {
|
|||
ancestor = ancestor!._parent;
|
||||
while (ancestor != null && ancestor is! RenderObjectElement) {
|
||||
if (ancestor is ParentDataElement<ParentData>) {
|
||||
badAncestors.add(ancestor as ParentDataElement<ParentData>);
|
||||
badAncestors.add(ancestor! as ParentDataElement<ParentData>);
|
||||
}
|
||||
ancestor = ancestor!._parent;
|
||||
}
|
||||
|
@ -5526,7 +5526,7 @@ abstract class RenderObjectElement extends Element {
|
|||
_debugDoingBuild = true;
|
||||
return true;
|
||||
}());
|
||||
widget.updateRenderObject(this, renderObject!);
|
||||
widget.updateRenderObject(this, renderObject);
|
||||
assert(() {
|
||||
_debugDoingBuild = false;
|
||||
return true;
|
||||
|
@ -5536,7 +5536,7 @@ abstract class RenderObjectElement extends Element {
|
|||
|
||||
void _debugUpdateRenderObjectOwner() {
|
||||
assert(() {
|
||||
_renderObject!.debugCreator = DebugCreator(this);
|
||||
_renderObject.debugCreator = DebugCreator(this);
|
||||
return true;
|
||||
}());
|
||||
}
|
||||
|
@ -5547,7 +5547,7 @@ abstract class RenderObjectElement extends Element {
|
|||
_debugDoingBuild = true;
|
||||
return true;
|
||||
}());
|
||||
widget.updateRenderObject(this, renderObject!);
|
||||
widget.updateRenderObject(this, renderObject);
|
||||
assert(() {
|
||||
_debugDoingBuild = false;
|
||||
return true;
|
||||
|
@ -5759,7 +5759,7 @@ abstract class RenderObjectElement extends Element {
|
|||
@override
|
||||
void deactivate() {
|
||||
super.deactivate();
|
||||
assert(!renderObject!.attached,
|
||||
assert(!renderObject.attached,
|
||||
'A RenderObject was still attached when attempting to deactivate its '
|
||||
'RenderObjectElement: $renderObject');
|
||||
}
|
||||
|
@ -5767,22 +5767,22 @@ abstract class RenderObjectElement extends Element {
|
|||
@override
|
||||
void unmount() {
|
||||
super.unmount();
|
||||
assert(!renderObject!.attached,
|
||||
assert(!renderObject.attached,
|
||||
'A RenderObject was still attached when attempting to unmount its '
|
||||
'RenderObjectElement: $renderObject');
|
||||
widget.didUnmountRenderObject(renderObject!);
|
||||
widget.didUnmountRenderObject(renderObject);
|
||||
}
|
||||
|
||||
void _updateParentData(ParentDataWidget<ParentData> parentDataWidget) {
|
||||
bool applyParentData = true;
|
||||
assert(() {
|
||||
try {
|
||||
if (!parentDataWidget.debugIsValidRenderObject(renderObject!)) {
|
||||
if (!parentDataWidget.debugIsValidRenderObject(renderObject)) {
|
||||
applyParentData = false;
|
||||
throw FlutterError.fromParts(<DiagnosticsNode>[
|
||||
ErrorSummary('Incorrect use of ParentDataWidget.'),
|
||||
...parentDataWidget._debugDescribeIncorrectParentDataType(
|
||||
parentData: renderObject!.parentData,
|
||||
parentData: renderObject.parentData,
|
||||
parentDataCreator: _ancestorRenderObjectElement!.widget,
|
||||
ownershipChain: ErrorDescription(debugGetCreatorChain(10)),
|
||||
),
|
||||
|
@ -5797,7 +5797,7 @@ abstract class RenderObjectElement extends Element {
|
|||
return true;
|
||||
}());
|
||||
if (applyParentData)
|
||||
parentDataWidget.applyParentData(renderObject!);
|
||||
parentDataWidget.applyParentData(renderObject);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -5806,7 +5806,7 @@ abstract class RenderObjectElement extends Element {
|
|||
assert(oldSlot != newSlot);
|
||||
super._updateSlot(newSlot);
|
||||
assert(slot == newSlot);
|
||||
_ancestorRenderObjectElement!.moveRenderObjectChild(renderObject!, oldSlot, slot);
|
||||
_ancestorRenderObjectElement!.moveRenderObjectChild(renderObject, oldSlot, slot);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -5814,7 +5814,7 @@ abstract class RenderObjectElement extends Element {
|
|||
assert(_ancestorRenderObjectElement == null);
|
||||
_slot = newSlot;
|
||||
_ancestorRenderObjectElement = _findAncestorRenderObjectElement();
|
||||
_ancestorRenderObjectElement?.insertRenderObjectChild(renderObject!, newSlot);
|
||||
_ancestorRenderObjectElement?.insertRenderObjectChild(renderObject, newSlot);
|
||||
final ParentDataElement<ParentData>? parentDataElement = _findAncestorParentDataElement();
|
||||
if (parentDataElement != null)
|
||||
_updateParentData(parentDataElement.widget);
|
||||
|
@ -5823,7 +5823,7 @@ abstract class RenderObjectElement extends Element {
|
|||
@override
|
||||
void detachRenderObject() {
|
||||
if (_ancestorRenderObjectElement != null) {
|
||||
_ancestorRenderObjectElement!.removeRenderObjectChild(renderObject!, slot);
|
||||
_ancestorRenderObjectElement!.removeRenderObjectChild(renderObject, slot);
|
||||
_ancestorRenderObjectElement = null;
|
||||
}
|
||||
_slot = null;
|
||||
|
|
|
@ -1130,14 +1130,14 @@ class RawGestureDetectorState extends State<RawGestureDetector> {
|
|||
'To set the gesture recognizers at other times, trigger a new build using setState() '
|
||||
'and provide the new gesture recognizers as constructor arguments to the corresponding '
|
||||
'RawGestureDetector or GestureDetector object.'
|
||||
)
|
||||
),
|
||||
]);
|
||||
}
|
||||
return true;
|
||||
}());
|
||||
_syncAll(gestures);
|
||||
if (!widget.excludeFromSemantics) {
|
||||
final RenderSemanticsGestureHandler semanticsGestureHandler = context.findRenderObject() as RenderSemanticsGestureHandler;
|
||||
final RenderSemanticsGestureHandler semanticsGestureHandler = context.findRenderObject()! as RenderSemanticsGestureHandler;
|
||||
_updateSemanticsForRenderObject(semanticsGestureHandler);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ enum HeroFlightDirection {
|
|||
// The bounding box for context in ancestorContext coordinate system, or in the global
|
||||
// coordinate system when null.
|
||||
Rect _boundingBoxFor(BuildContext context, [BuildContext? ancestorContext]) {
|
||||
final RenderBox box = context.findRenderObject() as RenderBox;
|
||||
final RenderBox box = context.findRenderObject()! as RenderBox;
|
||||
assert(box != null && box.hasSize);
|
||||
return MatrixUtils.transformRect(
|
||||
box.getTransformTo(ancestorContext?.findRenderObject()),
|
||||
|
@ -345,7 +345,7 @@ class _HeroState extends State<Hero> {
|
|||
void startFlight({ bool shouldIncludedChildInPlaceholder = false }) {
|
||||
_shouldIncludeChild = shouldIncludedChildInPlaceholder;
|
||||
assert(mounted);
|
||||
final RenderBox box = context.findRenderObject() as RenderBox;
|
||||
final RenderBox box = context.findRenderObject()! as RenderBox;
|
||||
assert(box != null && box.hasSize);
|
||||
setState(() {
|
||||
_placeholderSize = box.size;
|
||||
|
@ -504,7 +504,7 @@ class _HeroFlight {
|
|||
} else if (toHeroBox.hasSize) {
|
||||
// The toHero has been laid out. If it's no longer where the hero animation is
|
||||
// supposed to end up then recreate the heroRect tween.
|
||||
final RenderBox finalRouteBox = manifest!.toRoute.subtreeContext?.findRenderObject() as RenderBox;
|
||||
final RenderBox? finalRouteBox = manifest!.toRoute.subtreeContext?.findRenderObject() as RenderBox?;
|
||||
final Offset toHeroOrigin = toHeroBox.localToGlobal(Offset.zero, ancestor: finalRouteBox);
|
||||
if (toHeroOrigin != heroRectTween.end!.topLeft) {
|
||||
final Rect heroRectEnd = toHeroOrigin & heroRectTween.end!.size;
|
||||
|
|
|
@ -68,7 +68,7 @@ class _ImageFilterRenderObject extends RenderProxyBox {
|
|||
if (layer == null) {
|
||||
layer = ImageFilterLayer(imageFilter: imageFilter);
|
||||
} else {
|
||||
final ImageFilterLayer filterLayer = layer as ImageFilterLayer;
|
||||
final ImageFilterLayer filterLayer = layer! as ImageFilterLayer;
|
||||
filterLayer.imageFilter = imageFilter;
|
||||
}
|
||||
context.pushLayer(layer!, super.paint, offset);
|
||||
|
|
|
@ -736,13 +736,13 @@ class _AnimatedContainerState extends AnimatedWidgetBaseState<AnimatedContainer>
|
|||
|
||||
@override
|
||||
void forEachTween(TweenVisitor<dynamic> visitor) {
|
||||
_alignment = visitor(_alignment, widget.alignment, (dynamic value) => AlignmentGeometryTween(begin: value as AlignmentGeometry)) as AlignmentGeometryTween;
|
||||
_padding = visitor(_padding, widget.padding, (dynamic value) => EdgeInsetsGeometryTween(begin: value as EdgeInsetsGeometry)) as EdgeInsetsGeometryTween;
|
||||
_decoration = visitor(_decoration, widget.decoration, (dynamic value) => DecorationTween(begin: value as Decoration)) as DecorationTween;
|
||||
_foregroundDecoration = visitor(_foregroundDecoration, widget.foregroundDecoration, (dynamic value) => DecorationTween(begin: value as Decoration)) as DecorationTween;
|
||||
_constraints = visitor(_constraints, widget.constraints, (dynamic value) => BoxConstraintsTween(begin: value as BoxConstraints)) as BoxConstraintsTween;
|
||||
_margin = visitor(_margin, widget.margin, (dynamic value) => EdgeInsetsGeometryTween(begin: value as EdgeInsetsGeometry)) as EdgeInsetsGeometryTween;
|
||||
_transform = visitor(_transform, widget.transform, (dynamic value) => Matrix4Tween(begin: value as Matrix4)) as Matrix4Tween;
|
||||
_alignment = visitor(_alignment, widget.alignment, (dynamic value) => AlignmentGeometryTween(begin: value as AlignmentGeometry)) as AlignmentGeometryTween?;
|
||||
_padding = visitor(_padding, widget.padding, (dynamic value) => EdgeInsetsGeometryTween(begin: value as EdgeInsetsGeometry)) as EdgeInsetsGeometryTween?;
|
||||
_decoration = visitor(_decoration, widget.decoration, (dynamic value) => DecorationTween(begin: value as Decoration)) as DecorationTween?;
|
||||
_foregroundDecoration = visitor(_foregroundDecoration, widget.foregroundDecoration, (dynamic value) => DecorationTween(begin: value as Decoration)) as DecorationTween?;
|
||||
_constraints = visitor(_constraints, widget.constraints, (dynamic value) => BoxConstraintsTween(begin: value as BoxConstraints)) as BoxConstraintsTween?;
|
||||
_margin = visitor(_margin, widget.margin, (dynamic value) => EdgeInsetsGeometryTween(begin: value as EdgeInsetsGeometry)) as EdgeInsetsGeometryTween?;
|
||||
_transform = visitor(_transform, widget.transform, (dynamic value) => Matrix4Tween(begin: value as Matrix4)) as Matrix4Tween?;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -826,7 +826,7 @@ class _AnimatedPaddingState extends AnimatedWidgetBaseState<AnimatedPadding> {
|
|||
|
||||
@override
|
||||
void forEachTween(TweenVisitor<dynamic> visitor) {
|
||||
_padding = visitor(_padding, widget.padding, (dynamic value) => EdgeInsetsGeometryTween(begin: value as EdgeInsetsGeometry)) as EdgeInsetsGeometryTween;
|
||||
_padding = visitor(_padding, widget.padding, (dynamic value) => EdgeInsetsGeometryTween(begin: value as EdgeInsetsGeometry)) as EdgeInsetsGeometryTween?;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -972,12 +972,12 @@ class _AnimatedAlignState extends AnimatedWidgetBaseState<AnimatedAlign> {
|
|||
|
||||
@override
|
||||
void forEachTween(TweenVisitor<dynamic> visitor) {
|
||||
_alignment = visitor(_alignment, widget.alignment, (dynamic value) => AlignmentGeometryTween(begin: value as AlignmentGeometry)) as AlignmentGeometryTween;
|
||||
_alignment = visitor(_alignment, widget.alignment, (dynamic value) => AlignmentGeometryTween(begin: value as AlignmentGeometry)) as AlignmentGeometryTween?;
|
||||
if(widget.heightFactor != null) {
|
||||
_heightFactorTween = visitor(_heightFactorTween, widget.heightFactor, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>;
|
||||
_heightFactorTween = visitor(_heightFactorTween, widget.heightFactor, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
|
||||
}
|
||||
if(widget.widthFactor != null) {
|
||||
_widthFactorTween = visitor(_widthFactorTween, widget.widthFactor, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>;
|
||||
_widthFactorTween = visitor(_widthFactorTween, widget.widthFactor, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1128,12 +1128,12 @@ class _AnimatedPositionedState extends AnimatedWidgetBaseState<AnimatedPositione
|
|||
|
||||
@override
|
||||
void forEachTween(TweenVisitor<dynamic> visitor) {
|
||||
_left = visitor(_left, widget.left, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>;
|
||||
_top = visitor(_top, widget.top, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>;
|
||||
_right = visitor(_right, widget.right, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>;
|
||||
_bottom = visitor(_bottom, widget.bottom, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>;
|
||||
_width = visitor(_width, widget.width, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>;
|
||||
_height = visitor(_height, widget.height, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>;
|
||||
_left = visitor(_left, widget.left, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
|
||||
_top = visitor(_top, widget.top, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
|
||||
_right = visitor(_right, widget.right, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
|
||||
_bottom = visitor(_bottom, widget.bottom, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
|
||||
_width = visitor(_width, widget.width, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
|
||||
_height = visitor(_height, widget.height, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -1263,12 +1263,12 @@ class _AnimatedPositionedDirectionalState extends AnimatedWidgetBaseState<Animat
|
|||
|
||||
@override
|
||||
void forEachTween(TweenVisitor<dynamic> visitor) {
|
||||
_start = visitor(_start, widget.start, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>;
|
||||
_top = visitor(_top, widget.top, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>;
|
||||
_end = visitor(_end, widget.end, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>;
|
||||
_bottom = visitor(_bottom, widget.bottom, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>;
|
||||
_width = visitor(_width, widget.width, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>;
|
||||
_height = visitor(_height, widget.height, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>;
|
||||
_start = visitor(_start, widget.start, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
|
||||
_top = visitor(_top, widget.top, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
|
||||
_end = visitor(_end, widget.end, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
|
||||
_bottom = visitor(_bottom, widget.bottom, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
|
||||
_width = visitor(_width, widget.width, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
|
||||
_height = visitor(_height, widget.height, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -1409,7 +1409,7 @@ class _AnimatedOpacityState extends ImplicitlyAnimatedWidgetState<AnimatedOpacit
|
|||
|
||||
@override
|
||||
void forEachTween(TweenVisitor<dynamic> visitor) {
|
||||
_opacity = visitor(_opacity, widget.opacity, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>;
|
||||
_opacity = visitor(_opacity, widget.opacity, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -1542,7 +1542,7 @@ class _SliverAnimatedOpacityState extends ImplicitlyAnimatedWidgetState<SliverAn
|
|||
|
||||
@override
|
||||
void forEachTween(TweenVisitor<dynamic> visitor) {
|
||||
_opacity = visitor(_opacity, widget.opacity, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>;
|
||||
_opacity = visitor(_opacity, widget.opacity, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -1671,7 +1671,7 @@ class _AnimatedDefaultTextStyleState extends AnimatedWidgetBaseState<AnimatedDef
|
|||
|
||||
@override
|
||||
void forEachTween(TweenVisitor<dynamic> visitor) {
|
||||
_style = visitor(_style, widget.style, (dynamic value) => TextStyleTween(begin: value as TextStyle)) as TextStyleTween;
|
||||
_style = visitor(_style, widget.style, (dynamic value) => TextStyleTween(begin: value as TextStyle)) as TextStyleTween?;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -1798,10 +1798,10 @@ class _AnimatedPhysicalModelState extends AnimatedWidgetBaseState<AnimatedPhysic
|
|||
|
||||
@override
|
||||
void forEachTween(TweenVisitor<dynamic> visitor) {
|
||||
_borderRadius = visitor(_borderRadius, widget.borderRadius, (dynamic value) => BorderRadiusTween(begin: value as BorderRadius)) as BorderRadiusTween;
|
||||
_elevation = visitor(_elevation, widget.elevation, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>;
|
||||
_color = visitor(_color, widget.color, (dynamic value) => ColorTween(begin: value as Color)) as ColorTween;
|
||||
_shadowColor = visitor(_shadowColor, widget.shadowColor, (dynamic value) => ColorTween(begin: value as Color)) as ColorTween;
|
||||
_borderRadius = visitor(_borderRadius, widget.borderRadius, (dynamic value) => BorderRadiusTween(begin: value as BorderRadius)) as BorderRadiusTween?;
|
||||
_elevation = visitor(_elevation, widget.elevation, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
|
||||
_color = visitor(_color, widget.color, (dynamic value) => ColorTween(begin: value as Color)) as ColorTween?;
|
||||
_shadowColor = visitor(_shadowColor, widget.shadowColor, (dynamic value) => ColorTween(begin: value as Color)) as ColorTween?;
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -543,7 +543,7 @@ class _InteractiveViewerState extends State<InteractiveViewer> with TickerProvid
|
|||
assert(!widget.boundaryMargin.top.isNaN);
|
||||
assert(!widget.boundaryMargin.bottom.isNaN);
|
||||
|
||||
final RenderBox childRenderBox = _childKey.currentContext!.findRenderObject() as RenderBox;
|
||||
final RenderBox childRenderBox = _childKey.currentContext!.findRenderObject()! as RenderBox;
|
||||
final Size childSize = childRenderBox.size;
|
||||
final Rect boundaryRect = widget.boundaryMargin.inflateRect(Offset.zero & childSize);
|
||||
// Boundaries that are partially infinite are not allowed because Matrix4's
|
||||
|
@ -559,7 +559,7 @@ class _InteractiveViewerState extends State<InteractiveViewer> with TickerProvid
|
|||
// The Rect representing the child's parent.
|
||||
Rect get _viewport {
|
||||
assert(_parentKey.currentContext != null);
|
||||
final RenderBox parentRenderBox = _parentKey.currentContext!.findRenderObject() as RenderBox;
|
||||
final RenderBox parentRenderBox = _parentKey.currentContext!.findRenderObject()! as RenderBox;
|
||||
return Offset.zero & parentRenderBox.size;
|
||||
}
|
||||
|
||||
|
@ -910,7 +910,7 @@ class _InteractiveViewerState extends State<InteractiveViewer> with TickerProvid
|
|||
widget.onInteractionEnd?.call(ScaleEndDetails());
|
||||
return;
|
||||
}
|
||||
final RenderBox childRenderBox = _childKey.currentContext!.findRenderObject() as RenderBox;
|
||||
final RenderBox childRenderBox = _childKey.currentContext!.findRenderObject()! as RenderBox;
|
||||
final Size childSize = childRenderBox.size;
|
||||
final double scaleChange = 1.0 - event.scrollDelta.dy / childSize.height;
|
||||
if (scaleChange == 0.0) {
|
||||
|
|
|
@ -730,7 +730,7 @@ class _ListWheelScrollViewState extends State<ListWheelScrollView> {
|
|||
super.initState();
|
||||
scrollController = widget.controller ?? FixedExtentScrollController();
|
||||
if (widget.controller is FixedExtentScrollController) {
|
||||
final FixedExtentScrollController controller = widget.controller as FixedExtentScrollController;
|
||||
final FixedExtentScrollController controller = widget.controller! as FixedExtentScrollController;
|
||||
_lastReportedItemIndex = controller.initialItem;
|
||||
}
|
||||
}
|
||||
|
@ -907,7 +907,7 @@ class ListWheelElement extends RenderObjectElement implements ListWheelChildMana
|
|||
void insertRenderObjectChild(RenderObject child, int slot) {
|
||||
final RenderListWheelViewport renderObject = this.renderObject;
|
||||
assert(renderObject.debugValidateChild(child));
|
||||
renderObject.insert(child as RenderBox, after: _childElements[slot - 1]?.renderObject as RenderBox);
|
||||
renderObject.insert(child as RenderBox, after: _childElements[slot - 1]?.renderObject as RenderBox?);
|
||||
assert(renderObject == this.renderObject);
|
||||
}
|
||||
|
||||
|
|
|
@ -3423,7 +3423,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
|
|||
}
|
||||
return true;
|
||||
}());
|
||||
route = widget.onUnknownRoute!(settings) as Route<T>;
|
||||
route = widget.onUnknownRoute!(settings) as Route<T>?;
|
||||
assert(() {
|
||||
if (route == null) {
|
||||
throw FlutterError.fromParts(<DiagnosticsNode>[
|
||||
|
|
|
@ -466,7 +466,7 @@ class _RenderOverflowBar extends RenderBox
|
|||
RenderBox? nextChild() => overflowDirection == VerticalDirection.down ? childAfter(child!) : childBefore(child!);
|
||||
double y = 0;
|
||||
while (child != null) {
|
||||
final _OverflowBarParentData childParentData = child.parentData as _OverflowBarParentData;
|
||||
final _OverflowBarParentData childParentData = child.parentData! as _OverflowBarParentData;
|
||||
double x = 0;
|
||||
switch (overflowAlignment) {
|
||||
case OverflowBarAlignment.start:
|
||||
|
@ -491,7 +491,7 @@ class _RenderOverflowBar extends RenderBox
|
|||
RenderBox? nextChild() => rtl ? childBefore(child!) : childAfter(child!);
|
||||
double x = 0;
|
||||
while (child != null) {
|
||||
final _OverflowBarParentData childParentData = child.parentData as _OverflowBarParentData;
|
||||
final _OverflowBarParentData childParentData = child.parentData! as _OverflowBarParentData;
|
||||
childParentData.offset = Offset(x, (maxChildHeight - child.size.height) / 2);
|
||||
x += child.size.width + spacing;
|
||||
child = nextChild();
|
||||
|
|
|
@ -630,7 +630,7 @@ class _RenderTheatre extends RenderBox with ContainerRenderObjectMixin<RenderBox
|
|||
}
|
||||
RenderBox? child = super.firstChild;
|
||||
for (int toSkip = skipCount; toSkip > 0; toSkip--) {
|
||||
final StackParentData childParentData = child!.parentData as StackParentData;
|
||||
final StackParentData childParentData = child!.parentData! as StackParentData;
|
||||
child = childParentData.nextSibling;
|
||||
assert(child != null);
|
||||
}
|
||||
|
@ -668,7 +668,7 @@ class _RenderTheatre extends RenderBox with ContainerRenderObjectMixin<RenderBox
|
|||
RenderBox? child = _firstOnstageChild;
|
||||
while (child != null) {
|
||||
assert(!child.debugNeedsLayout);
|
||||
final StackParentData childParentData = child.parentData as StackParentData;
|
||||
final StackParentData childParentData = child.parentData! as StackParentData;
|
||||
double? candidate = child.getDistanceToActualBaseline(baseline);
|
||||
if (candidate != null) {
|
||||
candidate += childParentData.offset.dy;
|
||||
|
@ -708,7 +708,7 @@ class _RenderTheatre extends RenderBox with ContainerRenderObjectMixin<RenderBox
|
|||
|
||||
RenderBox? child = _firstOnstageChild;
|
||||
while (child != null) {
|
||||
final StackParentData childParentData = child.parentData as StackParentData;
|
||||
final StackParentData childParentData = child.parentData! as StackParentData;
|
||||
|
||||
if (!childParentData.isPositioned) {
|
||||
child.layout(nonPositionedConstraints, parentUsesSize: true);
|
||||
|
@ -727,7 +727,7 @@ class _RenderTheatre extends RenderBox with ContainerRenderObjectMixin<RenderBox
|
|||
RenderBox? child = _lastOnstageChild;
|
||||
for (int i = 0; i < _onstageChildCount; i++) {
|
||||
assert(child != null);
|
||||
final StackParentData childParentData = child!.parentData as StackParentData;
|
||||
final StackParentData childParentData = child!.parentData! as StackParentData;
|
||||
final bool isHit = result.addWithPaintOffset(
|
||||
offset: childParentData.offset,
|
||||
position: position,
|
||||
|
@ -747,7 +747,7 @@ class _RenderTheatre extends RenderBox with ContainerRenderObjectMixin<RenderBox
|
|||
void paintStack(PaintingContext context, Offset offset) {
|
||||
RenderBox? child = _firstOnstageChild;
|
||||
while (child != null) {
|
||||
final StackParentData childParentData = child.parentData as StackParentData;
|
||||
final StackParentData childParentData = child.parentData! as StackParentData;
|
||||
context.paintChild(child, childParentData.offset + offset);
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
|
@ -767,7 +767,7 @@ class _RenderTheatre extends RenderBox with ContainerRenderObjectMixin<RenderBox
|
|||
RenderBox? child = _firstOnstageChild;
|
||||
while (child != null) {
|
||||
visitor(child);
|
||||
final StackParentData childParentData = child.parentData as StackParentData;
|
||||
final StackParentData childParentData = child.parentData! as StackParentData;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
}
|
||||
|
@ -812,7 +812,7 @@ class _RenderTheatre extends RenderBox with ContainerRenderObjectMixin<RenderBox
|
|||
);
|
||||
}
|
||||
|
||||
final StackParentData childParentData = child.parentData as StackParentData;
|
||||
final StackParentData childParentData = child.parentData! as StackParentData;
|
||||
child = childParentData.nextSibling;
|
||||
count += 1;
|
||||
}
|
||||
|
|
|
@ -289,7 +289,7 @@ class _GlowingOverscrollIndicatorState extends State<GlowingOverscrollIndicator>
|
|||
assert(notification.overscroll != 0.0);
|
||||
if (notification.dragDetails != null) {
|
||||
assert(notification.dragDetails!.globalPosition != null);
|
||||
final RenderBox renderer = notification.context!.findRenderObject() as RenderBox;
|
||||
final RenderBox renderer = notification.context!.findRenderObject()! as RenderBox;
|
||||
assert(renderer != null);
|
||||
assert(renderer.hasSize);
|
||||
final Size size = renderer.size;
|
||||
|
|
|
@ -273,7 +273,7 @@ abstract class RestorableListenable<T extends Listenable> extends RestorableProp
|
|||
/// [RestorationMixin.registerForRestoration].
|
||||
T get value {
|
||||
assert(isRegistered);
|
||||
return _value as T;
|
||||
return _value!;
|
||||
}
|
||||
T? _value;
|
||||
|
||||
|
|
|
@ -549,7 +549,7 @@ class ScrollableState extends State<Scrollable> with TickerProviderStateMixin, R
|
|||
return;
|
||||
_shouldIgnorePointer = value;
|
||||
if (_ignorePointerKey.currentContext != null) {
|
||||
final RenderIgnorePointer renderBox = _ignorePointerKey.currentContext!.findRenderObject() as RenderIgnorePointer;
|
||||
final RenderIgnorePointer renderBox = _ignorePointerKey.currentContext!.findRenderObject()! as RenderIgnorePointer;
|
||||
renderBox.ignoring = _shouldIgnorePointer;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1077,14 +1077,14 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
|
|||
final Element? newChild = updateChild(newChildren[index], _build(index), index);
|
||||
if (newChild != null) {
|
||||
_childElements[index] = newChild;
|
||||
final SliverMultiBoxAdaptorParentData parentData = newChild.renderObject!.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData parentData = newChild.renderObject!.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
if (index == 0) {
|
||||
parentData.layoutOffset = 0.0;
|
||||
} else if (indexToLayoutOffset.containsKey(index)) {
|
||||
parentData.layoutOffset = indexToLayoutOffset[index];
|
||||
}
|
||||
if (!parentData.keptAlive)
|
||||
_currentBeforeChild = newChild.renderObject as RenderBox;
|
||||
_currentBeforeChild = newChild.renderObject as RenderBox?;
|
||||
} else {
|
||||
_childElements.remove(index);
|
||||
}
|
||||
|
@ -1313,7 +1313,7 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
|
|||
@override
|
||||
void didAdoptChild(RenderBox child) {
|
||||
assert(_currentlyUpdatingChildIndex != null);
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
childParentData.index = _currentlyUpdatingChildIndex;
|
||||
}
|
||||
|
||||
|
@ -1331,7 +1331,7 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
|
|||
assert(renderObject.debugValidateChild(child));
|
||||
renderObject.insert(child as RenderBox, after: _currentBeforeChild);
|
||||
assert(() {
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
assert(slot == childParentData.index);
|
||||
return true;
|
||||
}());
|
||||
|
@ -1361,7 +1361,7 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
|
|||
@override
|
||||
void debugVisitOnstageChildren(ElementVisitor visitor) {
|
||||
_childElements.values.cast<Element>().where((Element child) {
|
||||
final SliverMultiBoxAdaptorParentData parentData = child.renderObject!.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData parentData = child.renderObject!.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
double itemExtent;
|
||||
switch (renderObject.constraints.axis) {
|
||||
case Axis.horizontal:
|
||||
|
@ -1639,7 +1639,7 @@ class KeepAlive extends ParentDataWidget<KeepAliveParentDataMixin> {
|
|||
@override
|
||||
void applyParentData(RenderObject renderObject) {
|
||||
assert(renderObject.parentData is KeepAliveParentDataMixin);
|
||||
final KeepAliveParentDataMixin parentData = renderObject.parentData as KeepAliveParentDataMixin;
|
||||
final KeepAliveParentDataMixin parentData = renderObject.parentData! as KeepAliveParentDataMixin;
|
||||
if (parentData.keepAlive != keepAlive) {
|
||||
parentData.keepAlive = keepAlive;
|
||||
final AbstractNode? targetParent = renderObject.parent;
|
||||
|
|
|
@ -313,7 +313,7 @@ class _TableElement extends RenderObjectElement {
|
|||
|
||||
@override
|
||||
void removeRenderObjectChild(RenderObject child, IndexedSlot<Element>? slot) {
|
||||
final TableCellParentData childParentData = child.parentData as TableCellParentData;
|
||||
final TableCellParentData childParentData = child.parentData! as TableCellParentData;
|
||||
renderObject.setChild(childParentData.x!, childParentData.y!, null);
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ class _TableElement extends RenderObjectElement {
|
|||
_children.isNotEmpty ? _children[0].children.length : 0,
|
||||
_children.expand<RenderBox>((_TableElementRow row) {
|
||||
return row.children.map<RenderBox>((Element child) {
|
||||
final RenderBox box = child.renderObject as RenderBox;
|
||||
final RenderBox box = child.renderObject! as RenderBox;
|
||||
return box;
|
||||
});
|
||||
}).toList(),
|
||||
|
@ -405,7 +405,7 @@ class TableCell extends ParentDataWidget<TableCellParentData> {
|
|||
|
||||
@override
|
||||
void applyParentData(RenderObject renderObject) {
|
||||
final TableCellParentData parentData = renderObject.parentData as TableCellParentData;
|
||||
final TableCellParentData parentData = renderObject.parentData! as TableCellParentData;
|
||||
if (parentData.verticalAlignment != verticalAlignment) {
|
||||
parentData.verticalAlignment = verticalAlignment;
|
||||
final AbstractNode? targetParent = renderObject.parent;
|
||||
|
|
|
@ -34,7 +34,7 @@ abstract class UniqueWidget<T extends State<StatefulWidget>> extends StatefulWid
|
|||
///
|
||||
/// Might be null if the widget is not currently in the tree.
|
||||
T? get currentState {
|
||||
final GlobalKey<T> globalKey = key as GlobalKey<T>;
|
||||
final GlobalKey<T> globalKey = key! as GlobalKey<T>;
|
||||
return globalKey.currentState;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -234,9 +234,9 @@ class _ViewportElement extends MultiChildRenderObjectElement {
|
|||
if (widget.center != null) {
|
||||
renderObject.center = children.singleWhere(
|
||||
(Element element) => element.widget.key == widget.center
|
||||
).renderObject as RenderSliver;
|
||||
).renderObject as RenderSliver?;
|
||||
} else if (children.isNotEmpty) {
|
||||
renderObject.center = children.first.renderObject as RenderSliver;
|
||||
renderObject.center = children.first.renderObject as RenderSliver?;
|
||||
} else {
|
||||
renderObject.center = null;
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ class _ViewportElement extends MultiChildRenderObjectElement {
|
|||
@override
|
||||
void debugVisitOnstageChildren(ElementVisitor visitor) {
|
||||
children.where((Element e) {
|
||||
final RenderSliver renderSliver = e.renderObject as RenderSliver;
|
||||
final RenderSliver renderSliver = e.renderObject! as RenderSliver;
|
||||
return renderSliver.geometry!.visible;
|
||||
}).forEach(visitor);
|
||||
}
|
||||
|
|
|
@ -544,7 +544,7 @@ class _ScreenshotPaintingContext extends PaintingContext {
|
|||
}) {
|
||||
RenderObject repaintBoundary = renderObject;
|
||||
while (repaintBoundary != null && !repaintBoundary.isRepaintBoundary) {
|
||||
repaintBoundary = repaintBoundary.parent as RenderObject;
|
||||
repaintBoundary = repaintBoundary.parent! as RenderObject;
|
||||
}
|
||||
assert(repaintBoundary != null);
|
||||
final _ScreenshotData data = _ScreenshotData(target: renderObject);
|
||||
|
@ -560,7 +560,7 @@ class _ScreenshotPaintingContext extends PaintingContext {
|
|||
// want to capture debugPaint information as well.
|
||||
data.containerLayer.append(_ProxyLayer(repaintBoundary.debugLayer!));
|
||||
data.foundTarget = true;
|
||||
final OffsetLayer offsetLayer = repaintBoundary.debugLayer as OffsetLayer;
|
||||
final OffsetLayer offsetLayer = repaintBoundary.debugLayer! as OffsetLayer;
|
||||
data.screenshotOffset = offsetLayer.offset;
|
||||
} else {
|
||||
// Repaint everything under the repaint boundary.
|
||||
|
@ -1357,7 +1357,7 @@ mixin WidgetInspectorService {
|
|||
if (object == selection.current) {
|
||||
return false;
|
||||
}
|
||||
selection.current = object as RenderObject;
|
||||
selection.current = object! as RenderObject;
|
||||
developer.inspect(selection.current);
|
||||
}
|
||||
if (selectionChangedCallback != null) {
|
||||
|
@ -2191,7 +2191,7 @@ class _WidgetInspectorState extends State<WidgetInspector>
|
|||
if (diagnostics.style == DiagnosticsTreeStyle.offstage ||
|
||||
diagnostics.value is! RenderObject)
|
||||
continue;
|
||||
final RenderObject child = diagnostics.value as RenderObject;
|
||||
final RenderObject child = diagnostics.value! as RenderObject;
|
||||
final Rect? paintClip = object.describeApproximatePaintClip(child);
|
||||
if (paintClip != null && !paintClip.contains(localPosition))
|
||||
continue;
|
||||
|
@ -2245,7 +2245,7 @@ class _WidgetInspectorState extends State<WidgetInspector>
|
|||
if (!isSelectMode)
|
||||
return;
|
||||
|
||||
final RenderIgnorePointer ignorePointer = _ignorePointerKey.currentContext!.findRenderObject() as RenderIgnorePointer;
|
||||
final RenderIgnorePointer ignorePointer = _ignorePointerKey.currentContext!.findRenderObject()! as RenderIgnorePointer;
|
||||
final RenderObject userRender = ignorePointer.child!;
|
||||
final List<RenderObject> selected = hitTest(position, userRender);
|
||||
|
||||
|
@ -2455,7 +2455,7 @@ class _RenderInspectorOverlay extends RenderBox {
|
|||
context.addLayer(_InspectorOverlayLayer(
|
||||
overlayRect: Rect.fromLTWH(offset.dx, offset.dy, size.width, size.height),
|
||||
selection: selection,
|
||||
rootRenderObject: parent is RenderObject ? parent as RenderObject : null,
|
||||
rootRenderObject: parent is RenderObject ? parent! as RenderObject : null,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -2665,8 +2665,8 @@ class _InspectorOverlayLayer extends Layer {
|
|||
) {
|
||||
canvas.save();
|
||||
final double maxWidth = size.width - 2 * (_kScreenEdgeMargin + _kTooltipPadding);
|
||||
final TextSpan textSpan = _textPainter?.text as TextSpan;
|
||||
if (_textPainter == null || textSpan.text != message || _textPainterMaxWidth != maxWidth) {
|
||||
final TextSpan? textSpan = _textPainter?.text as TextSpan?;
|
||||
if (_textPainter == null || textSpan!.text != message || _textPainterMaxWidth != maxWidth) {
|
||||
_textPainterMaxWidth = maxWidth;
|
||||
_textPainter = TextPainter()
|
||||
..maxLines = _kMaxTooltipLines
|
||||
|
@ -2737,7 +2737,7 @@ class _InspectorOverlayLayer extends Layer {
|
|||
&& current.lastChild is _RenderInspectorOverlay) {
|
||||
return rootRenderObject == current;
|
||||
}
|
||||
current = current.parent as RenderObject;
|
||||
current = current.parent as RenderObject?;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -2850,7 +2850,7 @@ Iterable<DiagnosticsNode> transformDebugCreator(Iterable<DiagnosticsNode> proper
|
|||
Iterable<DiagnosticsNode>? _parseDiagnosticsNode(DiagnosticsNode node) {
|
||||
if (!_isDebugCreator(node))
|
||||
return null;
|
||||
final DebugCreator debugCreator = node.value as DebugCreator;
|
||||
final DebugCreator debugCreator = node.value! as DebugCreator;
|
||||
final Element element = debugCreator.element;
|
||||
return _describeRelevantUserCode(element);
|
||||
}
|
||||
|
|
|
@ -1466,7 +1466,6 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
|||
|
||||
@override
|
||||
void initRenderView() {
|
||||
assert(renderView == null);
|
||||
renderView = _LiveTestRenderView(
|
||||
configuration: createViewConfiguration(),
|
||||
onNeedPaint: _handleViewNeedsPaint,
|
||||
|
|
Loading…
Reference in a new issue