implicit-casts:false in flutter/lib/src/rendering (#45720)
* implicit-casts:false in flutter/lib/src/rendering * address review comments
This commit is contained in:
parent
166d422b05
commit
a5f9b3b036
@ -158,7 +158,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
|
||||
PipelineOwner _pipelineOwner;
|
||||
|
||||
/// The render tree that's attached to the output surface.
|
||||
RenderView get renderView => _pipelineOwner.rootNode;
|
||||
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) {
|
||||
|
@ -210,10 +210,10 @@ class BoxConstraints extends Constraints {
|
||||
/// as close as possible to the original constraints.
|
||||
BoxConstraints enforce(BoxConstraints constraints) {
|
||||
return BoxConstraints(
|
||||
minWidth: minWidth.clamp(constraints.minWidth, constraints.maxWidth),
|
||||
maxWidth: maxWidth.clamp(constraints.minWidth, constraints.maxWidth),
|
||||
minHeight: minHeight.clamp(constraints.minHeight, constraints.maxHeight),
|
||||
maxHeight: maxHeight.clamp(constraints.minHeight, constraints.maxHeight),
|
||||
minWidth: minWidth.clamp(constraints.minWidth, constraints.maxWidth) as double,
|
||||
maxWidth: maxWidth.clamp(constraints.minWidth, constraints.maxWidth) as double,
|
||||
minHeight: minHeight.clamp(constraints.minHeight, constraints.maxHeight) as double,
|
||||
maxHeight: maxHeight.clamp(constraints.minHeight, constraints.maxHeight) as double,
|
||||
);
|
||||
}
|
||||
|
||||
@ -221,10 +221,12 @@ class BoxConstraints extends Constraints {
|
||||
/// the given width and height as possible while still respecting the original
|
||||
/// box constraints.
|
||||
BoxConstraints tighten({ double width, double height }) {
|
||||
return BoxConstraints(minWidth: width == null ? minWidth : width.clamp(minWidth, maxWidth),
|
||||
maxWidth: width == null ? maxWidth : width.clamp(minWidth, maxWidth),
|
||||
minHeight: height == null ? minHeight : height.clamp(minHeight, maxHeight),
|
||||
maxHeight: height == null ? maxHeight : height.clamp(minHeight, maxHeight));
|
||||
return BoxConstraints(
|
||||
minWidth: width == null ? minWidth : width.clamp(minWidth, maxWidth) as double,
|
||||
maxWidth: width == null ? maxWidth : width.clamp(minWidth, maxWidth) as double,
|
||||
minHeight: height == null ? minHeight : height.clamp(minHeight, maxHeight) as double,
|
||||
maxHeight: height == null ? maxHeight : height.clamp(minHeight, maxHeight) as double,
|
||||
);
|
||||
}
|
||||
|
||||
/// A box constraints with the width and height constraints flipped.
|
||||
@ -249,14 +251,14 @@ class BoxConstraints extends Constraints {
|
||||
/// possible to the given width.
|
||||
double constrainWidth([ double width = double.infinity ]) {
|
||||
assert(debugAssertIsValid());
|
||||
return width.clamp(minWidth, maxWidth);
|
||||
return width.clamp(minWidth, maxWidth) as double;
|
||||
}
|
||||
|
||||
/// Returns the height that both satisfies the constraints and is as close as
|
||||
/// possible to the given height.
|
||||
double constrainHeight([ double height = double.infinity ]) {
|
||||
assert(debugAssertIsValid());
|
||||
return height.clamp(minHeight, maxHeight);
|
||||
return height.clamp(minHeight, maxHeight) as double;
|
||||
}
|
||||
|
||||
Size _debugPropagateDebugSize(Size size, Size result) {
|
||||
@ -583,12 +585,12 @@ class BoxConstraints extends Constraints {
|
||||
return true;
|
||||
if (runtimeType != other.runtimeType)
|
||||
return false;
|
||||
final BoxConstraints typedOther = other;
|
||||
assert(typedOther.debugAssertIsValid());
|
||||
return minWidth == typedOther.minWidth &&
|
||||
maxWidth == typedOther.maxWidth &&
|
||||
minHeight == typedOther.minHeight &&
|
||||
maxHeight == typedOther.maxHeight;
|
||||
assert(other is BoxConstraints && other.debugAssertIsValid());
|
||||
return other is BoxConstraints
|
||||
&& other.minWidth == minWidth
|
||||
&& other.maxWidth == maxWidth
|
||||
&& other.minHeight == minHeight
|
||||
&& other.maxHeight == maxHeight;
|
||||
}
|
||||
|
||||
@override
|
||||
@ -816,7 +818,7 @@ class BoxHitTestEntry extends HitTestEntry {
|
||||
super(target);
|
||||
|
||||
@override
|
||||
RenderBox get target => super.target;
|
||||
RenderBox get target => super.target as RenderBox;
|
||||
|
||||
/// The position of the hit test in the local coordinates of [target].
|
||||
final Offset localPosition;
|
||||
@ -852,11 +854,9 @@ class _IntrinsicDimensionsCacheEntry {
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
if (other is! _IntrinsicDimensionsCacheEntry)
|
||||
return false;
|
||||
final _IntrinsicDimensionsCacheEntry typedOther = other;
|
||||
return dimension == typedOther.dimension &&
|
||||
argument == typedOther.argument;
|
||||
return other is _IntrinsicDimensionsCacheEntry
|
||||
&& other.dimension == dimension
|
||||
&& other.argument == argument;
|
||||
}
|
||||
|
||||
@override
|
||||
@ -1686,8 +1686,8 @@ abstract class RenderBox extends RenderObject {
|
||||
Size get size {
|
||||
assert(hasSize, 'RenderBox was not laid out: ${toString()}');
|
||||
assert(() {
|
||||
final Size _size = this._size;
|
||||
if (_size is _DebugSize) {
|
||||
final _DebugSize _size = this._size;
|
||||
assert(_size._owner == this);
|
||||
if (RenderObject.debugActiveLayout != null) {
|
||||
// We are always allowed to access our own size (for print debugging
|
||||
@ -1850,7 +1850,7 @@ abstract class RenderBox extends RenderObject {
|
||||
assert(!_debugDoingBaseline, 'Please see the documentation for computeDistanceToActualBaseline for the required calling conventions of this method.');
|
||||
assert(!debugNeedsLayout);
|
||||
assert(() {
|
||||
final RenderObject parent = this.parent;
|
||||
final RenderObject parent = this.parent as RenderObject;
|
||||
if (owner.debugDoingLayout)
|
||||
return (RenderObject.debugActiveLayout == parent) && parent.debugDoingThisLayout;
|
||||
if (owner.debugDoingPaint)
|
||||
@ -1913,7 +1913,7 @@ abstract class RenderBox extends RenderObject {
|
||||
|
||||
/// The box constraints most recently received from the parent.
|
||||
@override
|
||||
BoxConstraints get constraints => super.constraints;
|
||||
BoxConstraints get constraints => super.constraints as BoxConstraints;
|
||||
|
||||
@override
|
||||
void debugAssertDoesMeetConstraints() {
|
||||
@ -1946,14 +1946,14 @@ abstract class RenderBox extends RenderObject {
|
||||
if (!constraints.hasBoundedWidth) {
|
||||
RenderBox node = this;
|
||||
while (!node.constraints.hasBoundedWidth && node.parent is RenderBox)
|
||||
node = node.parent;
|
||||
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;
|
||||
node = node.parent as RenderBox;
|
||||
|
||||
information.add(node.describeForError('The nearest ancestor providing an unbounded height constraint is'));
|
||||
}
|
||||
@ -2208,7 +2208,7 @@ abstract class RenderBox extends RenderObject {
|
||||
}
|
||||
return true;
|
||||
}());
|
||||
final BoxParentData childParentData = child.parentData;
|
||||
final BoxParentData childParentData = child.parentData as BoxParentData;
|
||||
final Offset offset = childParentData.offset;
|
||||
transform.translate(offset.dx, offset.dy);
|
||||
}
|
||||
@ -2434,7 +2434,7 @@ mixin RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, ParentDataTyp
|
||||
assert(!debugNeedsLayout);
|
||||
ChildType child = firstChild;
|
||||
while (child != null) {
|
||||
final ParentDataType childParentData = child.parentData;
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
final double result = child.getDistanceToActualBaseline(baseline);
|
||||
if (result != null)
|
||||
return result + childParentData.offset.dy;
|
||||
@ -2452,7 +2452,7 @@ mixin RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, ParentDataTyp
|
||||
double result;
|
||||
ChildType child = firstChild;
|
||||
while (child != null) {
|
||||
final ParentDataType childParentData = child.parentData;
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
double candidate = child.getDistanceToActualBaseline(baseline);
|
||||
if (candidate != null) {
|
||||
candidate += childParentData.offset.dy;
|
||||
@ -2479,7 +2479,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;
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
final bool isHit = result.addWithPaintOffset(
|
||||
offset: childParentData.offset,
|
||||
position: position,
|
||||
@ -2504,7 +2504,7 @@ mixin RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, ParentDataTyp
|
||||
void defaultPaint(PaintingContext context, Offset offset) {
|
||||
ChildType child = firstChild;
|
||||
while (child != null) {
|
||||
final ParentDataType childParentData = child.parentData;
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
context.paintChild(child, childParentData.offset + offset);
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
@ -2519,8 +2519,8 @@ mixin RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, ParentDataTyp
|
||||
final List<ChildType> result = <ChildType>[];
|
||||
RenderBox child = firstChild;
|
||||
while (child != null) {
|
||||
final ParentDataType childParentData = child.parentData;
|
||||
result.add(child);
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
result.add(child as ChildType);
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
return result;
|
||||
|
@ -186,12 +186,12 @@ abstract class MultiChildLayoutDelegate {
|
||||
}
|
||||
return true;
|
||||
}());
|
||||
final MultiChildLayoutParentData childParentData = child.parentData;
|
||||
final MultiChildLayoutParentData childParentData = child.parentData as MultiChildLayoutParentData;
|
||||
childParentData.offset = offset;
|
||||
}
|
||||
|
||||
DiagnosticsNode _debugDescribeChild(RenderBox child) {
|
||||
final MultiChildLayoutParentData childParentData = child.parentData;
|
||||
final MultiChildLayoutParentData childParentData = child.parentData as MultiChildLayoutParentData;
|
||||
return DiagnosticsProperty<RenderBox>('${childParentData.id}', child);
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ abstract class MultiChildLayoutDelegate {
|
||||
_idToChild = <Object, RenderBox>{};
|
||||
RenderBox child = firstChild;
|
||||
while (child != null) {
|
||||
final MultiChildLayoutParentData childParentData = child.parentData;
|
||||
final MultiChildLayoutParentData childParentData = child.parentData as MultiChildLayoutParentData;
|
||||
assert(() {
|
||||
if (childParentData.id == null) {
|
||||
throw FlutterError.fromParts(<DiagnosticsNode>[
|
||||
|
@ -284,7 +284,7 @@ mixin DebugOverflowIndicatorMixin on RenderObject {
|
||||
final List<_OverflowRegionData> overflowRegions = _calculateOverflowRegions(overflow, containerRect);
|
||||
for (_OverflowRegionData region in overflowRegions) {
|
||||
context.canvas.drawRect(region.rect.shift(offset), _indicatorPaint);
|
||||
final TextSpan textSpan = _indicatorLabel[region.side.index].text;
|
||||
final TextSpan textSpan = _indicatorLabel[region.side.index].text as TextSpan;
|
||||
if (textSpan?.text != region.label) {
|
||||
_indicatorLabel[region.side.index].text = TextSpan(
|
||||
text: region.label,
|
||||
|
@ -733,7 +733,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
||||
}
|
||||
|
||||
/// The text to display.
|
||||
TextSpan get text => _textPainter.text;
|
||||
TextSpan get text => _textPainter.text as TextSpan;
|
||||
final TextPainter _textPainter;
|
||||
set text(TextSpan value) {
|
||||
if (_textPainter.text == value)
|
||||
@ -1955,8 +1955,8 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
||||
void _paintHandleLayers(PaintingContext context, List<TextSelectionPoint> endpoints) {
|
||||
Offset startPoint = endpoints[0].point;
|
||||
startPoint = Offset(
|
||||
startPoint.dx.clamp(0.0, size.width),
|
||||
startPoint.dy.clamp(0.0, size.height),
|
||||
startPoint.dx.clamp(0.0, size.width) as double,
|
||||
startPoint.dy.clamp(0.0, size.height) as double,
|
||||
);
|
||||
context.pushLayer(
|
||||
LeaderLayer(link: startHandleLayerLink, offset: startPoint),
|
||||
@ -1966,8 +1966,8 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
||||
if (endpoints.length == 2) {
|
||||
Offset endPoint = endpoints[1].point;
|
||||
endPoint = Offset(
|
||||
endPoint.dx.clamp(0.0, size.width),
|
||||
endPoint.dy.clamp(0.0, size.height),
|
||||
endPoint.dx.clamp(0.0, size.width) as double,
|
||||
endPoint.dy.clamp(0.0, size.height) as double,
|
||||
);
|
||||
context.pushLayer(
|
||||
LeaderLayer(link: endHandleLayerLink, offset: endPoint),
|
||||
|
@ -502,7 +502,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
||||
} else {
|
||||
inflexibleSpace += childSize(child, extent);
|
||||
}
|
||||
final FlexParentData childParentData = child.parentData;
|
||||
final FlexParentData childParentData = child.parentData as FlexParentData;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
return maxFlexFractionSoFar * totalFlex + inflexibleSpace;
|
||||
@ -537,7 +537,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
||||
inflexibleSpace += mainSize;
|
||||
maxCrossSize = math.max(maxCrossSize, crossSize);
|
||||
}
|
||||
final FlexParentData childParentData = child.parentData;
|
||||
final FlexParentData childParentData = child.parentData as FlexParentData;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
|
||||
@ -552,7 +552,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;
|
||||
final FlexParentData childParentData = child.parentData as FlexParentData;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
|
||||
@ -604,12 +604,12 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
||||
}
|
||||
|
||||
int _getFlex(RenderBox child) {
|
||||
final FlexParentData childParentData = child.parentData;
|
||||
final FlexParentData childParentData = child.parentData as FlexParentData;
|
||||
return childParentData.flex ?? 0;
|
||||
}
|
||||
|
||||
FlexFit _getFit(RenderBox child) {
|
||||
final FlexParentData childParentData = child.parentData;
|
||||
final FlexParentData childParentData = child.parentData as FlexParentData;
|
||||
return childParentData.fit ?? FlexFit.tight;
|
||||
}
|
||||
|
||||
@ -648,7 +648,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
||||
RenderBox child = firstChild;
|
||||
RenderBox lastFlexChild;
|
||||
while (child != null) {
|
||||
final FlexParentData childParentData = child.parentData;
|
||||
final FlexParentData childParentData = child.parentData as FlexParentData;
|
||||
totalChildren++;
|
||||
final int flex = _getFlex(child);
|
||||
if (flex > 0) {
|
||||
@ -670,13 +670,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;
|
||||
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;
|
||||
node = node.parent as RenderBox;
|
||||
if (!node.constraints.hasBoundedHeight)
|
||||
node = null;
|
||||
break;
|
||||
@ -830,7 +830,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
||||
crossSize = maxSizeAboveBaseline + maxSizeBelowBaseline;
|
||||
}
|
||||
}
|
||||
final FlexParentData childParentData = child.parentData;
|
||||
final FlexParentData childParentData = child.parentData as FlexParentData;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
}
|
||||
@ -892,7 +892,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;
|
||||
final FlexParentData childParentData = child.parentData as FlexParentData;
|
||||
double childCrossPosition;
|
||||
switch (_crossAxisAlignment) {
|
||||
case CrossAxisAlignment.start:
|
||||
|
@ -287,7 +287,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;
|
||||
final FlowParentData childParentData = child.parentData as FlowParentData;
|
||||
childParentData.offset = Offset.zero;
|
||||
child = childParentData.nextSibling;
|
||||
i += 1;
|
||||
@ -315,7 +315,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;
|
||||
final FlowParentData childParentData = child.parentData as FlowParentData;
|
||||
assert(() {
|
||||
if (childParentData._transform != null) {
|
||||
throw FlutterError.fromParts(<DiagnosticsNode>[
|
||||
@ -353,7 +353,7 @@ class RenderFlow extends RenderBox
|
||||
_paintingContext = context;
|
||||
_paintingOffset = offset;
|
||||
for (RenderBox child in _randomAccessChildren) {
|
||||
final FlowParentData childParentData = child.parentData;
|
||||
final FlowParentData childParentData = child.parentData as FlowParentData;
|
||||
childParentData._transform = null;
|
||||
}
|
||||
try {
|
||||
@ -377,7 +377,7 @@ class RenderFlow extends RenderBox
|
||||
if (childIndex >= children.length)
|
||||
continue;
|
||||
final RenderBox child = children[childIndex];
|
||||
final FlowParentData childParentData = child.parentData;
|
||||
final FlowParentData childParentData = child.parentData as FlowParentData;
|
||||
final Matrix4 transform = childParentData._transform;
|
||||
if (transform == null)
|
||||
continue;
|
||||
@ -396,7 +396,7 @@ class RenderFlow extends RenderBox
|
||||
|
||||
@override
|
||||
void applyPaintTransform(RenderBox child, Matrix4 transform) {
|
||||
final FlowParentData childParentData = child.parentData;
|
||||
final FlowParentData childParentData = child.parentData as FlowParentData;
|
||||
if (childParentData._transform != null)
|
||||
transform.multiply(childParentData._transform);
|
||||
super.applyPaintTransform(child, transform);
|
||||
|
@ -4,8 +4,7 @@
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
import 'dart:ui' as ui show EngineLayer, Image, ImageFilter, PathMetric,
|
||||
Picture, PictureRecorder, Scene, SceneBuilder;
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
@ -103,7 +102,7 @@ abstract class Layer extends AbstractNode with DiagnosticableTreeMixin {
|
||||
/// Only subclasses of [ContainerLayer] can have children in the layer tree.
|
||||
/// All other layer classes are used for leaves in the layer tree.
|
||||
@override
|
||||
ContainerLayer get parent => super.parent;
|
||||
ContainerLayer get parent => super.parent as ContainerLayer;
|
||||
|
||||
// Whether this layer has any changes since its last call to [addToScene].
|
||||
//
|
||||
@ -1158,7 +1157,11 @@ class OffsetLayer extends ContainerLayer {
|
||||
// retained rendering, we don't want to push the offset down to each leaf
|
||||
// node. Otherwise, changing an offset layer on the very high level could
|
||||
// cascade the change to too many leaves.
|
||||
engineLayer = builder.pushOffset(layerOffset.dx + offset.dx, layerOffset.dy + offset.dy, oldLayer: _engineLayer);
|
||||
engineLayer = builder.pushOffset(
|
||||
layerOffset.dx + offset.dx,
|
||||
layerOffset.dy + offset.dy,
|
||||
oldLayer: _engineLayer as ui.OffsetEngineLayer,
|
||||
);
|
||||
addChildrenToScene(builder);
|
||||
builder.pop();
|
||||
}
|
||||
@ -1281,7 +1284,11 @@ class ClipRectLayer extends ContainerLayer {
|
||||
}());
|
||||
if (enabled) {
|
||||
final Rect shiftedClipRect = layerOffset == Offset.zero ? clipRect : clipRect.shift(layerOffset);
|
||||
engineLayer = builder.pushClipRect(shiftedClipRect, clipBehavior: clipBehavior, oldLayer: _engineLayer);
|
||||
engineLayer = builder.pushClipRect(
|
||||
shiftedClipRect,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: _engineLayer as ui.ClipRectEngineLayer,
|
||||
);
|
||||
} else {
|
||||
engineLayer = null;
|
||||
}
|
||||
@ -1362,7 +1369,11 @@ class ClipRRectLayer extends ContainerLayer {
|
||||
}());
|
||||
if (enabled) {
|
||||
final RRect shiftedClipRRect = layerOffset == Offset.zero ? clipRRect : clipRRect.shift(layerOffset);
|
||||
engineLayer = builder.pushClipRRect(shiftedClipRRect, clipBehavior: clipBehavior, oldLayer: _engineLayer);
|
||||
engineLayer = builder.pushClipRRect(
|
||||
shiftedClipRRect,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: _engineLayer as ui.ClipRRectEngineLayer,
|
||||
);
|
||||
} else {
|
||||
engineLayer = null;
|
||||
}
|
||||
@ -1443,7 +1454,11 @@ class ClipPathLayer extends ContainerLayer {
|
||||
}());
|
||||
if (enabled) {
|
||||
final Path shiftedPath = layerOffset == Offset.zero ? clipPath : clipPath.shift(layerOffset);
|
||||
engineLayer = builder.pushClipPath(shiftedPath, clipBehavior: clipBehavior, oldLayer: _engineLayer);
|
||||
engineLayer = builder.pushClipPath(
|
||||
shiftedPath,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: _engineLayer as ui.ClipPathEngineLayer,
|
||||
);
|
||||
} else {
|
||||
engineLayer = null;
|
||||
}
|
||||
@ -1486,7 +1501,10 @@ class ColorFilterLayer extends ContainerLayer {
|
||||
@override
|
||||
void addToScene(ui.SceneBuilder builder, [ Offset layerOffset = Offset.zero ]) {
|
||||
assert(colorFilter != null);
|
||||
engineLayer = builder.pushColorFilter(colorFilter, oldLayer: _engineLayer);
|
||||
engineLayer = builder.pushColorFilter(
|
||||
colorFilter,
|
||||
oldLayer: _engineLayer as ui.ColorFilterEngineLayer,
|
||||
);
|
||||
addChildrenToScene(builder, layerOffset);
|
||||
builder.pop();
|
||||
}
|
||||
@ -1546,7 +1564,10 @@ class TransformLayer extends OffsetLayer {
|
||||
_lastEffectiveTransform = Matrix4.translationValues(totalOffset.dx, totalOffset.dy, 0.0)
|
||||
..multiply(_lastEffectiveTransform);
|
||||
}
|
||||
engineLayer = builder.pushTransform(_lastEffectiveTransform.storage, oldLayer: _engineLayer);
|
||||
engineLayer = builder.pushTransform(
|
||||
_lastEffectiveTransform.storage,
|
||||
oldLayer: _engineLayer as ui.TransformEngineLayer,
|
||||
);
|
||||
addChildrenToScene(builder);
|
||||
builder.pop();
|
||||
}
|
||||
@ -1656,7 +1677,11 @@ class OpacityLayer extends ContainerLayer {
|
||||
}());
|
||||
|
||||
if (enabled)
|
||||
engineLayer = builder.pushOpacity(alpha, offset: offset + layerOffset, oldLayer: _engineLayer);
|
||||
engineLayer = builder.pushOpacity(
|
||||
alpha,
|
||||
offset: offset + layerOffset,
|
||||
oldLayer: _engineLayer as ui.OpacityEngineLayer,
|
||||
);
|
||||
else
|
||||
engineLayer = null;
|
||||
addChildrenToScene(builder);
|
||||
@ -1748,7 +1773,12 @@ class ShaderMaskLayer extends ContainerLayer {
|
||||
assert(blendMode != null);
|
||||
assert(layerOffset != null);
|
||||
final Rect shiftedMaskRect = layerOffset == Offset.zero ? maskRect : maskRect.shift(layerOffset);
|
||||
engineLayer = builder.pushShaderMask(shader, shiftedMaskRect, blendMode, oldLayer: _engineLayer);
|
||||
engineLayer = builder.pushShaderMask(
|
||||
shader,
|
||||
shiftedMaskRect,
|
||||
blendMode,
|
||||
oldLayer: _engineLayer as ui.ShaderMaskEngineLayer,
|
||||
);
|
||||
addChildrenToScene(builder, layerOffset);
|
||||
builder.pop();
|
||||
}
|
||||
@ -1786,7 +1816,10 @@ class BackdropFilterLayer extends ContainerLayer {
|
||||
@override
|
||||
void addToScene(ui.SceneBuilder builder, [ Offset layerOffset = Offset.zero ]) {
|
||||
assert(filter != null);
|
||||
engineLayer = builder.pushBackdropFilter(filter, oldLayer: _engineLayer);
|
||||
engineLayer = builder.pushBackdropFilter(
|
||||
filter,
|
||||
oldLayer: _engineLayer as ui.BackdropFilterEngineLayer,
|
||||
);
|
||||
addChildrenToScene(builder, layerOffset);
|
||||
builder.pop();
|
||||
}
|
||||
@ -1923,7 +1956,7 @@ class PhysicalModelLayer extends ContainerLayer {
|
||||
color: color,
|
||||
shadowColor: shadowColor,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: _engineLayer,
|
||||
oldLayer: _engineLayer as ui.PhysicalShapeEngineLayer,
|
||||
);
|
||||
} else {
|
||||
engineLayer = null;
|
||||
@ -2036,7 +2069,10 @@ class LeaderLayer extends ContainerLayer {
|
||||
assert(offset != null);
|
||||
_lastOffset = offset + layerOffset;
|
||||
if (_lastOffset != Offset.zero)
|
||||
engineLayer = builder.pushTransform(Matrix4.translationValues(_lastOffset.dx, _lastOffset.dy, 0.0).storage, oldLayer: _engineLayer);
|
||||
engineLayer = builder.pushTransform(
|
||||
Matrix4.translationValues(_lastOffset.dx, _lastOffset.dy, 0.0).storage,
|
||||
oldLayer: _engineLayer as ui.TransformEngineLayer,
|
||||
);
|
||||
addChildrenToScene(builder);
|
||||
if (_lastOffset != Offset.zero)
|
||||
builder.pop();
|
||||
@ -2278,14 +2314,20 @@ class FollowerLayer extends ContainerLayer {
|
||||
}
|
||||
_establishTransform();
|
||||
if (_lastTransform != null) {
|
||||
engineLayer = builder.pushTransform(_lastTransform.storage, oldLayer: _engineLayer);
|
||||
engineLayer = builder.pushTransform(
|
||||
_lastTransform.storage,
|
||||
oldLayer: _engineLayer as ui.TransformEngineLayer,
|
||||
);
|
||||
addChildrenToScene(builder);
|
||||
builder.pop();
|
||||
_lastOffset = unlinkedOffset + layerOffset;
|
||||
} else {
|
||||
_lastOffset = null;
|
||||
final Matrix4 matrix = Matrix4.translationValues(unlinkedOffset.dx, unlinkedOffset.dy, .0);
|
||||
engineLayer = builder.pushTransform(matrix.storage, oldLayer: _engineLayer);
|
||||
engineLayer = builder.pushTransform(
|
||||
matrix.storage,
|
||||
oldLayer: _engineLayer as ui.TransformEngineLayer,
|
||||
);
|
||||
addChildrenToScene(builder);
|
||||
builder.pop();
|
||||
}
|
||||
@ -2425,7 +2467,7 @@ class AnnotatedRegionLayer<T> extends ContainerLayer {
|
||||
if (T == S) {
|
||||
isAbsorbed = isAbsorbed || opaque;
|
||||
final Object untypedValue = value;
|
||||
final S typedValue = untypedValue;
|
||||
final S typedValue = untypedValue as S;
|
||||
result.add(AnnotationEntry<S>(
|
||||
annotation: typedValue,
|
||||
localPosition: localPosition,
|
||||
|
@ -126,7 +126,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;
|
||||
final ListBodyParentData childParentData = child.parentData as ListBodyParentData;
|
||||
childParentData.offset = Offset(mainAxisExtent, 0.0);
|
||||
mainAxisExtent += child.size.width;
|
||||
assert(child.parentData == childParentData);
|
||||
@ -138,7 +138,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;
|
||||
final ListBodyParentData childParentData = child.parentData as ListBodyParentData;
|
||||
mainAxisExtent += child.size.width;
|
||||
assert(child.parentData == childParentData);
|
||||
child = childParentData.nextSibling;
|
||||
@ -146,7 +146,7 @@ class RenderListBody extends RenderBox
|
||||
double position = 0.0;
|
||||
child = firstChild;
|
||||
while (child != null) {
|
||||
final ListBodyParentData childParentData = child.parentData;
|
||||
final ListBodyParentData childParentData = child.parentData as ListBodyParentData;
|
||||
position += child.size.width;
|
||||
childParentData.offset = Offset(mainAxisExtent - position, 0.0);
|
||||
assert(child.parentData == childParentData);
|
||||
@ -158,7 +158,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;
|
||||
final ListBodyParentData childParentData = child.parentData as ListBodyParentData;
|
||||
childParentData.offset = Offset(0.0, mainAxisExtent);
|
||||
mainAxisExtent += child.size.height;
|
||||
assert(child.parentData == childParentData);
|
||||
@ -170,7 +170,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;
|
||||
final ListBodyParentData childParentData = child.parentData as ListBodyParentData;
|
||||
mainAxisExtent += child.size.height;
|
||||
assert(child.parentData == childParentData);
|
||||
child = childParentData.nextSibling;
|
||||
@ -178,7 +178,7 @@ class RenderListBody extends RenderBox
|
||||
double position = 0.0;
|
||||
child = firstChild;
|
||||
while (child != null) {
|
||||
final ListBodyParentData childParentData = child.parentData;
|
||||
final ListBodyParentData childParentData = child.parentData as ListBodyParentData;
|
||||
position += child.size.height;
|
||||
childParentData.offset = Offset(0.0, mainAxisExtent - position);
|
||||
assert(child.parentData == childParentData);
|
||||
@ -201,7 +201,7 @@ class RenderListBody extends RenderBox
|
||||
RenderBox child = firstChild;
|
||||
while (child != null) {
|
||||
extent = math.max(extent, childSize(child));
|
||||
final ListBodyParentData childParentData = child.parentData;
|
||||
final ListBodyParentData childParentData = child.parentData as ListBodyParentData;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
return extent;
|
||||
@ -212,7 +212,7 @@ class RenderListBody extends RenderBox
|
||||
RenderBox child = firstChild;
|
||||
while (child != null) {
|
||||
extent += childSize(child);
|
||||
final ListBodyParentData childParentData = child.parentData;
|
||||
final ListBodyParentData childParentData = child.parentData as ListBodyParentData;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
return extent;
|
||||
|
@ -598,7 +598,7 @@ class RenderListWheelViewport
|
||||
/// Gets the index of a child by looking at its parentData.
|
||||
int indexOf(RenderBox child) {
|
||||
assert(child != null);
|
||||
final ListWheelParentData childParentData = child.parentData;
|
||||
final ListWheelParentData childParentData = child.parentData as ListWheelParentData;
|
||||
assert(childParentData.index != null);
|
||||
return childParentData.index;
|
||||
}
|
||||
@ -625,7 +625,7 @@ class RenderListWheelViewport
|
||||
|
||||
void _layoutChild(RenderBox child, BoxConstraints constraints, int index) {
|
||||
child.layout(constraints, parentUsesSize: true);
|
||||
final ListWheelParentData childParentData = child.parentData;
|
||||
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));
|
||||
@ -780,12 +780,12 @@ class RenderListWheelViewport
|
||||
/// Paints all children visible in the current viewport.
|
||||
void _paintVisibleChildren(PaintingContext context, Offset offset) {
|
||||
RenderBox childToPaint = firstChild;
|
||||
ListWheelParentData childParentData = childToPaint?.parentData;
|
||||
ListWheelParentData childParentData = childToPaint?.parentData as ListWheelParentData;
|
||||
|
||||
while (childParentData != null) {
|
||||
_paintTransformedChild(childToPaint, context, offset, childParentData.offset);
|
||||
childToPaint = childAfter(childToPaint);
|
||||
childParentData = childToPaint?.parentData;
|
||||
childParentData = childToPaint?.parentData as ListWheelParentData;
|
||||
}
|
||||
}
|
||||
|
||||
@ -971,7 +971,7 @@ class RenderListWheelViewport
|
||||
/// painting coordinates** system.
|
||||
@override
|
||||
void applyPaintTransform(RenderBox child, Matrix4 transform) {
|
||||
final ListWheelParentData parentData = child?.parentData;
|
||||
final ListWheelParentData parentData = child?.parentData as ListWheelParentData;
|
||||
transform.translate(0.0, _getUntransformedPaintingCoordinateY(parentData.offset.dy));
|
||||
}
|
||||
|
||||
@ -997,9 +997,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;
|
||||
child = child.parent as RenderObject;
|
||||
|
||||
final ListWheelParentData parentData = child.parentData;
|
||||
final ListWheelParentData parentData = child.parentData as ListWheelParentData;
|
||||
final double targetOffset = parentData.offset.dy; // the so-called "centerPosition"
|
||||
|
||||
final Matrix4 transform = target.getTransformTo(child);
|
||||
|
@ -112,7 +112,7 @@ class PaintingContext extends ClipContext {
|
||||
);
|
||||
return true;
|
||||
}());
|
||||
OffsetLayer childLayer = child._layer;
|
||||
OffsetLayer childLayer = child._layer as OffsetLayer;
|
||||
if (childLayer == null) {
|
||||
assert(debugAlsoPaintedParent);
|
||||
// Not using the `layer` setter because the setter asserts that we not
|
||||
@ -211,7 +211,7 @@ class PaintingContext extends ClipContext {
|
||||
}());
|
||||
}
|
||||
assert(child._layer is OffsetLayer);
|
||||
final OffsetLayer childOffsetLayer = child._layer;
|
||||
final OffsetLayer childOffsetLayer = child._layer as OffsetLayer;
|
||||
childOffsetLayer.offset = offset;
|
||||
appendLayer(child._layer);
|
||||
}
|
||||
@ -1388,7 +1388,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
node = node.parent;
|
||||
node = node.parent as RenderObject;
|
||||
}
|
||||
return true;
|
||||
}());
|
||||
@ -1396,7 +1396,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
}
|
||||
|
||||
@override
|
||||
PipelineOwner get owner => super.owner;
|
||||
PipelineOwner get owner => super.owner as PipelineOwner;
|
||||
|
||||
@override
|
||||
void attach(PipelineOwner owner) {
|
||||
@ -1478,7 +1478,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
while (node != _relayoutBoundary) {
|
||||
assert(node._relayoutBoundary == _relayoutBoundary);
|
||||
assert(node.parent != null);
|
||||
node = node.parent;
|
||||
node = node.parent as RenderObject;
|
||||
if ((!node._needsLayout) && (!node._debugDoingThisLayout))
|
||||
return false;
|
||||
}
|
||||
@ -1559,7 +1559,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
@protected
|
||||
void markParentNeedsLayout() {
|
||||
_needsLayout = true;
|
||||
final RenderObject parent = this.parent;
|
||||
final RenderObject parent = this.parent as RenderObject;
|
||||
if (!_doingThisLayoutWithCallback) {
|
||||
parent.markNeedsLayout();
|
||||
} else {
|
||||
@ -1697,8 +1697,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
if (!parentUsesSize || sizedByParent || constraints.isTight || parent is! RenderObject) {
|
||||
relayoutBoundary = this;
|
||||
} else {
|
||||
final RenderObject parent = this.parent;
|
||||
relayoutBoundary = parent._relayoutBoundary;
|
||||
relayoutBoundary = (parent as RenderObject)._relayoutBoundary;
|
||||
}
|
||||
assert(() {
|
||||
_debugCanParentUseSize = parentUsesSize;
|
||||
@ -1864,7 +1863,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
assert(!_doingThisLayoutWithCallback);
|
||||
_doingThisLayoutWithCallback = true;
|
||||
try {
|
||||
owner._enableMutationsToDirtySubtrees(() { callback(constraints); });
|
||||
owner._enableMutationsToDirtySubtrees(() { callback(constraints as T); });
|
||||
} finally {
|
||||
_doingThisLayoutWithCallback = false;
|
||||
}
|
||||
@ -2011,7 +2010,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
return;
|
||||
_needsCompositingBitsUpdate = true;
|
||||
if (parent is RenderObject) {
|
||||
final RenderObject parent = this.parent;
|
||||
final RenderObject parent = this.parent as RenderObject;
|
||||
if (parent._needsCompositingBitsUpdate)
|
||||
return;
|
||||
if (!isRepaintBoundary && !parent.isRepaintBoundary) {
|
||||
@ -2123,7 +2122,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
owner.requestVisualUpdate();
|
||||
}
|
||||
} else if (parent is RenderObject) {
|
||||
final RenderObject parent = this.parent;
|
||||
final RenderObject parent = this.parent as RenderObject;
|
||||
parent.markNeedsPaint();
|
||||
assert(parent == this.parent);
|
||||
} else {
|
||||
@ -2154,7 +2153,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
assert(!_layer.attached);
|
||||
AbstractNode ancestor = parent;
|
||||
while (ancestor is RenderObject) {
|
||||
final RenderObject node = ancestor;
|
||||
final RenderObject node = ancestor as RenderObject;
|
||||
if (node.isRepaintBoundary) {
|
||||
if (node._layer == null)
|
||||
break; // looks like the subtree here has never been painted. let it handle itself.
|
||||
@ -2333,7 +2332,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) {
|
||||
for (RenderObject renderer = this; renderer != ancestor; renderer = renderer.parent as RenderObject) {
|
||||
assert(renderer != null); // Failed to find ancestor in parent chain.
|
||||
renderers.add(renderer);
|
||||
}
|
||||
@ -2452,7 +2451,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;
|
||||
final RenderObject renderParent = parent as RenderObject;
|
||||
renderParent.sendSemanticsEvent(semanticsEvent);
|
||||
}
|
||||
}
|
||||
@ -2534,7 +2533,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
break;
|
||||
node._needsSemanticsUpdate = true;
|
||||
|
||||
node = node.parent;
|
||||
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.
|
||||
@ -2575,7 +2574,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
mergeIntoParent: _semantics?.parent?.isPartOfNodeMerging ?? false,
|
||||
);
|
||||
assert(fragment is _InterestingSemanticsFragment);
|
||||
final _InterestingSemanticsFragment interestingFragment = fragment;
|
||||
final _InterestingSemanticsFragment interestingFragment = fragment as _InterestingSemanticsFragment;
|
||||
final SemanticsNode node = interestingFragment.compileChildren(
|
||||
parentSemanticsClipRect: _semantics?.parentSemanticsClipRect,
|
||||
parentPaintClipRect: _semantics?.parentPaintClipRect,
|
||||
@ -2676,7 +2675,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
dropsSemanticsOfPreviousSiblings: dropSemanticsOfPreviousSiblings,
|
||||
);
|
||||
if (config.isSemanticBoundary) {
|
||||
final _SwitchableSemanticsFragment fragment = result;
|
||||
final _SwitchableSemanticsFragment fragment = result as _SwitchableSemanticsFragment;
|
||||
fragment.markAsExplicit();
|
||||
}
|
||||
}
|
||||
@ -2717,7 +2716,8 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
Iterable<SemanticsNode> children,
|
||||
) {
|
||||
assert(node == _semantics);
|
||||
node.updateWith(config: config, childrenInInversePaintOrder: children);
|
||||
// TODO(a14n): remove the following cast by updating type of parameter in either updateWith or assembleSemanticsNode
|
||||
node.updateWith(config: config, childrenInInversePaintOrder: children as List<SemanticsNode>);
|
||||
}
|
||||
|
||||
// EVENTS
|
||||
@ -2753,9 +2753,9 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
String header = describeIdentity(this);
|
||||
if (_relayoutBoundary != null && _relayoutBoundary != this) {
|
||||
int count = 1;
|
||||
RenderObject target = parent;
|
||||
RenderObject target = parent as RenderObject;
|
||||
while (target != null && target != _relayoutBoundary) {
|
||||
target = target.parent;
|
||||
target = target.parent as RenderObject;
|
||||
count += 1;
|
||||
}
|
||||
header += ' relayoutBoundary=up$count';
|
||||
@ -2869,7 +2869,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
Curve curve = Curves.ease,
|
||||
}) {
|
||||
if (parent is RenderObject) {
|
||||
final RenderObject renderParent = parent;
|
||||
final RenderObject renderParent = parent as RenderObject;
|
||||
renderParent.showOnScreen(
|
||||
descendant: descendant ?? this,
|
||||
rect: rect,
|
||||
@ -3003,20 +3003,20 @@ mixin ContainerParentDataMixin<ChildType extends RenderObject> on ParentData {
|
||||
/// list of children.
|
||||
mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType extends ContainerParentDataMixin<ChildType>> on RenderObject {
|
||||
bool _debugUltimatePreviousSiblingOf(ChildType child, { ChildType equals }) {
|
||||
ParentDataType childParentData = child.parentData;
|
||||
ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
while (childParentData.previousSibling != null) {
|
||||
assert(childParentData.previousSibling != child);
|
||||
child = childParentData.previousSibling;
|
||||
childParentData = child.parentData;
|
||||
childParentData = child.parentData as ParentDataType;
|
||||
}
|
||||
return child == equals;
|
||||
}
|
||||
bool _debugUltimateNextSiblingOf(ChildType child, { ChildType equals }) {
|
||||
ParentDataType childParentData = child.parentData;
|
||||
ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
while (childParentData.nextSibling != null) {
|
||||
assert(childParentData.nextSibling != child);
|
||||
child = childParentData.nextSibling;
|
||||
childParentData = child.parentData;
|
||||
childParentData = child.parentData as ParentDataType;
|
||||
}
|
||||
return child == equals;
|
||||
}
|
||||
@ -3068,7 +3068,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
||||
ChildType _firstChild;
|
||||
ChildType _lastChild;
|
||||
void _insertIntoChildList(ChildType child, { ChildType after }) {
|
||||
final ParentDataType childParentData = child.parentData;
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
assert(childParentData.nextSibling == null);
|
||||
assert(childParentData.previousSibling == null);
|
||||
_childCount += 1;
|
||||
@ -3077,7 +3077,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
||||
// insert at the start (_firstChild)
|
||||
childParentData.nextSibling = _firstChild;
|
||||
if (_firstChild != null) {
|
||||
final ParentDataType _firstChildParentData = _firstChild.parentData;
|
||||
final ParentDataType _firstChildParentData = _firstChild.parentData as ParentDataType;
|
||||
_firstChildParentData.previousSibling = child;
|
||||
}
|
||||
_firstChild = child;
|
||||
@ -3087,7 +3087,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;
|
||||
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);
|
||||
@ -3100,8 +3100,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;
|
||||
final ParentDataType childNextSiblingParentData = childParentData.nextSibling.parentData;
|
||||
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);
|
||||
@ -3133,7 +3133,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
||||
}
|
||||
|
||||
void _removeFromChildList(ChildType child) {
|
||||
final ParentDataType childParentData = child.parentData;
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
assert(_debugUltimatePreviousSiblingOf(child, equals: _firstChild));
|
||||
assert(_debugUltimateNextSiblingOf(child, equals: _lastChild));
|
||||
assert(_childCount >= 0);
|
||||
@ -3141,14 +3141,14 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
||||
assert(_firstChild == child);
|
||||
_firstChild = childParentData.nextSibling;
|
||||
} else {
|
||||
final ParentDataType childPreviousSiblingParentData = childParentData.previousSibling.parentData;
|
||||
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;
|
||||
final ParentDataType childNextSiblingParentData = childParentData.nextSibling.parentData as ParentDataType;
|
||||
childNextSiblingParentData.previousSibling = childParentData.previousSibling;
|
||||
}
|
||||
childParentData.previousSibling = null;
|
||||
@ -3170,7 +3170,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
||||
void removeAll() {
|
||||
ChildType child = _firstChild;
|
||||
while (child != null) {
|
||||
final ParentDataType childParentData = child.parentData;
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
final ChildType next = childParentData.nextSibling;
|
||||
childParentData.previousSibling = null;
|
||||
childParentData.nextSibling = null;
|
||||
@ -3192,7 +3192,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
||||
assert(after != this);
|
||||
assert(child != after);
|
||||
assert(child.parent == this);
|
||||
final ParentDataType childParentData = child.parentData;
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
if (childParentData.previousSibling == after)
|
||||
return;
|
||||
_removeFromChildList(child);
|
||||
@ -3206,7 +3206,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
||||
ChildType child = _firstChild;
|
||||
while (child != null) {
|
||||
child.attach(owner);
|
||||
final ParentDataType childParentData = child.parentData;
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
}
|
||||
@ -3217,7 +3217,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
||||
ChildType child = _firstChild;
|
||||
while (child != null) {
|
||||
child.detach();
|
||||
final ParentDataType childParentData = child.parentData;
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
}
|
||||
@ -3227,7 +3227,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
||||
ChildType child = _firstChild;
|
||||
while (child != null) {
|
||||
redepthChild(child);
|
||||
final ParentDataType childParentData = child.parentData;
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
}
|
||||
@ -3237,7 +3237,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
||||
ChildType child = _firstChild;
|
||||
while (child != null) {
|
||||
visitor(child);
|
||||
final ParentDataType childParentData = child.parentData;
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
}
|
||||
@ -3252,7 +3252,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
||||
ChildType childBefore(ChildType child) {
|
||||
assert(child != null);
|
||||
assert(child.parent == this);
|
||||
final ParentDataType childParentData = child.parentData;
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
return childParentData.previousSibling;
|
||||
}
|
||||
|
||||
@ -3260,7 +3260,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
||||
ChildType childAfter(ChildType child) {
|
||||
assert(child != null);
|
||||
assert(child.parent == this);
|
||||
final ParentDataType childParentData = child.parentData;
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
return childParentData.nextSibling;
|
||||
}
|
||||
|
||||
@ -3275,7 +3275,7 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
|
||||
if (child == lastChild)
|
||||
break;
|
||||
count += 1;
|
||||
final ParentDataType childParentData = child.parentData;
|
||||
final ParentDataType childParentData = child.parentData as ParentDataType;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
}
|
||||
@ -3305,7 +3305,7 @@ mixin RelayoutWhenSystemFontsChangeMixin on RenderObject {
|
||||
}
|
||||
|
||||
@override
|
||||
void attach(covariant Object owner) {
|
||||
void attach(covariant PipelineOwner owner) {
|
||||
super.attach(owner);
|
||||
PaintingBinding.instance.systemFonts.addListener(systemFontsDidChange);
|
||||
}
|
||||
@ -3834,12 +3834,12 @@ class _SemanticsGeometry {
|
||||
assert(transform != null);
|
||||
assert(clipRectTransform != null);
|
||||
assert(clipRectTransform.isIdentity());
|
||||
RenderObject intermediateParent = child.parent;
|
||||
RenderObject intermediateParent = child.parent as RenderObject;
|
||||
assert(intermediateParent != null);
|
||||
while (intermediateParent != ancestor) {
|
||||
intermediateParent.applyPaintTransform(child, transform);
|
||||
intermediateParent = intermediateParent.parent;
|
||||
child = child.parent;
|
||||
intermediateParent = intermediateParent.parent as RenderObject;
|
||||
child = child.parent as RenderObject;
|
||||
assert(intermediateParent != null);
|
||||
}
|
||||
ancestor.applyPaintTransform(child, transform);
|
||||
|
@ -414,7 +414,7 @@ class RenderParagraph extends RenderBox
|
||||
bool hitTestChildren(BoxHitTestResult result, { Offset position }) {
|
||||
RenderBox child = firstChild;
|
||||
while (child != null) {
|
||||
final TextParentData textParentData = child.parentData;
|
||||
final TextParentData textParentData = child.parentData as TextParentData;
|
||||
final Matrix4 transform = Matrix4.translationValues(
|
||||
textParentData.offset.dx,
|
||||
textParentData.offset.dy,
|
||||
@ -458,7 +458,7 @@ class RenderParagraph extends RenderBox
|
||||
}
|
||||
if (span is TextSpan) {
|
||||
final TextSpan textSpan = span;
|
||||
textSpan.recognizer?.addPointer(event);
|
||||
textSpan.recognizer?.addPointer(event as PointerDownEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -550,7 +550,7 @@ class RenderParagraph extends RenderBox
|
||||
RenderBox child = firstChild;
|
||||
int childIndex = 0;
|
||||
while (child != null && childIndex < _textPainter.inlinePlaceholderBoxes.length) {
|
||||
final TextParentData textParentData = child.parentData;
|
||||
final TextParentData textParentData = child.parentData as TextParentData;
|
||||
textParentData.offset = Offset(
|
||||
_textPainter.inlinePlaceholderBoxes[childIndex].left,
|
||||
_textPainter.inlinePlaceholderBoxes[childIndex].top,
|
||||
@ -681,7 +681,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;
|
||||
final TextParentData textParentData = child.parentData as TextParentData;
|
||||
|
||||
final double scale = textParentData.scale;
|
||||
context.pushTransform(
|
||||
@ -876,7 +876,7 @@ class RenderParagraph extends RenderBox
|
||||
|
||||
if (info.isPlaceholder) {
|
||||
final SemanticsNode childNode = children.elementAt(placeholderIndex++);
|
||||
final TextParentData parentData = child.parentData;
|
||||
final TextParentData parentData = child.parentData as TextParentData;
|
||||
childNode.rect = Rect.fromLTWH(
|
||||
childNode.rect.left,
|
||||
childNode.rect.top,
|
||||
@ -890,13 +890,12 @@ class RenderParagraph extends RenderBox
|
||||
..sortKey = OrdinalSortKey(ordinal++)
|
||||
..textDirection = initialDirection
|
||||
..label = info.semanticsLabel ?? info.text;
|
||||
if (info.recognizer != null) {
|
||||
if (info.recognizer is TapGestureRecognizer) {
|
||||
final TapGestureRecognizer recognizer = info.recognizer;
|
||||
final GestureRecognizer recognizer = info.recognizer;
|
||||
if (recognizer != null) {
|
||||
if (recognizer is TapGestureRecognizer) {
|
||||
configuration.onTap = recognizer.onTap;
|
||||
configuration.isLink = true;
|
||||
} else if (info.recognizer is LongPressGestureRecognizer) {
|
||||
final LongPressGestureRecognizer recognizer = info.recognizer;
|
||||
} else if (recognizer is LongPressGestureRecognizer) {
|
||||
configuration.onLongPress = recognizer.onLongPress;
|
||||
} else {
|
||||
assert(false);
|
||||
|
@ -341,7 +341,7 @@ class RenderUiKitView extends RenderBox {
|
||||
if (event is! PointerDownEvent) {
|
||||
return;
|
||||
}
|
||||
_gestureRecognizer.addPointer(event);
|
||||
_gestureRecognizer.addPointer(event as PointerDownEvent);
|
||||
_lastPointerDownEvent = event.original ?? event;
|
||||
}
|
||||
|
||||
|
@ -800,7 +800,7 @@ class RenderOpacity extends RenderProxyBox {
|
||||
return;
|
||||
}
|
||||
assert(needsCompositing);
|
||||
layer = context.pushOpacity(offset, _alpha, super.paint, oldLayer: layer);
|
||||
layer = context.pushOpacity(offset, _alpha, super.paint, oldLayer: layer as OpacityLayer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -920,7 +920,7 @@ class RenderAnimatedOpacity extends RenderProxyBox {
|
||||
return;
|
||||
}
|
||||
assert(needsCompositing);
|
||||
layer = context.pushOpacity(offset, _alpha, super.paint, oldLayer: layer);
|
||||
layer = context.pushOpacity(offset, _alpha, super.paint, oldLayer: layer as OpacityLayer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -962,7 +962,7 @@ class RenderShaderMask extends RenderProxyBox {
|
||||
super(child);
|
||||
|
||||
@override
|
||||
ShaderMaskLayer get layer => super.layer;
|
||||
ShaderMaskLayer get layer => super.layer as ShaderMaskLayer;
|
||||
|
||||
/// Called to creates the [Shader] that generates the mask.
|
||||
///
|
||||
@ -1030,7 +1030,7 @@ class RenderBackdropFilter extends RenderProxyBox {
|
||||
super(child);
|
||||
|
||||
@override
|
||||
BackdropFilterLayer get layer => super.layer;
|
||||
BackdropFilterLayer get layer => super.layer as BackdropFilterLayer;
|
||||
|
||||
/// The image filter to apply to the existing painted content before painting
|
||||
/// the child.
|
||||
@ -1163,7 +1163,7 @@ class ShapeBorderClipper extends CustomClipper<Path> {
|
||||
bool shouldReclip(CustomClipper<Path> oldClipper) {
|
||||
if (oldClipper.runtimeType != ShapeBorderClipper)
|
||||
return true;
|
||||
final ShapeBorderClipper typedOldClipper = oldClipper;
|
||||
final ShapeBorderClipper typedOldClipper = oldClipper as ShapeBorderClipper;
|
||||
return typedOldClipper.shape != shape
|
||||
|| typedOldClipper.textDirection != textDirection;
|
||||
}
|
||||
@ -1315,7 +1315,14 @@ class RenderClipRect extends _RenderCustomClip<Rect> {
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
if (child != null) {
|
||||
_updateClip();
|
||||
layer = context.pushClipRect(needsCompositing, offset, _clip, super.paint, clipBehavior: clipBehavior, oldLayer: layer);
|
||||
layer = context.pushClipRect(
|
||||
needsCompositing,
|
||||
offset,
|
||||
_clip,
|
||||
super.paint,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: layer as ClipRectLayer,
|
||||
);
|
||||
} else {
|
||||
layer = null;
|
||||
}
|
||||
@ -1394,7 +1401,13 @@ class RenderClipRRect extends _RenderCustomClip<RRect> {
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
if (child != null) {
|
||||
_updateClip();
|
||||
layer = context.pushClipRRect(needsCompositing, offset, _clip.outerRect, _clip, super.paint, clipBehavior: clipBehavior, oldLayer: layer);
|
||||
layer = context.pushClipRRect(
|
||||
needsCompositing,
|
||||
offset,
|
||||
_clip.outerRect,
|
||||
_clip,
|
||||
super.paint, clipBehavior: clipBehavior, oldLayer: layer as ClipRRectLayer,
|
||||
);
|
||||
} else {
|
||||
layer = null;
|
||||
}
|
||||
@ -1465,7 +1478,15 @@ class RenderClipOval extends _RenderCustomClip<Rect> {
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
if (child != null) {
|
||||
_updateClip();
|
||||
layer = context.pushClipPath(needsCompositing, offset, _clip, _getClipPath(_clip), super.paint, clipBehavior: clipBehavior, oldLayer: layer);
|
||||
layer = context.pushClipPath(
|
||||
needsCompositing,
|
||||
offset,
|
||||
_clip,
|
||||
_getClipPath(_clip),
|
||||
super.paint,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: layer as ClipPathLayer,
|
||||
);
|
||||
} else {
|
||||
layer = null;
|
||||
}
|
||||
@ -1530,7 +1551,15 @@ class RenderClipPath extends _RenderCustomClip<Path> {
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
if (child != null) {
|
||||
_updateClip();
|
||||
layer = context.pushClipPath(needsCompositing, offset, Offset.zero & size, _clip, super.paint, clipBehavior: clipBehavior, oldLayer: layer);
|
||||
layer = context.pushClipPath(
|
||||
needsCompositing,
|
||||
offset,
|
||||
Offset.zero & size,
|
||||
_clip,
|
||||
super.paint,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: layer as ClipPathLayer,
|
||||
);
|
||||
} else {
|
||||
layer = null;
|
||||
}
|
||||
@ -1667,7 +1696,7 @@ class RenderPhysicalModel extends _RenderPhysicalModelBase<RRect> {
|
||||
);
|
||||
|
||||
@override
|
||||
PhysicalModelLayer get layer => super.layer;
|
||||
PhysicalModelLayer get layer => super.layer as PhysicalModelLayer;
|
||||
|
||||
/// The shape of the layer.
|
||||
///
|
||||
@ -1809,7 +1838,7 @@ class RenderPhysicalShape extends _RenderPhysicalModelBase<Path> {
|
||||
);
|
||||
|
||||
@override
|
||||
PhysicalModelLayer get layer => super.layer;
|
||||
PhysicalModelLayer get layer => super.layer as PhysicalModelLayer;
|
||||
|
||||
@override
|
||||
Path get _defaultClip => Path()..addRect(Offset.zero & size);
|
||||
@ -2191,7 +2220,13 @@ class RenderTransform extends RenderProxyBox {
|
||||
final Matrix4 transform = _effectiveTransform;
|
||||
final Offset childOffset = MatrixUtils.getAsTranslation(transform);
|
||||
if (childOffset == null) {
|
||||
layer = context.pushTransform(needsCompositing, offset, transform, super.paint, oldLayer: layer);
|
||||
layer = context.pushTransform(
|
||||
needsCompositing,
|
||||
offset,
|
||||
transform,
|
||||
super.paint,
|
||||
oldLayer: layer as TransformLayer,
|
||||
);
|
||||
} else {
|
||||
super.paint(context, offset + childOffset);
|
||||
layer = null;
|
||||
@ -2209,7 +2244,7 @@ class RenderTransform extends RenderProxyBox {
|
||||
super.debugFillProperties(properties);
|
||||
properties.add(TransformProperty('transform matrix', _transform));
|
||||
properties.add(DiagnosticsProperty<Offset>('origin', origin));
|
||||
properties.add(DiagnosticsProperty<Alignment>('alignment', alignment));
|
||||
properties.add(DiagnosticsProperty<AlignmentGeometry>('alignment', alignment));
|
||||
properties.add(EnumProperty<TextDirection>('textDirection', textDirection, defaultValue: null));
|
||||
properties.add(DiagnosticsProperty<bool>('transformHitTests', transformHitTests));
|
||||
}
|
||||
@ -2339,7 +2374,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 : null);
|
||||
oldLayer: layer is TransformLayer ? layer as TransformLayer : null);
|
||||
else
|
||||
super.paint(context, offset + childOffset);
|
||||
return null;
|
||||
@ -2353,7 +2388,7 @@ class RenderFittedBox extends RenderProxyBox {
|
||||
if (child != null) {
|
||||
if (_hasVisualOverflow)
|
||||
layer = context.pushClipRect(needsCompositing, offset, Offset.zero & size, _paintChildWithTransform,
|
||||
oldLayer: layer is ClipRectLayer ? layer : null);
|
||||
oldLayer: layer is ClipRectLayer ? layer as ClipRectLayer : null);
|
||||
else
|
||||
layer = _paintChildWithTransform(context, offset);
|
||||
}
|
||||
@ -2387,7 +2422,7 @@ class RenderFittedBox extends RenderProxyBox {
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
super.debugFillProperties(properties);
|
||||
properties.add(EnumProperty<BoxFit>('fit', fit));
|
||||
properties.add(DiagnosticsProperty<Alignment>('alignment', alignment));
|
||||
properties.add(DiagnosticsProperty<AlignmentGeometry>('alignment', alignment));
|
||||
properties.add(EnumProperty<TextDirection>('textDirection', textDirection, defaultValue: null));
|
||||
}
|
||||
}
|
||||
@ -2906,7 +2941,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;
|
||||
final OffsetLayer offsetLayer = layer as OffsetLayer;
|
||||
return offsetLayer.toImage(Offset.zero & size, pixelRatio: pixelRatio);
|
||||
}
|
||||
|
||||
@ -4794,7 +4829,7 @@ class RenderLeaderLayer extends RenderProxyBox {
|
||||
if (layer == null) {
|
||||
layer = LeaderLayer(link: link, offset: offset);
|
||||
} else {
|
||||
final LeaderLayer leaderLayer = layer;
|
||||
final LeaderLayer leaderLayer = layer as LeaderLayer;
|
||||
leaderLayer
|
||||
..link = link
|
||||
..offset = offset;
|
||||
@ -4895,7 +4930,7 @@ class RenderFollowerLayer extends RenderProxyBox {
|
||||
|
||||
/// The layer we created when we were last painted.
|
||||
@override
|
||||
FollowerLayer get layer => super.layer;
|
||||
FollowerLayer get layer => super.layer as FollowerLayer;
|
||||
|
||||
/// Return the transform that was used in the last composition phase, if any.
|
||||
///
|
||||
|
@ -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;
|
||||
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;
|
||||
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, { Offset position }) {
|
||||
if (child != null) {
|
||||
final BoxParentData childParentData = child.parentData;
|
||||
final BoxParentData childParentData = child.parentData as BoxParentData;
|
||||
return result.addWithPaintOffset(
|
||||
offset: childParentData.offset,
|
||||
position: position,
|
||||
@ -204,7 +204,7 @@ class RenderPadding extends RenderShiftedBox {
|
||||
}
|
||||
final BoxConstraints innerConstraints = constraints.deflate(_resolvedPadding);
|
||||
child.layout(innerConstraints, parentUsesSize: true);
|
||||
final BoxParentData childParentData = child.parentData;
|
||||
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,
|
||||
@ -321,8 +321,8 @@ abstract class RenderAligningShiftedBox extends RenderShiftedBox {
|
||||
assert(child.hasSize);
|
||||
assert(hasSize);
|
||||
assert(_resolvedAlignment != null);
|
||||
final BoxParentData childParentData = child.parentData;
|
||||
childParentData.offset = _resolvedAlignment.alongOffset(size - child.size);
|
||||
final BoxParentData childParentData = child.parentData as BoxParentData;
|
||||
childParentData.offset = _resolvedAlignment.alongOffset(size - child.size as Offset);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -411,7 +411,7 @@ class RenderPositionedBox extends RenderAligningShiftedBox {
|
||||
..strokeWidth = 1.0
|
||||
..color = const Color(0xFFFFFF00);
|
||||
path = Path();
|
||||
final BoxParentData childParentData = child.parentData;
|
||||
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);
|
||||
@ -668,7 +668,7 @@ class RenderUnconstrainedBox extends RenderAligningShiftedBox with DebugOverflow
|
||||
child.layout(childConstraints, parentUsesSize: true);
|
||||
size = constraints.constrain(child.size);
|
||||
alignChild();
|
||||
final BoxParentData childParentData = child.parentData;
|
||||
final BoxParentData childParentData = child.parentData as BoxParentData;
|
||||
_overflowContainerRect = Offset.zero & size;
|
||||
_overflowChildRect = childParentData.offset & child.size;
|
||||
} else {
|
||||
@ -1121,7 +1121,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;
|
||||
final BoxParentData childParentData = child.parentData as BoxParentData;
|
||||
childParentData.offset = delegate.getPositionForChild(size, childConstraints.isTight ? childConstraints.smallest : child.size);
|
||||
}
|
||||
}
|
||||
@ -1187,7 +1187,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;
|
||||
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));
|
||||
|
@ -12,6 +12,7 @@ import 'package:vector_math/vector_math_64.dart';
|
||||
import 'binding.dart';
|
||||
import 'box.dart';
|
||||
import 'debug.dart';
|
||||
import 'layer.dart';
|
||||
import 'object.dart';
|
||||
import 'viewport.dart';
|
||||
import 'viewport_offset.dart';
|
||||
@ -452,18 +453,18 @@ class SliverConstraints extends Constraints {
|
||||
return true;
|
||||
if (other is! SliverConstraints)
|
||||
return false;
|
||||
final SliverConstraints typedOther = other;
|
||||
assert(typedOther.debugAssertIsValid());
|
||||
return typedOther.axisDirection == axisDirection
|
||||
&& typedOther.growthDirection == growthDirection
|
||||
&& typedOther.scrollOffset == scrollOffset
|
||||
&& typedOther.overlap == overlap
|
||||
&& typedOther.remainingPaintExtent == remainingPaintExtent
|
||||
&& typedOther.crossAxisExtent == crossAxisExtent
|
||||
&& typedOther.crossAxisDirection == crossAxisDirection
|
||||
&& typedOther.viewportMainAxisExtent == viewportMainAxisExtent
|
||||
&& typedOther.remainingCacheExtent == remainingCacheExtent
|
||||
&& typedOther.cacheOrigin == cacheOrigin;
|
||||
assert(other is SliverConstraints && other.debugAssertIsValid());
|
||||
return other is SliverConstraints
|
||||
&& other.axisDirection == axisDirection
|
||||
&& other.growthDirection == growthDirection
|
||||
&& other.scrollOffset == scrollOffset
|
||||
&& other.overlap == overlap
|
||||
&& other.remainingPaintExtent == remainingPaintExtent
|
||||
&& other.crossAxisExtent == crossAxisExtent
|
||||
&& other.crossAxisDirection == crossAxisDirection
|
||||
&& other.viewportMainAxisExtent == viewportMainAxisExtent
|
||||
&& other.remainingCacheExtent == remainingCacheExtent
|
||||
&& other.cacheOrigin == cacheOrigin;
|
||||
}
|
||||
|
||||
@override
|
||||
@ -870,7 +871,7 @@ class SliverHitTestEntry extends HitTestEntry {
|
||||
super(target);
|
||||
|
||||
@override
|
||||
RenderSliver get target => super.target;
|
||||
RenderSliver get target => super.target as RenderSliver;
|
||||
|
||||
/// The distance in the [AxisDirection] from the edge of the sliver's painted
|
||||
/// area (as given by the [SliverConstraints.scrollOffset]) to the hit point.
|
||||
@ -1110,7 +1111,7 @@ List<DiagnosticsNode> _debugCompareFloats(String labelA, double valueA, String l
|
||||
abstract class RenderSliver extends RenderObject {
|
||||
// layout input
|
||||
@override
|
||||
SliverConstraints get constraints => super.constraints;
|
||||
SliverConstraints get constraints => super.constraints as SliverConstraints;
|
||||
|
||||
/// The amount of space this sliver occupies.
|
||||
///
|
||||
@ -1327,7 +1328,7 @@ abstract class RenderSliver extends RenderObject {
|
||||
final double a = constraints.scrollOffset;
|
||||
final double b = constraints.scrollOffset + constraints.remainingPaintExtent;
|
||||
// the clamp on the next line is to avoid floating point rounding errors
|
||||
return (to.clamp(a, b) - from.clamp(a, b)).clamp(0.0, constraints.remainingPaintExtent);
|
||||
return (to.clamp(a, b) - from.clamp(a, b)).clamp(0.0, constraints.remainingPaintExtent) as double;
|
||||
}
|
||||
|
||||
/// Computes the portion of the region from `from` to `to` that is within
|
||||
@ -1343,7 +1344,7 @@ abstract class RenderSliver extends RenderObject {
|
||||
final double a = constraints.scrollOffset + constraints.cacheOrigin;
|
||||
final double b = constraints.scrollOffset + constraints.remainingCacheExtent;
|
||||
// the clamp on the next line is to avoid floating point rounding errors
|
||||
return (to.clamp(a, b) - from.clamp(a, b)).clamp(0.0, constraints.remainingCacheExtent);
|
||||
return (to.clamp(a, b) - from.clamp(a, b)).clamp(0.0, constraints.remainingCacheExtent) as double;
|
||||
}
|
||||
|
||||
/// Returns the distance from the leading _visible_ edge of the sliver to the
|
||||
@ -1719,7 +1720,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;
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
assert(constraints.axisDirection != null);
|
||||
assert(constraints.growthDirection != null);
|
||||
switch (applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
|
||||
@ -1756,14 +1757,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;
|
||||
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;
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
context.paintChild(child, offset + childParentData.paintOffset);
|
||||
}
|
||||
}
|
||||
@ -1945,7 +1946,7 @@ class RenderSliverOpacity extends RenderSliver with RenderObjectWithChildMixin<R
|
||||
offset,
|
||||
_alpha,
|
||||
_paintWithOpacity,
|
||||
oldLayer: layer,
|
||||
oldLayer: layer as OpacityLayer,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1953,7 +1954,7 @@ class RenderSliverOpacity extends RenderSliver with RenderObjectWithChildMixin<R
|
||||
@override
|
||||
void applyPaintTransform(RenderObject child, Matrix4 transform) {
|
||||
assert(child != null);
|
||||
final SliverPhysicalParentData childParentData = child.parentData;
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
childParentData.applyPaintTransform(transform);
|
||||
}
|
||||
|
||||
@ -2067,7 +2068,7 @@ class RenderSliverIgnorePointer extends RenderSliver with RenderObjectWithChildM
|
||||
@override
|
||||
void applyPaintTransform(RenderObject child, Matrix4 transform) {
|
||||
assert(child != null);
|
||||
final SliverPhysicalParentData childParentData = child.parentData;
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
childParentData.applyPaintTransform(transform);
|
||||
}
|
||||
|
||||
@ -2174,7 +2175,7 @@ class RenderSliverOffstage extends RenderSliver with RenderObjectWithChildMixin<
|
||||
@override
|
||||
void applyPaintTransform(RenderObject child, Matrix4 transform) {
|
||||
assert(child != null);
|
||||
final SliverPhysicalParentData childParentData = child.parentData;
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
childParentData.applyPaintTransform(transform);
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ abstract class RenderSliverFixedExtentBoxAdaptor extends RenderSliverMultiBoxAda
|
||||
geometry = SliverGeometry(scrollOffsetCorrection: index * itemExtent);
|
||||
return;
|
||||
}
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
childParentData.layoutOffset = indexToLayoutOffset(itemExtent, index);
|
||||
assert(childParentData.index == index);
|
||||
trailingChildWithLayout ??= child;
|
||||
@ -243,7 +243,7 @@ abstract class RenderSliverFixedExtentBoxAdaptor extends RenderSliverMultiBoxAda
|
||||
|
||||
if (trailingChildWithLayout == null) {
|
||||
firstChild.layout(childConstraints);
|
||||
final SliverMultiBoxAdaptorParentData childParentData = firstChild.parentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = firstChild.parentData as SliverMultiBoxAdaptorParentData;
|
||||
childParentData.layoutOffset = indexToLayoutOffset(itemExtent, firstIndex);
|
||||
trailingChildWithLayout = firstChild;
|
||||
}
|
||||
@ -263,7 +263,7 @@ abstract class RenderSliverFixedExtentBoxAdaptor extends RenderSliverMultiBoxAda
|
||||
}
|
||||
trailingChildWithLayout = child;
|
||||
assert(child != null);
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
assert(childParentData.index == index);
|
||||
childParentData.layoutOffset = indexToLayoutOffset(itemExtent, childParentData.index);
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor {
|
||||
|
||||
@override
|
||||
double childCrossAxisPosition(RenderBox child) {
|
||||
final SliverGridParentData childParentData = child.parentData;
|
||||
final SliverGridParentData childParentData = child.parentData as SliverGridParentData;
|
||||
return childParentData.crossAxisOffset;
|
||||
}
|
||||
|
||||
@ -528,8 +528,10 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor {
|
||||
if (firstChild != null) {
|
||||
final int oldFirstIndex = indexOf(firstChild);
|
||||
final int oldLastIndex = indexOf(lastChild);
|
||||
final int leadingGarbage = (firstIndex - oldFirstIndex).clamp(0, childCount);
|
||||
final int trailingGarbage = targetLastIndex == null ? 0 : (oldLastIndex - targetLastIndex).clamp(0, childCount);
|
||||
final int leadingGarbage = (firstIndex - oldFirstIndex).clamp(0, childCount) as int;
|
||||
final int trailingGarbage = targetLastIndex == null
|
||||
? 0
|
||||
: ((oldLastIndex - targetLastIndex).clamp(0, childCount) as int);
|
||||
collectGarbage(leadingGarbage, trailingGarbage);
|
||||
} else {
|
||||
collectGarbage(0, 0);
|
||||
@ -559,7 +561,7 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor {
|
||||
final RenderBox child = insertAndLayoutLeadingChild(
|
||||
gridGeometry.getBoxConstraints(constraints),
|
||||
);
|
||||
final SliverGridParentData childParentData = child.parentData;
|
||||
final SliverGridParentData childParentData = child.parentData as SliverGridParentData;
|
||||
childParentData.layoutOffset = gridGeometry.scrollOffset;
|
||||
childParentData.crossAxisOffset = gridGeometry.crossAxisOffset;
|
||||
assert(childParentData.index == index);
|
||||
@ -569,7 +571,7 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor {
|
||||
|
||||
if (trailingChildWithLayout == null) {
|
||||
firstChild.layout(firstChildGridGeometry.getBoxConstraints(constraints));
|
||||
final SliverGridParentData childParentData = firstChild.parentData;
|
||||
final SliverGridParentData childParentData = firstChild.parentData as SliverGridParentData;
|
||||
childParentData.layoutOffset = firstChildGridGeometry.scrollOffset;
|
||||
childParentData.crossAxisOffset = firstChildGridGeometry.crossAxisOffset;
|
||||
trailingChildWithLayout = firstChild;
|
||||
@ -590,7 +592,7 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor {
|
||||
}
|
||||
trailingChildWithLayout = child;
|
||||
assert(child != null);
|
||||
final SliverGridParentData childParentData = child.parentData;
|
||||
final SliverGridParentData childParentData = child.parentData as SliverGridParentData;
|
||||
childParentData.layoutOffset = gridGeometry.scrollOffset;
|
||||
childParentData.crossAxisOffset = gridGeometry.crossAxisOffset;
|
||||
assert(childParentData.index == index);
|
||||
|
@ -99,7 +99,7 @@ class RenderSliverList extends RenderSliverMultiBoxAdaptor {
|
||||
earliestUsefulChild = insertAndLayoutLeadingChild(childConstraints, parentUsesSize: true);
|
||||
|
||||
if (earliestUsefulChild == null) {
|
||||
final SliverMultiBoxAdaptorParentData childParentData = firstChild.parentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = firstChild.parentData as SliverMultiBoxAdaptorParentData;
|
||||
childParentData.layoutOffset = 0.0;
|
||||
|
||||
if (scrollOffset == 0.0) {
|
||||
@ -142,12 +142,12 @@ class RenderSliverList extends RenderSliverMultiBoxAdaptor {
|
||||
geometry = SliverGeometry(
|
||||
scrollOffsetCorrection: correction - earliestScrollOffset,
|
||||
);
|
||||
final SliverMultiBoxAdaptorParentData childParentData = firstChild.parentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = firstChild.parentData as SliverMultiBoxAdaptorParentData;
|
||||
childParentData.layoutOffset = 0.0;
|
||||
return;
|
||||
}
|
||||
|
||||
final SliverMultiBoxAdaptorParentData childParentData = earliestUsefulChild.parentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = earliestUsefulChild.parentData as SliverMultiBoxAdaptorParentData;
|
||||
childParentData.layoutOffset = firstChildScrollOffset;
|
||||
assert(earliestUsefulChild == firstChild);
|
||||
leadingChildWithLayout = earliestUsefulChild;
|
||||
@ -207,7 +207,7 @@ class RenderSliverList extends RenderSliverMultiBoxAdaptor {
|
||||
trailingChildWithLayout = child;
|
||||
}
|
||||
assert(child != null);
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
childParentData.layoutOffset = endScrollOffset;
|
||||
assert(childParentData.index == index);
|
||||
endScrollOffset = childScrollOffset(child) + paintExtentOf(child);
|
||||
|
@ -243,9 +243,9 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
|
||||
@override
|
||||
void adoptChild(RenderObject child) {
|
||||
super.adoptChild(child);
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
if (!childParentData._keptAlive)
|
||||
childManager.didAdoptChild(child);
|
||||
childManager.didAdoptChild(child as RenderBox);
|
||||
}
|
||||
|
||||
bool _debugAssertChildListLocked() => childManager.debugAssertChildListLocked();
|
||||
@ -285,7 +285,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;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
if (!childParentData.keptAlive) {
|
||||
super.move(child, after: after);
|
||||
childManager.didAdoptChild(child); // updates the slot in the parentData
|
||||
@ -318,7 +318,7 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
|
||||
|
||||
@override
|
||||
void remove(RenderBox child) {
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
if (!childParentData._keptAlive) {
|
||||
super.remove(child);
|
||||
return;
|
||||
@ -344,7 +344,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;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
assert(childParentData._keptAlive);
|
||||
dropChild(child);
|
||||
child.parentData = childParentData;
|
||||
@ -357,7 +357,7 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
|
||||
}
|
||||
|
||||
void _destroyOrCacheChild(RenderBox child) {
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
if (childParentData.keepAlive) {
|
||||
assert(!childParentData._keptAlive);
|
||||
remove(child);
|
||||
@ -428,7 +428,7 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
|
||||
if (firstChild != null) {
|
||||
assert(firstChild == lastChild);
|
||||
assert(indexOf(firstChild) == index);
|
||||
final SliverMultiBoxAdaptorParentData firstChildParentData = firstChild.parentData;
|
||||
final SliverMultiBoxAdaptorParentData firstChildParentData = firstChild.parentData as SliverMultiBoxAdaptorParentData;
|
||||
firstChildParentData.layoutOffset = layoutOffset;
|
||||
return true;
|
||||
}
|
||||
@ -522,11 +522,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;
|
||||
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;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
return !childParentData.keepAlive;
|
||||
}).isEmpty);
|
||||
});
|
||||
@ -536,7 +536,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;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
assert(childParentData.index != null);
|
||||
return childParentData.index;
|
||||
}
|
||||
@ -577,14 +577,14 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
|
||||
double childScrollOffset(RenderObject child) {
|
||||
assert(child != null);
|
||||
assert(child.parent == this);
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
assert(childParentData.layoutOffset != null);
|
||||
return childParentData.layoutOffset;
|
||||
}
|
||||
|
||||
@override
|
||||
void applyPaintTransform(RenderObject child, Matrix4 transform) {
|
||||
applyPaintTransformForBoxChild(child, transform);
|
||||
applyPaintTransformForBoxChild(child as RenderBox, transform);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -674,7 +674,7 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
|
||||
if (firstChild != null) {
|
||||
RenderBox child = firstChild;
|
||||
while (true) {
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
children.add(child.toDiagnosticsNode(name: 'child with index ${childParentData.index}'));
|
||||
if (child == lastChild)
|
||||
break;
|
||||
|
@ -188,7 +188,7 @@ abstract class RenderSliverEdgeInsetsPadding extends RenderSliver with RenderObj
|
||||
hasVisualOverflow: childLayoutGeometry.hasVisualOverflow,
|
||||
);
|
||||
|
||||
final SliverPhysicalParentData childParentData = child.parentData;
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
assert(constraints.axisDirection != null);
|
||||
assert(constraints.growthDirection != null);
|
||||
switch (applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
|
||||
@ -215,7 +215,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;
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
result.addWithAxisOffset(
|
||||
mainAxisPosition: mainAxisPosition,
|
||||
crossAxisPosition: crossAxisPosition,
|
||||
@ -264,14 +264,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;
|
||||
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;
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
context.paintChild(child, offset + childParentData.paintOffset);
|
||||
}
|
||||
}
|
||||
@ -287,7 +287,7 @@ abstract class RenderSliverEdgeInsetsPadding extends RenderSliver with RenderObj
|
||||
Rect innerRect;
|
||||
if (child != null) {
|
||||
childSize = child.getAbsoluteSize();
|
||||
final SliverPhysicalParentData childParentData = child.parentData;
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
innerRect = (offset + childParentData.paintOffset) & childSize;
|
||||
assert(innerRect.top >= outerRect.top);
|
||||
assert(innerRect.left >= outerRect.left);
|
||||
|
@ -231,7 +231,7 @@ abstract class RenderSliverPersistentHeader extends RenderSliver with RenderObje
|
||||
void applyPaintTransform(RenderObject child, Matrix4 transform) {
|
||||
assert(child != null);
|
||||
assert(child == this.child);
|
||||
applyPaintTransformForBoxChild(child, transform);
|
||||
applyPaintTransformForBoxChild(child as RenderBox, transform);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -321,7 +321,7 @@ abstract class RenderSliverScrollingPersistentHeader extends RenderSliverPersist
|
||||
geometry = SliverGeometry(
|
||||
scrollExtent: maxExtent,
|
||||
paintOrigin: math.min(constraints.overlap, 0.0),
|
||||
paintExtent: paintExtent.clamp(0.0, constraints.remainingPaintExtent),
|
||||
paintExtent: paintExtent.clamp(0.0, constraints.remainingPaintExtent) as double,
|
||||
maxPaintExtent: maxExtent + stretchOffset,
|
||||
hasVisualOverflow: true, // Conservatively say we do have overflow to avoid complexity.
|
||||
);
|
||||
@ -337,7 +337,7 @@ abstract class RenderSliverScrollingPersistentHeader extends RenderSliverPersist
|
||||
geometry = SliverGeometry(
|
||||
scrollExtent: maxExtent,
|
||||
paintOrigin: math.min(constraints.overlap, 0.0),
|
||||
paintExtent: paintExtent.clamp(0.0, constraints.remainingPaintExtent),
|
||||
paintExtent: paintExtent.clamp(0.0, constraints.remainingPaintExtent) as double,
|
||||
maxPaintExtent: maxExtent,
|
||||
hasVisualOverflow: true, // Conservatively say we do have overflow to avoid complexity.
|
||||
);
|
||||
@ -373,7 +373,7 @@ abstract class RenderSliverPinnedPersistentHeader extends RenderSliverPersistent
|
||||
final bool overlapsContent = constraints.overlap > 0.0;
|
||||
excludeFromSemanticsScrolling = overlapsContent || (constraints.scrollOffset > maxExtent - minExtent);
|
||||
layoutChild(constraints.scrollOffset, maxExtent, overlapsContent: overlapsContent);
|
||||
final double layoutExtent = (maxExtent - constraints.scrollOffset).clamp(0.0, constraints.remainingPaintExtent);
|
||||
final double layoutExtent = (maxExtent - constraints.scrollOffset).clamp(0.0, constraints.remainingPaintExtent) as double;
|
||||
final double stretchOffset = stretchConfiguration != null ?
|
||||
constraints.overlap.abs() :
|
||||
0.0;
|
||||
@ -505,8 +505,8 @@ abstract class RenderSliverFloatingPersistentHeader extends RenderSliverPersiste
|
||||
geometry = SliverGeometry(
|
||||
scrollExtent: maxExtent,
|
||||
paintOrigin: math.min(constraints.overlap, 0.0),
|
||||
paintExtent: paintExtent.clamp(0.0, constraints.remainingPaintExtent),
|
||||
layoutExtent: layoutExtent.clamp(0.0, constraints.remainingPaintExtent),
|
||||
paintExtent: paintExtent.clamp(0.0, constraints.remainingPaintExtent) as double,
|
||||
layoutExtent: layoutExtent.clamp(0.0, constraints.remainingPaintExtent) as double,
|
||||
maxPaintExtent: maxExtent + stretchOffset,
|
||||
hasVisualOverflow: true, // Conservatively say we do have overflow to avoid complexity.
|
||||
);
|
||||
@ -565,7 +565,7 @@ abstract class RenderSliverFloatingPersistentHeader extends RenderSliverPersiste
|
||||
if (delta > 0.0) // If we are trying to expand when allowFloatingExpansion is false,
|
||||
delta = 0.0; // disallow the expansion. (But allow shrinking, i.e. delta < 0.0 is fine.)
|
||||
}
|
||||
_effectiveScrollOffset = (_effectiveScrollOffset - delta).clamp(0.0, constraints.scrollOffset);
|
||||
_effectiveScrollOffset = (_effectiveScrollOffset - delta).clamp(0.0, constraints.scrollOffset) as double;
|
||||
} else {
|
||||
_effectiveScrollOffset = constraints.scrollOffset;
|
||||
}
|
||||
@ -627,7 +627,7 @@ abstract class RenderSliverFloatingPinnedPersistentHeader extends RenderSliverFl
|
||||
final double clampedPaintExtent = paintExtent.clamp(
|
||||
minAllowedExtent,
|
||||
constraints.remainingPaintExtent,
|
||||
);
|
||||
) as double;
|
||||
final double layoutExtent = maxExtent - constraints.scrollOffset;
|
||||
final double stretchOffset = stretchConfiguration != null ?
|
||||
constraints.overlap.abs() :
|
||||
@ -636,7 +636,7 @@ abstract class RenderSliverFloatingPinnedPersistentHeader extends RenderSliverFl
|
||||
scrollExtent: maxExtent,
|
||||
paintOrigin: math.min(constraints.overlap, 0.0),
|
||||
paintExtent: clampedPaintExtent,
|
||||
layoutExtent: layoutExtent.clamp(0.0, clampedPaintExtent),
|
||||
layoutExtent: layoutExtent.clamp(0.0, clampedPaintExtent) as double,
|
||||
maxPaintExtent: maxExtent + stretchOffset,
|
||||
maxScrollObstructionExtent: maxExtent,
|
||||
hasVisualOverflow: true, // Conservatively say we do have overflow to avoid complexity.
|
||||
|
@ -154,13 +154,11 @@ class RelativeRect {
|
||||
bool operator ==(dynamic other) {
|
||||
if (identical(this, other))
|
||||
return true;
|
||||
if (other is! RelativeRect)
|
||||
return false;
|
||||
final RelativeRect typedOther = other;
|
||||
return left == typedOther.left &&
|
||||
top == typedOther.top &&
|
||||
right == typedOther.right &&
|
||||
bottom == typedOther.bottom;
|
||||
return other is RelativeRect
|
||||
&& other.left == left
|
||||
&& other.top == top
|
||||
&& other.right == right
|
||||
&& other.bottom == bottom;
|
||||
}
|
||||
|
||||
@override
|
||||
@ -431,7 +429,7 @@ class RenderStack extends RenderBox
|
||||
double extent = 0.0;
|
||||
RenderBox child = firstChild;
|
||||
while (child != null) {
|
||||
final StackParentData childParentData = child.parentData;
|
||||
final StackParentData childParentData = child.parentData as StackParentData;
|
||||
if (!childParentData.isPositioned)
|
||||
extent = math.max(extent, mainChildSizeGetter(child));
|
||||
assert(child.parentData == childParentData);
|
||||
@ -497,7 +495,7 @@ class RenderStack extends RenderBox
|
||||
|
||||
RenderBox child = firstChild;
|
||||
while (child != null) {
|
||||
final StackParentData childParentData = child.parentData;
|
||||
final StackParentData childParentData = child.parentData as StackParentData;
|
||||
|
||||
if (!childParentData.isPositioned) {
|
||||
hasNonPositionedChildren = true;
|
||||
@ -524,10 +522,10 @@ class RenderStack extends RenderBox
|
||||
|
||||
child = firstChild;
|
||||
while (child != null) {
|
||||
final StackParentData childParentData = child.parentData;
|
||||
final StackParentData childParentData = child.parentData as StackParentData;
|
||||
|
||||
if (!childParentData.isPositioned) {
|
||||
childParentData.offset = _resolvedAlignment.alongOffset(size - child.size);
|
||||
childParentData.offset = _resolvedAlignment.alongOffset(size - child.size as Offset);
|
||||
} else {
|
||||
BoxConstraints childConstraints = const BoxConstraints();
|
||||
|
||||
@ -549,7 +547,7 @@ class RenderStack extends RenderBox
|
||||
} else if (childParentData.right != null) {
|
||||
x = size.width - childParentData.right - child.size.width;
|
||||
} else {
|
||||
x = _resolvedAlignment.alongOffset(size - child.size).dx;
|
||||
x = _resolvedAlignment.alongOffset(size - child.size as Offset).dx;
|
||||
}
|
||||
|
||||
if (x < 0.0 || x + child.size.width > size.width)
|
||||
@ -561,7 +559,7 @@ class RenderStack extends RenderBox
|
||||
} else if (childParentData.bottom != null) {
|
||||
y = size.height - childParentData.bottom - child.size.height;
|
||||
} else {
|
||||
y = _resolvedAlignment.alongOffset(size - child.size).dy;
|
||||
y = _resolvedAlignment.alongOffset(size - child.size as Offset).dy;
|
||||
}
|
||||
|
||||
if (y < 0.0 || y + child.size.height > size.height)
|
||||
@ -653,7 +651,7 @@ class RenderIndexedStack extends RenderStack {
|
||||
RenderBox child = firstChild;
|
||||
int i = 0;
|
||||
while (child != null && i < index) {
|
||||
final StackParentData childParentData = child.parentData;
|
||||
final StackParentData childParentData = child.parentData as StackParentData;
|
||||
child = childParentData.nextSibling;
|
||||
i += 1;
|
||||
}
|
||||
@ -668,7 +666,7 @@ class RenderIndexedStack extends RenderStack {
|
||||
return false;
|
||||
assert(position != null);
|
||||
final RenderBox child = _childAtIndex();
|
||||
final StackParentData childParentData = child.parentData;
|
||||
final StackParentData childParentData = child.parentData as StackParentData;
|
||||
return result.addWithPaintOffset(
|
||||
offset: childParentData.offset,
|
||||
position: position,
|
||||
@ -684,7 +682,7 @@ class RenderIndexedStack extends RenderStack {
|
||||
if (firstChild == null || index == null)
|
||||
return;
|
||||
final RenderBox child = _childAtIndex();
|
||||
final StackParentData childParentData = child.parentData;
|
||||
final StackParentData childParentData = child.parentData as StackParentData;
|
||||
context.paintChild(child, childParentData.offset + offset);
|
||||
}
|
||||
|
||||
|
@ -1036,7 +1036,7 @@ class RenderTable extends RenderBox {
|
||||
final int xy = x + y * columns;
|
||||
final RenderBox child = _children[xy];
|
||||
if (child != null) {
|
||||
final TableCellParentData childParentData = child.parentData;
|
||||
final TableCellParentData childParentData = child.parentData as TableCellParentData;
|
||||
assert(childParentData != null);
|
||||
childParentData.x = x;
|
||||
childParentData.y = y;
|
||||
@ -1075,7 +1075,7 @@ class RenderTable extends RenderBox {
|
||||
final int xy = x + y * columns;
|
||||
final RenderBox child = _children[xy];
|
||||
if (child != null) {
|
||||
final TableCellParentData childParentData = child.parentData;
|
||||
final TableCellParentData childParentData = child.parentData as TableCellParentData;
|
||||
switch (childParentData.verticalAlignment ?? defaultVerticalAlignment) {
|
||||
case TableCellVerticalAlignment.baseline:
|
||||
if (baselines[x] != null)
|
||||
@ -1110,7 +1110,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;
|
||||
final BoxParentData childParentData = child.parentData as BoxParentData;
|
||||
final bool isHit = result.addWithPaintOffset(
|
||||
offset: childParentData.offset,
|
||||
position: position,
|
||||
@ -1156,7 +1156,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;
|
||||
final BoxParentData childParentData = child.parentData as BoxParentData;
|
||||
context.paintChild(child, childParentData.offset + offset);
|
||||
}
|
||||
}
|
||||
|
@ -265,13 +265,13 @@ class TableBorder {
|
||||
return true;
|
||||
if (runtimeType != other.runtimeType)
|
||||
return false;
|
||||
final TableBorder typedOther = other;
|
||||
return top == typedOther.top
|
||||
&& right == typedOther.right
|
||||
&& bottom == typedOther.bottom
|
||||
&& left == typedOther.left
|
||||
&& horizontalInside == typedOther.horizontalInside
|
||||
&& verticalInside == typedOther.verticalInside;
|
||||
return other is TableBorder
|
||||
&& other.top == top
|
||||
&& other.right == right
|
||||
&& other.bottom == bottom
|
||||
&& other.left == left
|
||||
&& other.horizontalInside == horizontalInside
|
||||
&& other.verticalInside == verticalInside;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -139,9 +139,9 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
|
||||
|
||||
Matrix4 _rootTransform;
|
||||
|
||||
Layer _updateMatricesAndCreateNewRootLayer() {
|
||||
TransformLayer _updateMatricesAndCreateNewRootLayer() {
|
||||
_rootTransform = configuration.toMatrix();
|
||||
final ContainerLayer rootLayer = TransformLayer(transform: _rootTransform);
|
||||
final TransformLayer rootLayer = TransformLayer(transform: _rootTransform);
|
||||
rootLayer.attach(this);
|
||||
assert(_rootTransform != null);
|
||||
return rootLayer;
|
||||
|
@ -43,7 +43,7 @@ abstract class RenderAbstractViewport extends RenderObject {
|
||||
while (object != null) {
|
||||
if (object is RenderAbstractViewport)
|
||||
return object;
|
||||
object = object.parent;
|
||||
object = object.parent as RenderObject;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -659,18 +659,18 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
|
||||
RenderBox pivot;
|
||||
bool onlySlivers = target is RenderSliver; // ... between viewport and `target` (`target` included).
|
||||
while (child.parent != this) {
|
||||
assert(child.parent != null, '$target must be a descendant of $this');
|
||||
final RenderObject parent = child.parent as RenderObject;
|
||||
assert(parent != null, '$target must be a descendant of $this');
|
||||
if (child is RenderBox) {
|
||||
pivot = child;
|
||||
}
|
||||
if (child.parent is RenderSliver) {
|
||||
final RenderSliver parent = child.parent;
|
||||
if (parent is RenderSliver) {
|
||||
leadingScrollOffset += parent.childScrollOffset(child);
|
||||
} else {
|
||||
onlySlivers = false;
|
||||
leadingScrollOffset = 0.0;
|
||||
}
|
||||
child = child.parent;
|
||||
child = parent;
|
||||
}
|
||||
|
||||
if (pivot != null) {
|
||||
@ -678,7 +678,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;
|
||||
final RenderSliver pivotParent = pivot.parent as RenderSliver;
|
||||
|
||||
final Matrix4 transform = target.getTransformTo(pivot);
|
||||
final Rect bounds = MatrixUtils.transformRect(transform, rect);
|
||||
@ -739,7 +739,7 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
|
||||
break;
|
||||
}
|
||||
} else if (onlySlivers) {
|
||||
final RenderSliver targetSliver = target;
|
||||
final RenderSliver targetSliver = target as RenderSliver;
|
||||
targetMainAxisExtent = targetSliver.geometry.scrollExtent;
|
||||
} else {
|
||||
return RevealedOffset(offset: offset.pixels, rect: rect);
|
||||
@ -747,7 +747,7 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
|
||||
|
||||
assert(child.parent == this);
|
||||
assert(child is RenderSliver);
|
||||
final RenderSliver sliver = child;
|
||||
final RenderSliver sliver = child as RenderSliver;
|
||||
final double extentOfPinnedSlivers = maxScrollObstructionExtentBefore(sliver);
|
||||
leadingScrollOffset = scrollOffsetOf(sliver, leadingScrollOffset);
|
||||
switch (sliver.constraints.growthDirection) {
|
||||
@ -1064,7 +1064,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);
|
||||
final Matrix4 transform = descendant.getTransformTo(viewport.parent as RenderObject);
|
||||
return MatrixUtils.transformRect(transform, rect ?? descendant.paintBounds);
|
||||
}
|
||||
|
||||
@ -1388,8 +1388,8 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
|
||||
// to the zero scroll offset (the line between the forward slivers and the
|
||||
// reverse slivers).
|
||||
final double centerOffset = mainAxisExtent * anchor - correctedOffset;
|
||||
final double reverseDirectionRemainingPaintExtent = centerOffset.clamp(0.0, mainAxisExtent);
|
||||
final double forwardDirectionRemainingPaintExtent = (mainAxisExtent - centerOffset).clamp(0.0, mainAxisExtent);
|
||||
final double reverseDirectionRemainingPaintExtent = centerOffset.clamp(0.0, mainAxisExtent) as double;
|
||||
final double forwardDirectionRemainingPaintExtent = (mainAxisExtent - centerOffset).clamp(0.0, mainAxisExtent) as double;
|
||||
|
||||
switch (cacheExtentStyle) {
|
||||
case CacheExtentStyle.pixel:
|
||||
@ -1402,8 +1402,8 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
|
||||
|
||||
final double fullCacheExtent = mainAxisExtent + 2 * _calculatedCacheExtent;
|
||||
final double centerCacheOffset = centerOffset + _calculatedCacheExtent;
|
||||
final double reverseDirectionRemainingCacheExtent = centerCacheOffset.clamp(0.0, fullCacheExtent);
|
||||
final double forwardDirectionRemainingCacheExtent = (fullCacheExtent - centerCacheOffset).clamp(0.0, fullCacheExtent);
|
||||
final double reverseDirectionRemainingCacheExtent = centerCacheOffset.clamp(0.0, fullCacheExtent) as double;
|
||||
final double forwardDirectionRemainingCacheExtent = (fullCacheExtent - centerCacheOffset).clamp(0.0, fullCacheExtent) as double;
|
||||
|
||||
final RenderSliver leadingNegativeChild = childBefore(center);
|
||||
|
||||
@ -1420,7 +1420,7 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
|
||||
growthDirection: GrowthDirection.reverse,
|
||||
advance: childBefore,
|
||||
remainingCacheExtent: reverseDirectionRemainingCacheExtent,
|
||||
cacheOrigin: (mainAxisExtent - centerOffset).clamp(-_calculatedCacheExtent, 0.0),
|
||||
cacheOrigin: (mainAxisExtent - centerOffset).clamp(-_calculatedCacheExtent, 0.0) as double,
|
||||
);
|
||||
if (result != 0.0)
|
||||
return -result;
|
||||
@ -1438,7 +1438,7 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
|
||||
growthDirection: GrowthDirection.forward,
|
||||
advance: childAfter,
|
||||
remainingCacheExtent: forwardDirectionRemainingCacheExtent,
|
||||
cacheOrigin: centerOffset.clamp(-_calculatedCacheExtent, 0.0),
|
||||
cacheOrigin: centerOffset.clamp(-_calculatedCacheExtent, 0.0) as double,
|
||||
);
|
||||
}
|
||||
|
||||
@ -1461,13 +1461,13 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
|
||||
|
||||
@override
|
||||
void updateChildLayoutOffset(RenderSliver child, double layoutOffset, GrowthDirection growthDirection) {
|
||||
final SliverPhysicalParentData childParentData = child.parentData;
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
childParentData.paintOffset = computeAbsolutePaintOffset(child, layoutOffset, growthDirection);
|
||||
}
|
||||
|
||||
@override
|
||||
Offset paintOffsetOf(RenderSliver child) {
|
||||
final SliverPhysicalParentData childParentData = child.parentData;
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
return childParentData.paintOffset;
|
||||
}
|
||||
|
||||
@ -1526,7 +1526,7 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
|
||||
@override
|
||||
void applyPaintTransform(RenderObject child, Matrix4 transform) {
|
||||
assert(child != null);
|
||||
final SliverPhysicalParentData childParentData = child.parentData;
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
childParentData.applyPaintTransform(transform);
|
||||
}
|
||||
|
||||
@ -1534,7 +1534,7 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
|
||||
double computeChildMainAxisPosition(RenderSliver child, double parentMainAxisPosition) {
|
||||
assert(child != null);
|
||||
assert(child.constraints != null);
|
||||
final SliverPhysicalParentData childParentData = child.parentData;
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
switch (applyGrowthDirectionToAxisDirection(child.constraints.axisDirection, child.constraints.growthDirection)) {
|
||||
case AxisDirection.down:
|
||||
return parentMainAxisPosition - childParentData.paintOffset.dy;
|
||||
@ -1790,13 +1790,13 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta
|
||||
@override
|
||||
void updateChildLayoutOffset(RenderSliver child, double layoutOffset, GrowthDirection growthDirection) {
|
||||
assert(growthDirection == GrowthDirection.forward);
|
||||
final SliverLogicalParentData childParentData = child.parentData;
|
||||
final SliverLogicalParentData childParentData = child.parentData as SliverLogicalParentData;
|
||||
childParentData.layoutOffset = layoutOffset;
|
||||
}
|
||||
|
||||
@override
|
||||
Offset paintOffsetOf(RenderSliver child) {
|
||||
final SliverLogicalParentData childParentData = child.parentData;
|
||||
final SliverLogicalParentData childParentData = child.parentData as SliverLogicalParentData;
|
||||
return computeAbsolutePaintOffset(child, childParentData.layoutOffset, GrowthDirection.forward);
|
||||
}
|
||||
|
||||
@ -1829,7 +1829,7 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta
|
||||
@override
|
||||
void applyPaintTransform(RenderObject child, Matrix4 transform) {
|
||||
assert(child != null);
|
||||
final Offset offset = paintOffsetOf(child);
|
||||
final Offset offset = paintOffsetOf(child as RenderSliver);
|
||||
transform.translate(offset.dx, offset.dy);
|
||||
}
|
||||
|
||||
@ -1838,7 +1838,7 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta
|
||||
assert(child != null);
|
||||
assert(child.constraints != null);
|
||||
assert(hasSize);
|
||||
final SliverLogicalParentData childParentData = child.parentData;
|
||||
final SliverLogicalParentData childParentData = child.parentData as SliverLogicalParentData;
|
||||
switch (applyGrowthDirectionToAxisDirection(child.constraints.axisDirection, child.constraints.growthDirection)) {
|
||||
case AxisDirection.down:
|
||||
case AxisDirection.right:
|
||||
|
@ -623,7 +623,7 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin<RenderBox, Wr
|
||||
runMainAxisExtent += spacing;
|
||||
runCrossAxisExtent = math.max(runCrossAxisExtent, childCrossAxisExtent);
|
||||
childCount += 1;
|
||||
final WrapParentData childParentData = child.parentData;
|
||||
final WrapParentData childParentData = child.parentData as WrapParentData;
|
||||
childParentData._runIndex = runMetrics.length;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
@ -724,7 +724,7 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin<RenderBox, Wr
|
||||
crossAxisOffset -= runCrossAxisExtent;
|
||||
|
||||
while (child != null) {
|
||||
final WrapParentData childParentData = child.parentData;
|
||||
final WrapParentData childParentData = child.parentData as WrapParentData;
|
||||
if (childParentData._runIndex != i)
|
||||
break;
|
||||
final double childMainAxisExtent = _getMainAxisExtent(child);
|
||||
|
Loading…
x
Reference in New Issue
Block a user