enable lint cast_nullable_to_non_nullable (#67629)
This commit is contained in:
parent
684449a841
commit
4acc790252
@ -95,6 +95,7 @@ linter:
|
||||
- camel_case_types
|
||||
- cancel_subscriptions
|
||||
# - cascade_invocations # not yet tested
|
||||
- cast_nullable_to_non_nullable
|
||||
# - close_sinks # not reliable enough
|
||||
# - comment_references # blocked on https://github.com/flutter/flutter/issues/20765
|
||||
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
|
||||
|
@ -704,13 +704,13 @@ class _RenderCupertinoAlert extends RenderBox {
|
||||
// Set the position of the actions box to sit at the bottom of the alert.
|
||||
// The content box defaults to the top left, which is where we want it.
|
||||
assert(actionsSection!.parentData is MultiChildLayoutParentData);
|
||||
final MultiChildLayoutParentData actionParentData = actionsSection!.parentData as MultiChildLayoutParentData;
|
||||
final MultiChildLayoutParentData actionParentData = actionsSection!.parentData! as MultiChildLayoutParentData;
|
||||
actionParentData.offset = Offset(0.0, contentSize.height + dividerThickness);
|
||||
}
|
||||
|
||||
@override
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
final MultiChildLayoutParentData contentParentData = contentSection!.parentData as MultiChildLayoutParentData;
|
||||
final MultiChildLayoutParentData contentParentData = contentSection!.parentData! as MultiChildLayoutParentData;
|
||||
contentSection!.paint(context, offset + contentParentData.offset);
|
||||
|
||||
final bool hasDivider = contentSection!.size.height > 0.0 && actionsSection!.size.height > 0.0;
|
||||
@ -718,7 +718,7 @@ class _RenderCupertinoAlert extends RenderBox {
|
||||
_paintDividerBetweenContentAndActions(context.canvas, offset);
|
||||
}
|
||||
|
||||
final MultiChildLayoutParentData actionsParentData = actionsSection!.parentData as MultiChildLayoutParentData;
|
||||
final MultiChildLayoutParentData actionsParentData = actionsSection!.parentData! as MultiChildLayoutParentData;
|
||||
actionsSection!.paint(context, offset + actionsParentData.offset);
|
||||
}
|
||||
|
||||
@ -736,8 +736,8 @@ class _RenderCupertinoAlert extends RenderBox {
|
||||
|
||||
@override
|
||||
bool hitTestChildren(BoxHitTestResult result, { required Offset position }) {
|
||||
final MultiChildLayoutParentData contentSectionParentData = contentSection!.parentData as MultiChildLayoutParentData;
|
||||
final MultiChildLayoutParentData actionsSectionParentData = actionsSection!.parentData as MultiChildLayoutParentData;
|
||||
final MultiChildLayoutParentData contentSectionParentData = contentSection!.parentData! as MultiChildLayoutParentData;
|
||||
final MultiChildLayoutParentData actionsSectionParentData = actionsSection!.parentData! as MultiChildLayoutParentData;
|
||||
return result.addWithPaintOffset(
|
||||
offset: contentSectionParentData.offset,
|
||||
position: position,
|
||||
@ -977,7 +977,7 @@ class _ActionButtonParentDataWidget extends ParentDataWidget<_ActionButtonParent
|
||||
@override
|
||||
void applyParentData(RenderObject renderObject) {
|
||||
assert(renderObject.parentData is _ActionButtonParentData);
|
||||
final _ActionButtonParentData parentData = renderObject.parentData as _ActionButtonParentData;
|
||||
final _ActionButtonParentData parentData = renderObject.parentData! as _ActionButtonParentData;
|
||||
if (parentData.isPressed != isPressed) {
|
||||
parentData.isPressed = isPressed;
|
||||
|
||||
@ -1232,7 +1232,7 @@ class _RenderCupertinoAlertActions extends RenderBox
|
||||
);
|
||||
|
||||
assert(child.parentData is MultiChildLayoutParentData);
|
||||
final MultiChildLayoutParentData parentData = child.parentData as MultiChildLayoutParentData;
|
||||
final MultiChildLayoutParentData parentData = child.parentData! as MultiChildLayoutParentData;
|
||||
parentData.offset = Offset(0.0, verticalOffset);
|
||||
|
||||
verticalOffset += child.size.height;
|
||||
@ -1274,13 +1274,13 @@ class _RenderCupertinoAlertActions extends RenderBox
|
||||
RenderBox? prevChild;
|
||||
while (child != null) {
|
||||
assert(child.parentData is _ActionButtonParentData);
|
||||
final _ActionButtonParentData currentButtonParentData = child.parentData as _ActionButtonParentData;
|
||||
final _ActionButtonParentData currentButtonParentData = child.parentData! as _ActionButtonParentData;
|
||||
final bool isButtonPressed = currentButtonParentData.isPressed;
|
||||
|
||||
bool isPrevButtonPressed = false;
|
||||
if (prevChild != null) {
|
||||
assert(prevChild.parentData is _ActionButtonParentData);
|
||||
final _ActionButtonParentData previousButtonParentData = prevChild.parentData as _ActionButtonParentData;
|
||||
final _ActionButtonParentData previousButtonParentData = prevChild.parentData! as _ActionButtonParentData;
|
||||
isPrevButtonPressed = previousButtonParentData.isPressed;
|
||||
}
|
||||
|
||||
@ -1330,7 +1330,7 @@ class _RenderCupertinoAlertActions extends RenderBox
|
||||
void _drawButtons(PaintingContext context, Offset offset) {
|
||||
RenderBox? child = firstChild;
|
||||
while (child != null) {
|
||||
final MultiChildLayoutParentData childParentData = child.parentData as MultiChildLayoutParentData;
|
||||
final MultiChildLayoutParentData childParentData = child.parentData! as MultiChildLayoutParentData;
|
||||
context.paintChild(child, childParentData.offset + offset);
|
||||
child = childAfter(child);
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ typedef _ContextMenuPreviewBuilderChildless = Widget Function(
|
||||
// paintBounds in global coordinates.
|
||||
Rect _getRect(GlobalKey globalKey) {
|
||||
assert(globalKey.currentContext != null);
|
||||
final RenderBox renderBoxContainer = globalKey.currentContext!.findRenderObject() as RenderBox;
|
||||
final RenderBox renderBoxContainer = globalKey.currentContext!.findRenderObject()! as RenderBox;
|
||||
final Offset containerOffset = renderBoxContainer.localToGlobal(
|
||||
renderBoxContainer.paintBounds.topLeft,
|
||||
);
|
||||
|
@ -714,7 +714,7 @@ class _RenderCupertinoDialog extends RenderBox {
|
||||
// Set the position of the actions box to sit at the bottom of the dialog.
|
||||
// The content box defaults to the top left, which is where we want it.
|
||||
assert(actionsSection!.parentData is BoxParentData);
|
||||
final BoxParentData actionParentData = actionsSection!.parentData as BoxParentData;
|
||||
final BoxParentData actionParentData = actionsSection!.parentData! as BoxParentData;
|
||||
actionParentData.offset = Offset(0.0, contentSize.height + dividerThickness);
|
||||
}
|
||||
|
||||
@ -776,13 +776,13 @@ class _RenderCupertinoDialog extends RenderBox {
|
||||
// Set the position of the actions box to sit at the bottom of the dialog.
|
||||
// The content box defaults to the top left, which is where we want it.
|
||||
assert(actionsSection!.parentData is BoxParentData);
|
||||
final BoxParentData actionParentData = actionsSection!.parentData as BoxParentData;
|
||||
final BoxParentData actionParentData = actionsSection!.parentData! as BoxParentData;
|
||||
actionParentData.offset = Offset(0.0, contentSize.height + dividerThickness);
|
||||
}
|
||||
|
||||
@override
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
final BoxParentData contentParentData = contentSection!.parentData as BoxParentData;
|
||||
final BoxParentData contentParentData = contentSection!.parentData! as BoxParentData;
|
||||
contentSection!.paint(context, offset + contentParentData.offset);
|
||||
|
||||
final bool hasDivider = contentSection!.size.height > 0.0 && actionsSection!.size.height > 0.0;
|
||||
@ -790,7 +790,7 @@ class _RenderCupertinoDialog extends RenderBox {
|
||||
_paintDividerBetweenContentAndActions(context.canvas, offset);
|
||||
}
|
||||
|
||||
final BoxParentData actionsParentData = actionsSection!.parentData as BoxParentData;
|
||||
final BoxParentData actionsParentData = actionsSection!.parentData! as BoxParentData;
|
||||
actionsSection!.paint(context, offset + actionsParentData.offset);
|
||||
}
|
||||
|
||||
@ -808,8 +808,8 @@ class _RenderCupertinoDialog extends RenderBox {
|
||||
|
||||
@override
|
||||
bool hitTestChildren(BoxHitTestResult result, { required Offset position }) {
|
||||
final BoxParentData contentSectionParentData = contentSection!.parentData as BoxParentData;
|
||||
final BoxParentData actionsSectionParentData = actionsSection!.parentData as BoxParentData;
|
||||
final BoxParentData contentSectionParentData = contentSection!.parentData! as BoxParentData;
|
||||
final BoxParentData actionsSectionParentData = actionsSection!.parentData! as BoxParentData;
|
||||
return result.addWithPaintOffset(
|
||||
offset: contentSectionParentData.offset,
|
||||
position: position,
|
||||
@ -1041,7 +1041,7 @@ class _ActionButtonParentDataWidget extends ParentDataWidget<_ActionButtonParent
|
||||
@override
|
||||
void applyParentData(RenderObject renderObject) {
|
||||
assert(renderObject.parentData is _ActionButtonParentData);
|
||||
final _ActionButtonParentData parentData = renderObject.parentData as _ActionButtonParentData;
|
||||
final _ActionButtonParentData parentData = renderObject.parentData! as _ActionButtonParentData;
|
||||
if (parentData.isPressed != isPressed) {
|
||||
parentData.isPressed = isPressed;
|
||||
|
||||
@ -1396,7 +1396,7 @@ class _RenderCupertinoDialogActions extends RenderBox
|
||||
RenderBox? currentChild = firstChild;
|
||||
while (currentChild != null) {
|
||||
assert(currentChild.parentData is _ActionButtonParentData);
|
||||
final _ActionButtonParentData parentData = currentChild.parentData as _ActionButtonParentData;
|
||||
final _ActionButtonParentData parentData = currentChild.parentData! as _ActionButtonParentData;
|
||||
if (parentData.isPressed) {
|
||||
yield currentChild;
|
||||
}
|
||||
@ -1408,7 +1408,7 @@ class _RenderCupertinoDialogActions extends RenderBox
|
||||
RenderBox? currentChild = firstChild;
|
||||
while (currentChild != null) {
|
||||
assert(currentChild.parentData is _ActionButtonParentData);
|
||||
final _ActionButtonParentData parentData = currentChild.parentData as _ActionButtonParentData;
|
||||
final _ActionButtonParentData parentData = currentChild.parentData! as _ActionButtonParentData;
|
||||
if (parentData.isPressed) {
|
||||
return true;
|
||||
}
|
||||
@ -1582,7 +1582,7 @@ class _RenderCupertinoDialogActions extends RenderBox
|
||||
|
||||
// The 2nd button needs to be offset to the right.
|
||||
assert(lastChild!.parentData is MultiChildLayoutParentData);
|
||||
final MultiChildLayoutParentData secondButtonParentData = lastChild!.parentData as MultiChildLayoutParentData;
|
||||
final MultiChildLayoutParentData secondButtonParentData = lastChild!.parentData! as MultiChildLayoutParentData;
|
||||
secondButtonParentData.offset = Offset(firstChild!.size.width + dividerThickness, 0.0);
|
||||
|
||||
// Calculate our size based on the button sizes.
|
||||
@ -1613,7 +1613,7 @@ class _RenderCupertinoDialogActions extends RenderBox
|
||||
);
|
||||
|
||||
assert(child.parentData is MultiChildLayoutParentData);
|
||||
final MultiChildLayoutParentData parentData = child.parentData as MultiChildLayoutParentData;
|
||||
final MultiChildLayoutParentData parentData = child.parentData! as MultiChildLayoutParentData;
|
||||
parentData.offset = Offset(0.0, verticalOffset);
|
||||
|
||||
verticalOffset += child.size.height;
|
||||
@ -1663,7 +1663,7 @@ class _RenderCupertinoDialogActions extends RenderBox
|
||||
: Rect.zero;
|
||||
|
||||
final List<Rect> pressedButtonRects = _pressedButtons.map<Rect>((RenderBox pressedButton) {
|
||||
final MultiChildLayoutParentData buttonParentData = pressedButton.parentData as MultiChildLayoutParentData;
|
||||
final MultiChildLayoutParentData buttonParentData = pressedButton.parentData! as MultiChildLayoutParentData;
|
||||
|
||||
return Rect.fromLTWH(
|
||||
offset.dx + buttonParentData.offset.dx,
|
||||
@ -1726,13 +1726,13 @@ class _RenderCupertinoDialogActions extends RenderBox
|
||||
RenderBox? prevChild;
|
||||
while (child != null) {
|
||||
assert(child.parentData is _ActionButtonParentData);
|
||||
final _ActionButtonParentData currentButtonParentData = child.parentData as _ActionButtonParentData;
|
||||
final _ActionButtonParentData currentButtonParentData = child.parentData! as _ActionButtonParentData;
|
||||
final bool isButtonPressed = currentButtonParentData.isPressed;
|
||||
|
||||
bool isPrevButtonPressed = false;
|
||||
if (prevChild != null) {
|
||||
assert(prevChild.parentData is _ActionButtonParentData);
|
||||
final _ActionButtonParentData previousButtonParentData = prevChild.parentData as _ActionButtonParentData;
|
||||
final _ActionButtonParentData previousButtonParentData = prevChild.parentData! as _ActionButtonParentData;
|
||||
isPrevButtonPressed = previousButtonParentData.isPressed;
|
||||
}
|
||||
|
||||
@ -1782,7 +1782,7 @@ class _RenderCupertinoDialogActions extends RenderBox
|
||||
void _drawButtons(PaintingContext context, Offset offset) {
|
||||
RenderBox? child = firstChild;
|
||||
while (child != null) {
|
||||
final MultiChildLayoutParentData childParentData = child.parentData as MultiChildLayoutParentData;
|
||||
final MultiChildLayoutParentData childParentData = child.parentData! as MultiChildLayoutParentData;
|
||||
context.paintChild(child, childParentData.offset + offset);
|
||||
child = childAfter(child);
|
||||
}
|
||||
|
@ -1450,7 +1450,7 @@ class _BackLabel extends StatelessWidget {
|
||||
if (specifiedPreviousTitle != null) {
|
||||
return _buildPreviousTitleWidget(context, specifiedPreviousTitle, null);
|
||||
} else if (route is CupertinoRouteTransitionMixin<dynamic> && !route!.isFirst) {
|
||||
final CupertinoRouteTransitionMixin<dynamic> cupertinoRoute = route as CupertinoRouteTransitionMixin<dynamic>;
|
||||
final CupertinoRouteTransitionMixin<dynamic> cupertinoRoute = route! as CupertinoRouteTransitionMixin<dynamic>;
|
||||
// There is no timing issue because the previousTitle Listenable changes
|
||||
// happen during route modifications before the ValueListenableBuilder
|
||||
// is built.
|
||||
@ -1499,7 +1499,7 @@ class _TransitionableNavigationBar extends StatelessWidget {
|
||||
final Widget child;
|
||||
|
||||
RenderBox get renderBox {
|
||||
final RenderBox box = componentsKeys.navBarBoxKey.currentContext!.findRenderObject() as RenderBox;
|
||||
final RenderBox box = componentsKeys.navBarBoxKey.currentContext!.findRenderObject()! as RenderBox;
|
||||
assert(
|
||||
box.attached,
|
||||
'_TransitionableNavigationBar.renderBox should be called when building '
|
||||
@ -1729,7 +1729,7 @@ class _NavigationBarComponentsTransition {
|
||||
GlobalKey key, {
|
||||
required RenderBox from,
|
||||
}) {
|
||||
final RenderBox componentBox = key.currentContext!.findRenderObject() as RenderBox;
|
||||
final RenderBox componentBox = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
assert(componentBox.attached);
|
||||
|
||||
return RelativeRect.fromRect(
|
||||
@ -1756,8 +1756,8 @@ class _NavigationBarComponentsTransition {
|
||||
}) {
|
||||
final RelativeRect fromRect = positionInTransitionBox(fromKey, from: fromNavBarBox);
|
||||
|
||||
final RenderBox fromBox = fromKey.currentContext!.findRenderObject() as RenderBox;
|
||||
final RenderBox toBox = toKey.currentContext!.findRenderObject() as RenderBox;
|
||||
final RenderBox fromBox = fromKey.currentContext!.findRenderObject()! as RenderBox;
|
||||
final RenderBox toBox = toKey.currentContext!.findRenderObject()! as RenderBox;
|
||||
|
||||
// We move a box with the size of the 'from' render object such that its
|
||||
// upper left corner is at the upper left corner of the 'to' render object.
|
||||
@ -2038,7 +2038,7 @@ class _NavigationBarComponentsTransition {
|
||||
// If it's the first page with a back chevron, shift in slightly from the
|
||||
// right.
|
||||
if (bottomBackChevron == null) {
|
||||
final RenderBox topBackChevronBox = topComponents.backChevronKey.currentContext!.findRenderObject() as RenderBox;
|
||||
final RenderBox topBackChevronBox = topComponents.backChevronKey.currentContext!.findRenderObject()! as RenderBox;
|
||||
from = to.shift(
|
||||
Offset(
|
||||
forwardDirection * topBackChevronBox.size.width * 2.0,
|
||||
|
@ -551,8 +551,8 @@ bool _hitTestInteractive(GlobalKey customPaintKey, Offset offset) {
|
||||
return false;
|
||||
}
|
||||
final CustomPaint customPaint = customPaintKey.currentContext!.widget as CustomPaint;
|
||||
final ScrollbarPainter painter = customPaint.foregroundPainter as ScrollbarPainter;
|
||||
final RenderBox renderBox = customPaintKey.currentContext!.findRenderObject() as RenderBox;
|
||||
final ScrollbarPainter painter = customPaint.foregroundPainter! as ScrollbarPainter;
|
||||
final RenderBox renderBox = customPaintKey.currentContext!.findRenderObject()! as RenderBox;
|
||||
final Offset localOffset = renderBox.globalToLocal(offset);
|
||||
return painter.hitTestInteractive(localOffset);
|
||||
}
|
||||
|
@ -544,7 +544,7 @@ class _RenderSegmentedControl<T> extends RenderBox
|
||||
RenderBox? child = firstChild;
|
||||
double minWidth = 0.0;
|
||||
while (child != null) {
|
||||
final _SegmentedControlContainerBoxParentData childParentData = child.parentData as _SegmentedControlContainerBoxParentData;
|
||||
final _SegmentedControlContainerBoxParentData childParentData = child.parentData! as _SegmentedControlContainerBoxParentData;
|
||||
final double childWidth = child.getMinIntrinsicWidth(height);
|
||||
minWidth = math.max(minWidth, childWidth);
|
||||
child = childParentData.nextSibling;
|
||||
@ -557,7 +557,7 @@ class _RenderSegmentedControl<T> extends RenderBox
|
||||
RenderBox? child = firstChild;
|
||||
double maxWidth = 0.0;
|
||||
while (child != null) {
|
||||
final _SegmentedControlContainerBoxParentData childParentData = child.parentData as _SegmentedControlContainerBoxParentData;
|
||||
final _SegmentedControlContainerBoxParentData childParentData = child.parentData! as _SegmentedControlContainerBoxParentData;
|
||||
final double childWidth = child.getMaxIntrinsicWidth(height);
|
||||
maxWidth = math.max(maxWidth, childWidth);
|
||||
child = childParentData.nextSibling;
|
||||
@ -570,7 +570,7 @@ class _RenderSegmentedControl<T> extends RenderBox
|
||||
RenderBox? child = firstChild;
|
||||
double minHeight = 0.0;
|
||||
while (child != null) {
|
||||
final _SegmentedControlContainerBoxParentData childParentData = child.parentData as _SegmentedControlContainerBoxParentData;
|
||||
final _SegmentedControlContainerBoxParentData childParentData = child.parentData! as _SegmentedControlContainerBoxParentData;
|
||||
final double childHeight = child.getMinIntrinsicHeight(width);
|
||||
minHeight = math.max(minHeight, childHeight);
|
||||
child = childParentData.nextSibling;
|
||||
@ -583,7 +583,7 @@ class _RenderSegmentedControl<T> extends RenderBox
|
||||
RenderBox? child = firstChild;
|
||||
double maxHeight = 0.0;
|
||||
while (child != null) {
|
||||
final _SegmentedControlContainerBoxParentData childParentData = child.parentData as _SegmentedControlContainerBoxParentData;
|
||||
final _SegmentedControlContainerBoxParentData childParentData = child.parentData! as _SegmentedControlContainerBoxParentData;
|
||||
final double childHeight = child.getMaxIntrinsicHeight(width);
|
||||
maxHeight = math.max(maxHeight, childHeight);
|
||||
child = childParentData.nextSibling;
|
||||
@ -607,7 +607,7 @@ class _RenderSegmentedControl<T> extends RenderBox
|
||||
RenderBox? child = leftChild;
|
||||
double start = 0.0;
|
||||
while (child != null) {
|
||||
final _SegmentedControlContainerBoxParentData childParentData = child.parentData as _SegmentedControlContainerBoxParentData;
|
||||
final _SegmentedControlContainerBoxParentData childParentData = child.parentData! as _SegmentedControlContainerBoxParentData;
|
||||
final Offset childOffset = Offset(start, 0.0);
|
||||
childParentData.offset = childOffset;
|
||||
final Rect childRect = Rect.fromLTWH(start, 0.0, child.size.width, child.size.height);
|
||||
@ -692,7 +692,7 @@ class _RenderSegmentedControl<T> extends RenderBox
|
||||
void _paintChild(PaintingContext context, Offset offset, RenderBox child, int childIndex) {
|
||||
assert(child != null);
|
||||
|
||||
final _SegmentedControlContainerBoxParentData childParentData = child.parentData as _SegmentedControlContainerBoxParentData;
|
||||
final _SegmentedControlContainerBoxParentData childParentData = child.parentData! as _SegmentedControlContainerBoxParentData;
|
||||
|
||||
context.canvas.drawRRect(
|
||||
childParentData.surroundingRect!.shift(offset),
|
||||
@ -716,7 +716,7 @@ class _RenderSegmentedControl<T> extends RenderBox
|
||||
assert(position != null);
|
||||
RenderBox? child = lastChild;
|
||||
while (child != null) {
|
||||
final _SegmentedControlContainerBoxParentData childParentData = child.parentData as _SegmentedControlContainerBoxParentData;
|
||||
final _SegmentedControlContainerBoxParentData childParentData = child.parentData! as _SegmentedControlContainerBoxParentData;
|
||||
if (childParentData.surroundingRect!.contains(position)) {
|
||||
return result.addWithPaintOffset(
|
||||
offset: childParentData.offset,
|
||||
|
@ -764,7 +764,7 @@ class _RenderSegmentedControl<T> extends RenderBox
|
||||
double maxMinChildWidth = 0;
|
||||
while (child != null) {
|
||||
final _SegmentedControlContainerBoxParentData childParentData =
|
||||
child.parentData as _SegmentedControlContainerBoxParentData;
|
||||
child.parentData! as _SegmentedControlContainerBoxParentData;
|
||||
final double childWidth = child.getMinIntrinsicWidth(height);
|
||||
maxMinChildWidth = math.max(maxMinChildWidth, childWidth);
|
||||
child = childParentData.nextSibling;
|
||||
@ -778,7 +778,7 @@ class _RenderSegmentedControl<T> extends RenderBox
|
||||
double maxMaxChildWidth = 0;
|
||||
while (child != null) {
|
||||
final _SegmentedControlContainerBoxParentData childParentData =
|
||||
child.parentData as _SegmentedControlContainerBoxParentData;
|
||||
child.parentData! as _SegmentedControlContainerBoxParentData;
|
||||
final double childWidth = child.getMaxIntrinsicWidth(height);
|
||||
maxMaxChildWidth = math.max(maxMaxChildWidth, childWidth);
|
||||
child = childParentData.nextSibling;
|
||||
@ -792,7 +792,7 @@ class _RenderSegmentedControl<T> extends RenderBox
|
||||
double maxMinChildHeight = 0;
|
||||
while (child != null) {
|
||||
final _SegmentedControlContainerBoxParentData childParentData =
|
||||
child.parentData as _SegmentedControlContainerBoxParentData;
|
||||
child.parentData! as _SegmentedControlContainerBoxParentData;
|
||||
final double childHeight = child.getMinIntrinsicHeight(width);
|
||||
maxMinChildHeight = math.max(maxMinChildHeight, childHeight);
|
||||
child = childParentData.nextSibling;
|
||||
@ -806,7 +806,7 @@ class _RenderSegmentedControl<T> extends RenderBox
|
||||
double maxMaxChildHeight = 0;
|
||||
while (child != null) {
|
||||
final _SegmentedControlContainerBoxParentData childParentData =
|
||||
child.parentData as _SegmentedControlContainerBoxParentData;
|
||||
child.parentData! as _SegmentedControlContainerBoxParentData;
|
||||
final double childHeight = child.getMaxIntrinsicHeight(width);
|
||||
maxMaxChildHeight = math.max(maxMaxChildHeight, childHeight);
|
||||
child = childParentData.nextSibling;
|
||||
@ -867,7 +867,7 @@ class _RenderSegmentedControl<T> extends RenderBox
|
||||
|
||||
while (child != null) {
|
||||
final _SegmentedControlContainerBoxParentData childParentData =
|
||||
child.parentData as _SegmentedControlContainerBoxParentData;
|
||||
child.parentData! as _SegmentedControlContainerBoxParentData;
|
||||
final Offset childOffset = Offset(start, 0);
|
||||
childParentData.offset = childOffset;
|
||||
start += child.size.width + _kSeparatorWidth + _kSeparatorInset.horizontal;
|
||||
@ -897,7 +897,7 @@ class _RenderSegmentedControl<T> extends RenderBox
|
||||
final RenderBox selectedChild = children[highlightedIndex!];
|
||||
|
||||
final _SegmentedControlContainerBoxParentData childParentData =
|
||||
selectedChild.parentData as _SegmentedControlContainerBoxParentData;
|
||||
selectedChild.parentData! as _SegmentedControlContainerBoxParentData;
|
||||
final Rect unscaledThumbTargetRect = _kThumbInsets.inflateRect(childParentData.offset & selectedChild.size);
|
||||
|
||||
// Update related Tweens before animation update phase.
|
||||
@ -958,7 +958,7 @@ class _RenderSegmentedControl<T> extends RenderBox
|
||||
void _paintSeparator(PaintingContext context, Offset offset, RenderBox child) {
|
||||
assert(child != null);
|
||||
final _SegmentedControlContainerBoxParentData childParentData =
|
||||
child.parentData as _SegmentedControlContainerBoxParentData;
|
||||
child.parentData! as _SegmentedControlContainerBoxParentData;
|
||||
|
||||
final Paint paint = Paint();
|
||||
|
||||
@ -981,7 +981,7 @@ class _RenderSegmentedControl<T> extends RenderBox
|
||||
void _paintChild(PaintingContext context, Offset offset, RenderBox child, int childIndex) {
|
||||
assert(child != null);
|
||||
final _SegmentedControlContainerBoxParentData childParentData =
|
||||
child.parentData as _SegmentedControlContainerBoxParentData;
|
||||
child.parentData! as _SegmentedControlContainerBoxParentData;
|
||||
context.paintChild(child, childParentData.offset + offset);
|
||||
}
|
||||
|
||||
@ -1023,7 +1023,7 @@ class _RenderSegmentedControl<T> extends RenderBox
|
||||
RenderBox? child = lastChild;
|
||||
while (child != null) {
|
||||
final _SegmentedControlContainerBoxParentData childParentData =
|
||||
child.parentData as _SegmentedControlContainerBoxParentData;
|
||||
child.parentData! as _SegmentedControlContainerBoxParentData;
|
||||
if ((childParentData.offset & child.size).contains(position)) {
|
||||
return result.addWithPaintOffset(
|
||||
offset: childParentData.offset,
|
||||
|
@ -100,7 +100,7 @@ class _CupertinoTextFieldSelectionGestureDetectorBuilder extends TextSelectionGe
|
||||
// this handler. If the clear button widget recognizes the up event,
|
||||
// then do not handle it.
|
||||
if (_state._clearGlobalKey.currentContext != null) {
|
||||
final RenderBox renderBox = _state._clearGlobalKey.currentContext!.findRenderObject() as RenderBox;
|
||||
final RenderBox renderBox = _state._clearGlobalKey.currentContext!.findRenderObject()! as RenderBox;
|
||||
final Offset localOffset = renderBox.globalToLocal(details.globalPosition);
|
||||
if (renderBox.hitTest(BoxHitTestResult(), position: localOffset)) {
|
||||
return;
|
||||
@ -905,7 +905,7 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with Restoratio
|
||||
final Color? decorationColor = CupertinoDynamicColor.resolve(widget.decoration?.color, context);
|
||||
|
||||
final BoxBorder? border = widget.decoration?.border;
|
||||
Border resolvedBorder = border as Border;
|
||||
Border? resolvedBorder = border as Border?;
|
||||
if (border is Border) {
|
||||
BorderSide resolveBorderSide(BorderSide side) {
|
||||
return side == BorderSide.none
|
||||
|
@ -324,7 +324,7 @@ class _ToolbarRenderBox extends RenderShiftedBox {
|
||||
.loosen();
|
||||
|
||||
child!.layout(heightConstraint.enforce(enforcedConstraint), parentUsesSize: true,);
|
||||
final _ToolbarParentData childParentData = child!.parentData as _ToolbarParentData;
|
||||
final _ToolbarParentData childParentData = child!.parentData! as _ToolbarParentData;
|
||||
|
||||
// The local x-coordinate of the center of the toolbar.
|
||||
final double lowerBound = child!.size.width/2 + _kToolbarScreenPadding;
|
||||
@ -337,7 +337,7 @@ class _ToolbarRenderBox extends RenderShiftedBox {
|
||||
|
||||
// The path is described in the toolbar's coordinate system.
|
||||
Path _clipPath() {
|
||||
final _ToolbarParentData childParentData = child!.parentData as _ToolbarParentData;
|
||||
final _ToolbarParentData childParentData = child!.parentData! as _ToolbarParentData;
|
||||
final Path rrect = Path()
|
||||
..addRRect(
|
||||
RRect.fromRectAndRadius(
|
||||
@ -370,7 +370,7 @@ class _ToolbarRenderBox extends RenderShiftedBox {
|
||||
return;
|
||||
}
|
||||
|
||||
final _ToolbarParentData childParentData = child!.parentData as _ToolbarParentData;
|
||||
final _ToolbarParentData childParentData = child!.parentData! as _ToolbarParentData;
|
||||
context.pushClipPath(
|
||||
needsCompositing,
|
||||
offset + childParentData.offset,
|
||||
@ -400,7 +400,7 @@ class _ToolbarRenderBox extends RenderShiftedBox {
|
||||
..strokeWidth = 2.0
|
||||
..style = PaintingStyle.stroke;
|
||||
|
||||
final _ToolbarParentData childParentData = child!.parentData as _ToolbarParentData;
|
||||
final _ToolbarParentData childParentData = child!.parentData! as _ToolbarParentData;
|
||||
context.canvas.drawPath(_clipPath().shift(offset + childParentData.offset), _debugPaint!);
|
||||
return true;
|
||||
}());
|
||||
@ -789,11 +789,11 @@ class _CupertinoTextSelectionToolbarItemsElement extends RenderObjectElement {
|
||||
@override
|
||||
void moveRenderObjectChild(RenderObject child, IndexedSlot<Element> oldSlot, IndexedSlot<Element> newSlot) {
|
||||
assert(child.parent == renderObject);
|
||||
renderObject.move(child as RenderBox, after: newSlot.value.renderObject as RenderBox);
|
||||
renderObject.move(child as RenderBox, after: newSlot.value.renderObject as RenderBox?);
|
||||
}
|
||||
|
||||
static bool _shouldPaint(Element child) {
|
||||
return (child.renderObject!.parentData as ToolbarItemsParentData).shouldPaint;
|
||||
return (child.renderObject!.parentData! as ToolbarItemsParentData).shouldPaint;
|
||||
}
|
||||
|
||||
@override
|
||||
@ -986,7 +986,7 @@ class _CupertinoTextSelectionToolbarItemsRenderBox extends RenderBox with Contai
|
||||
i++;
|
||||
final RenderBox child = renderObjectChild as RenderBox;
|
||||
final ToolbarItemsParentData childParentData =
|
||||
child.parentData as ToolbarItemsParentData;
|
||||
child.parentData! as ToolbarItemsParentData;
|
||||
childParentData.shouldPaint = false;
|
||||
|
||||
// Skip slotted children and children on pages after the visible page.
|
||||
@ -1046,11 +1046,11 @@ class _CupertinoTextSelectionToolbarItemsRenderBox extends RenderBox with Contai
|
||||
// Position page nav buttons.
|
||||
if (currentPage > 0) {
|
||||
final ToolbarItemsParentData nextButtonParentData =
|
||||
_nextButton!.parentData as ToolbarItemsParentData;
|
||||
_nextButton!.parentData! as ToolbarItemsParentData;
|
||||
final ToolbarItemsParentData nextButtonDisabledParentData =
|
||||
_nextButtonDisabled!.parentData as ToolbarItemsParentData;
|
||||
_nextButtonDisabled!.parentData! as ToolbarItemsParentData;
|
||||
final ToolbarItemsParentData backButtonParentData =
|
||||
_backButton!.parentData as ToolbarItemsParentData;
|
||||
_backButton!.parentData! as ToolbarItemsParentData;
|
||||
// The forward button always shows if there is more than one page, even on
|
||||
// the last page (it's just disabled).
|
||||
if (page == currentPage) {
|
||||
@ -1081,7 +1081,7 @@ class _CupertinoTextSelectionToolbarItemsRenderBox extends RenderBox with Contai
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
visitChildren((RenderObject renderObjectChild) {
|
||||
final RenderBox child = renderObjectChild as RenderBox;
|
||||
final ToolbarItemsParentData childParentData = child.parentData as ToolbarItemsParentData;
|
||||
final ToolbarItemsParentData childParentData = child.parentData! as ToolbarItemsParentData;
|
||||
|
||||
if (childParentData.shouldPaint) {
|
||||
final Offset childOffset = childParentData.offset + offset;
|
||||
@ -1103,7 +1103,7 @@ class _CupertinoTextSelectionToolbarItemsRenderBox extends RenderBox with Contai
|
||||
return false;
|
||||
}
|
||||
final ToolbarItemsParentData childParentData =
|
||||
child.parentData as ToolbarItemsParentData;
|
||||
child.parentData! as ToolbarItemsParentData;
|
||||
return result.addWithPaintOffset(
|
||||
offset: childParentData.offset,
|
||||
position: position,
|
||||
@ -1120,7 +1120,7 @@ class _CupertinoTextSelectionToolbarItemsRenderBox extends RenderBox with Contai
|
||||
// The x, y parameters have the top left of the node's box as the origin.
|
||||
RenderBox? child = lastChild;
|
||||
while (child != null) {
|
||||
final ToolbarItemsParentData childParentData = child.parentData as ToolbarItemsParentData;
|
||||
final ToolbarItemsParentData childParentData = child.parentData! as ToolbarItemsParentData;
|
||||
|
||||
// Don't hit test children that aren't shown.
|
||||
if (!childParentData.shouldPaint) {
|
||||
@ -1199,7 +1199,7 @@ class _CupertinoTextSelectionToolbarItemsRenderBox extends RenderBox with Contai
|
||||
void visitChildrenForSemantics(RenderObjectVisitor visitor) {
|
||||
visitChildren((RenderObject renderObjectChild) {
|
||||
final RenderBox child = renderObjectChild as RenderBox;
|
||||
final ToolbarItemsParentData childParentData = child.parentData as ToolbarItemsParentData;
|
||||
final ToolbarItemsParentData childParentData = child.parentData! as ToolbarItemsParentData;
|
||||
if (childParentData.shouldPaint) {
|
||||
visitor(renderObjectChild);
|
||||
}
|
||||
|
@ -591,7 +591,7 @@ class FlutterErrorDetails with Diagnosticable {
|
||||
return exception;
|
||||
}
|
||||
if (exception is AssertionError && exception.message is FlutterError) {
|
||||
return exception.message as FlutterError;
|
||||
return exception.message! as FlutterError;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -501,7 +501,7 @@ class _LicensePageState extends State<LicensePage> {
|
||||
|
||||
Widget _packageLicensePage(BuildContext _, Object? args, ScrollController? scrollController) {
|
||||
assert(args is _DetailArguments);
|
||||
final _DetailArguments detailArguments = args as _DetailArguments;
|
||||
final _DetailArguments detailArguments = args! as _DetailArguments;
|
||||
return _PackageLicensePage(
|
||||
packageName: detailArguments.packageName,
|
||||
licenseEntries: detailArguments.licenseEntries,
|
||||
|
@ -187,7 +187,7 @@ class _BottomSheetState extends State<BottomSheet> {
|
||||
final GlobalKey _childKey = GlobalKey(debugLabel: 'BottomSheet child');
|
||||
|
||||
double get _childHeight {
|
||||
final RenderBox renderBox = _childKey.currentContext!.findRenderObject() as RenderBox;
|
||||
final RenderBox renderBox = _childKey.currentContext!.findRenderObject()! as RenderBox;
|
||||
return renderBox.size.height;
|
||||
}
|
||||
|
||||
|
@ -550,7 +550,7 @@ class _RenderInputPadding extends RenderShiftedBox {
|
||||
final double height = math.max(child!.size.width, minSize.width);
|
||||
final double width = math.max(child!.size.height, minSize.height);
|
||||
size = constraints.constrain(Size(height, width));
|
||||
final BoxParentData childParentData = child!.parentData as BoxParentData;
|
||||
final BoxParentData childParentData = child!.parentData! as BoxParentData;
|
||||
childParentData.offset = Alignment.center.alongOffset(size - child!.size as Offset);
|
||||
} else {
|
||||
size = Size.zero;
|
||||
|
@ -367,7 +367,7 @@ class _RenderButtonBarRow extends RenderFlex {
|
||||
}
|
||||
|
||||
while (child != null) {
|
||||
final FlexParentData childParentData = child.parentData as FlexParentData;
|
||||
final FlexParentData childParentData = child.parentData! as FlexParentData;
|
||||
|
||||
// Lay out the child with the button bar's original constraints, but
|
||||
// with minimum width set to zero.
|
||||
|
@ -483,7 +483,7 @@ class _RenderInputPadding extends RenderShiftedBox {
|
||||
final double height = math.max(child!.size.width, minSize.width);
|
||||
final double width = math.max(child!.size.height, minSize.height);
|
||||
size = constraints.constrain(Size(height, width));
|
||||
final BoxParentData childParentData = child!.parentData as BoxParentData;
|
||||
final BoxParentData childParentData = child!.parentData! as BoxParentData;
|
||||
childParentData.offset = Alignment.center.alongOffset(size - child!.size as Offset);
|
||||
} else {
|
||||
size = Size.zero;
|
||||
|
@ -2128,13 +2128,13 @@ class _RenderChipElement extends RenderObjectElement {
|
||||
void _updateRenderObject(RenderObject? child, _ChipSlot slot) {
|
||||
switch (slot) {
|
||||
case _ChipSlot.avatar:
|
||||
renderObject.avatar = child as RenderBox;
|
||||
renderObject.avatar = child as RenderBox?;
|
||||
break;
|
||||
case _ChipSlot.label:
|
||||
renderObject.label = child as RenderBox;
|
||||
renderObject.label = child as RenderBox?;
|
||||
break;
|
||||
case _ChipSlot.deleteIcon:
|
||||
renderObject.deleteIcon = child as RenderBox;
|
||||
renderObject.deleteIcon = child as RenderBox?;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2385,7 +2385,7 @@ class _RenderChip extends RenderBox {
|
||||
|
||||
static Rect _boxRect(RenderBox? box) => box == null ? Rect.zero : _boxParentData(box).offset & box.size;
|
||||
|
||||
static BoxParentData _boxParentData(RenderBox box) => box.parentData as BoxParentData;
|
||||
static BoxParentData _boxParentData(RenderBox box) => box.parentData! as BoxParentData;
|
||||
|
||||
@override
|
||||
double computeMinIntrinsicWidth(double height) {
|
||||
@ -2907,7 +2907,7 @@ class _LocationAwareInkRippleFactory extends InteractiveInkFeatureFactory {
|
||||
|
||||
if (tapIsOnDeleteIcon) {
|
||||
final RenderBox currentBox = referenceBox;
|
||||
referenceBox = deleteIconKey.currentContext!.findRenderObject() as RenderBox;
|
||||
referenceBox = deleteIconKey.currentContext!.findRenderObject()! as RenderBox;
|
||||
position = referenceBox.globalToLocal(currentBox.localToGlobal(position));
|
||||
containedInkWell = false;
|
||||
}
|
||||
|
@ -1030,7 +1030,7 @@ class TableRowInkWell extends InkResponse {
|
||||
table = table.parent;
|
||||
}
|
||||
if (table is RenderTable) {
|
||||
final TableCellParentData cellParentData = cell.parentData as TableCellParentData;
|
||||
final TableCellParentData cellParentData = cell.parentData! as TableCellParentData;
|
||||
assert(cellParentData.y != null);
|
||||
final Rect rect = table.getRowBox(cellParentData.y!);
|
||||
// The rect is in the table's coordinate space. We need to change it to the
|
||||
|
@ -1179,7 +1179,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
|
||||
TextStyle? get _textStyle => widget.style ?? Theme.of(context)!.textTheme.subtitle1;
|
||||
|
||||
void _handleTap() {
|
||||
final RenderBox itemBox = context.findRenderObject() as RenderBox;
|
||||
final RenderBox itemBox = context.findRenderObject()! as RenderBox;
|
||||
final Rect itemRect = itemBox.localToGlobal(Offset.zero) & itemBox.size;
|
||||
final TextDirection? textDirection = Directionality.of(context);
|
||||
final EdgeInsetsGeometry menuMargin = ButtonTheme.of(context).alignedDropdown
|
||||
|
@ -255,7 +255,7 @@ class _InkState extends State<Ink> {
|
||||
decoration: widget.decoration,
|
||||
configuration: createLocalImageConfiguration(context),
|
||||
controller: Material.of(context)!,
|
||||
referenceBox: context.findRenderObject() as RenderBox,
|
||||
referenceBox: context.findRenderObject()! as RenderBox,
|
||||
onRemoved: _handleRemoved,
|
||||
);
|
||||
} else {
|
||||
|
@ -62,7 +62,7 @@ class _InputBorderTween extends Tween<InputBorder> {
|
||||
_InputBorderTween({InputBorder? begin, InputBorder? end}) : super(begin: begin, end: end);
|
||||
|
||||
@override
|
||||
InputBorder lerp(double t) => ShapeBorder.lerp(begin, end, t) as InputBorder;
|
||||
InputBorder lerp(double t) => ShapeBorder.lerp(begin, end, t)! as InputBorder;
|
||||
}
|
||||
|
||||
// Passes the _InputBorderGap parameters along to an InputBorder's paint method.
|
||||
@ -919,7 +919,7 @@ class _RenderDecoration extends RenderBox {
|
||||
|
||||
static Size _boxSize(RenderBox? box) => box == null ? Size.zero : box.size;
|
||||
|
||||
static BoxParentData _boxParentData(RenderBox box) => box.parentData as BoxParentData;
|
||||
static BoxParentData _boxParentData(RenderBox box) => box.parentData! as BoxParentData;
|
||||
|
||||
EdgeInsets get contentPadding => decoration.contentPadding as EdgeInsets;
|
||||
|
||||
|
@ -1688,7 +1688,7 @@ class _RenderListTile extends RenderBox {
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
void doPaint(RenderBox? child) {
|
||||
if (child != null) {
|
||||
final BoxParentData parentData = child.parentData as BoxParentData;
|
||||
final BoxParentData parentData = child.parentData! as BoxParentData;
|
||||
context.paintChild(child, parentData.offset + offset);
|
||||
}
|
||||
}
|
||||
@ -1705,7 +1705,7 @@ class _RenderListTile extends RenderBox {
|
||||
bool hitTestChildren(BoxHitTestResult result, { required Offset position }) {
|
||||
assert(position != null);
|
||||
for (final RenderBox child in _children) {
|
||||
final BoxParentData parentData = child.parentData as BoxParentData;
|
||||
final BoxParentData parentData = child.parentData! as BoxParentData;
|
||||
final bool isHit = result.addWithPaintOffset(
|
||||
offset: parentData.offset,
|
||||
position: position,
|
||||
|
@ -637,8 +637,7 @@ abstract class InkFeature {
|
||||
final List<RenderObject> descendants = <RenderObject>[referenceBox];
|
||||
RenderObject node = referenceBox;
|
||||
while (node != _controller) {
|
||||
node = node.parent as RenderObject;
|
||||
assert(node != null);
|
||||
node = node.parent! as RenderObject;
|
||||
descendants.add(node);
|
||||
}
|
||||
// determine the transform that gets our coordinate system to be like theirs
|
||||
@ -763,17 +762,17 @@ class _MaterialInteriorState extends AnimatedWidgetBaseState<_MaterialInterior>
|
||||
_elevation,
|
||||
widget.elevation,
|
||||
(dynamic value) => Tween<double>(begin: value as double),
|
||||
) as Tween<double>;
|
||||
) as Tween<double>?;
|
||||
_shadowColor = visitor(
|
||||
_shadowColor,
|
||||
widget.shadowColor,
|
||||
(dynamic value) => ColorTween(begin: value as Color),
|
||||
) as ColorTween;
|
||||
) as ColorTween?;
|
||||
_border = visitor(
|
||||
_border,
|
||||
widget.shape,
|
||||
(dynamic value) => ShapeBorderTween(begin: value as ShapeBorder),
|
||||
) as ShapeBorderTween;
|
||||
) as ShapeBorderTween?;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -2570,7 +2570,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
|
||||
clipBehavior: clipBehavior,
|
||||
);
|
||||
});
|
||||
return _currentBottomSheet as PersistentBottomSheetController<T>;
|
||||
return _currentBottomSheet! as PersistentBottomSheetController<T>;
|
||||
}
|
||||
|
||||
// Floating Action Button API
|
||||
|
@ -240,7 +240,7 @@ class _TabLabelBarRenderer extends RenderFlex {
|
||||
RenderBox? child = firstChild;
|
||||
final List<double> xOffsets = <double>[];
|
||||
while (child != null) {
|
||||
final FlexParentData childParentData = child.parentData as FlexParentData;
|
||||
final FlexParentData childParentData = child.parentData! as FlexParentData;
|
||||
xOffsets.add(childParentData.offset.dx);
|
||||
assert(child.parentData == childParentData);
|
||||
child = childParentData.nextSibling;
|
||||
|
@ -550,7 +550,7 @@ class _TextSelectionToolbarItemsRenderBox extends RenderBox with ContainerRender
|
||||
});
|
||||
|
||||
// Place the navigation button if needed.
|
||||
final ToolbarItemsParentData navButtonParentData = navButton.parentData as ToolbarItemsParentData;
|
||||
final ToolbarItemsParentData navButtonParentData = navButton.parentData! as ToolbarItemsParentData;
|
||||
if (_shouldPaintChild(firstChild!, 0)) {
|
||||
navButtonParentData.shouldPaint = true;
|
||||
if (overflowOpen) {
|
||||
@ -588,7 +588,7 @@ class _TextSelectionToolbarItemsRenderBox extends RenderBox with ContainerRender
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
visitChildren((RenderObject renderObjectChild) {
|
||||
final RenderBox child = renderObjectChild as RenderBox;
|
||||
final ToolbarItemsParentData childParentData = child.parentData as ToolbarItemsParentData;
|
||||
final ToolbarItemsParentData childParentData = child.parentData! as ToolbarItemsParentData;
|
||||
if (!childParentData.shouldPaint) {
|
||||
return;
|
||||
}
|
||||
@ -609,7 +609,7 @@ class _TextSelectionToolbarItemsRenderBox extends RenderBox with ContainerRender
|
||||
// The x, y parameters have the top left of the node's box as the origin.
|
||||
RenderBox? child = lastChild;
|
||||
while (child != null) {
|
||||
final ToolbarItemsParentData childParentData = child.parentData as ToolbarItemsParentData;
|
||||
final ToolbarItemsParentData childParentData = child.parentData! as ToolbarItemsParentData;
|
||||
|
||||
// Don't hit test children aren't shown.
|
||||
if (!childParentData.shouldPaint) {
|
||||
@ -637,7 +637,7 @@ class _TextSelectionToolbarItemsRenderBox extends RenderBox with ContainerRender
|
||||
void visitChildrenForSemantics(RenderObjectVisitor visitor) {
|
||||
visitChildren((RenderObject renderObjectChild) {
|
||||
final RenderBox child = renderObjectChild as RenderBox;
|
||||
final ToolbarItemsParentData childParentData = child.parentData as ToolbarItemsParentData;
|
||||
final ToolbarItemsParentData childParentData = child.parentData! as ToolbarItemsParentData;
|
||||
if (childParentData.shouldPaint) {
|
||||
visitor(renderObjectChild);
|
||||
}
|
||||
|
@ -254,8 +254,7 @@ class _AnimatedThemeState extends AnimatedWidgetBaseState<AnimatedTheme> {
|
||||
@override
|
||||
void forEachTween(TweenVisitor<dynamic> visitor) {
|
||||
// TODO(ianh): Use constructor tear-offs when it becomes possible, https://github.com/dart-lang/sdk/issues/10659
|
||||
_data = visitor(_data, widget.data, (dynamic value) => ThemeDataTween(begin: value as ThemeData)) as ThemeDataTween;
|
||||
assert(_data != null);
|
||||
_data = visitor(_data, widget.data, (dynamic value) => ThemeDataTween(begin: value as ThemeData))! as ThemeDataTween;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -1037,7 +1037,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
|
||||
void _handlePanStart(DragStartDetails details) {
|
||||
assert(!_dragging);
|
||||
_dragging = true;
|
||||
final RenderBox box = context.findRenderObject() as RenderBox;
|
||||
final RenderBox box = context.findRenderObject()! as RenderBox;
|
||||
_position = box.globalToLocal(details.globalPosition);
|
||||
_center = box.size.center(Offset.zero);
|
||||
_updateThetaForPan();
|
||||
@ -1064,7 +1064,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
|
||||
}
|
||||
|
||||
void _handleTapUp(TapUpDetails details) {
|
||||
final RenderBox box = context.findRenderObject() as RenderBox;
|
||||
final RenderBox box = context.findRenderObject()! as RenderBox;
|
||||
_position = box.globalToLocal(details.globalPosition);
|
||||
_center = box.size.center(Offset.zero);
|
||||
_updateThetaForPan(roundMinutes: true);
|
||||
|
@ -272,7 +272,7 @@ class TimePickerThemeData with Diagnosticable {
|
||||
helpTextStyle: TextStyle.lerp(a?.helpTextStyle, b?.helpTextStyle, t),
|
||||
shape: ShapeBorder.lerp(a?.shape, b?.shape, t),
|
||||
hourMinuteShape: ShapeBorder.lerp(a?.hourMinuteShape, b?.hourMinuteShape, t),
|
||||
dayPeriodShape: ShapeBorder.lerp(a?.dayPeriodShape, b?.dayPeriodShape, t) as OutlinedBorder,
|
||||
dayPeriodShape: ShapeBorder.lerp(a?.dayPeriodShape, b?.dayPeriodShape, t) as OutlinedBorder?,
|
||||
dayPeriodBorderSide: lerpedBorderSide,
|
||||
inputDecorationTheme: t < 0.5 ? a?.inputDecorationTheme : b?.inputDecorationTheme,
|
||||
);
|
||||
|
@ -4978,7 +4978,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
|
||||
return _history.cast<_RouteEntry?>().firstWhere(
|
||||
(_RouteEntry? entry) => entry!.restorationId == id,
|
||||
orElse: () => null,
|
||||
)?.route as Route<T>;
|
||||
)?.route as Route<T>?;
|
||||
}
|
||||
|
||||
int get _userGesturesInProgress => _userGesturesInProgressCount;
|
||||
@ -5208,8 +5208,7 @@ class _AnonymousRestorationInformation extends _RestorationInformation {
|
||||
|
||||
factory _AnonymousRestorationInformation.fromSerializableData(List<Object> data) {
|
||||
assert(data.length > 1);
|
||||
final RestorableRouteBuilder routeBuilder = ui.PluginUtilities.getCallbackFromHandle(ui.CallbackHandle.fromRawHandle(data[1] as int)) as RestorableRouteBuilder;
|
||||
assert(routeBuilder != null);
|
||||
final RestorableRouteBuilder routeBuilder = ui.PluginUtilities.getCallbackFromHandle(ui.CallbackHandle.fromRawHandle(data[1] as int))! as RestorableRouteBuilder;
|
||||
return _AnonymousRestorationInformation(
|
||||
restorationScopeId: data[0] as int,
|
||||
routeBuilder: routeBuilder,
|
||||
|
@ -505,7 +505,7 @@ void main() {
|
||||
setUp(() { color = null; });
|
||||
|
||||
testWidgets('dynamic color works in cupertino override theme', (WidgetTester tester) async {
|
||||
final CupertinoDynamicColor Function() typedColor = () => color as CupertinoDynamicColor;
|
||||
final CupertinoDynamicColor Function() typedColor = () => color! as CupertinoDynamicColor;
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
|
@ -40,7 +40,7 @@ void main() {
|
||||
);
|
||||
expect(finder, findsOneWidget);
|
||||
final Container container = tester.widget(finder);
|
||||
return container.decoration as BoxDecoration;
|
||||
return container.decoration! as BoxDecoration;
|
||||
}
|
||||
|
||||
TextStyle _getTextStyle(WidgetTester tester) {
|
||||
|
@ -390,8 +390,8 @@ void main() {
|
||||
List<Element> titles = tester.elementList(find.text('Title'))
|
||||
.toList()
|
||||
..sort((Element a, Element b) {
|
||||
final RenderParagraph aParagraph = a.renderObject as RenderParagraph;
|
||||
final RenderParagraph bParagraph = b.renderObject as RenderParagraph;
|
||||
final RenderParagraph aParagraph = a.renderObject! as RenderParagraph;
|
||||
final RenderParagraph bParagraph = b.renderObject! as RenderParagraph;
|
||||
return aParagraph.text.style!.fontSize!.compareTo(bParagraph.text.style!.fontSize!);
|
||||
});
|
||||
|
||||
@ -415,8 +415,8 @@ void main() {
|
||||
titles = tester.elementList(find.text('Title'))
|
||||
.toList()
|
||||
..sort((Element a, Element b) {
|
||||
final RenderParagraph aParagraph = a.renderObject as RenderParagraph;
|
||||
final RenderParagraph bParagraph = b.renderObject as RenderParagraph;
|
||||
final RenderParagraph aParagraph = a.renderObject! as RenderParagraph;
|
||||
final RenderParagraph bParagraph = b.renderObject! as RenderParagraph;
|
||||
return aParagraph.text.style!.fontSize!.compareTo(bParagraph.text.style!.fontSize!);
|
||||
});
|
||||
|
||||
|
@ -83,8 +83,8 @@ void main() {
|
||||
final List<Element> titles = tester.elementList(find.text('An iPod'))
|
||||
.toList()
|
||||
..sort((Element a, Element b) {
|
||||
final RenderParagraph aParagraph = a.renderObject as RenderParagraph;
|
||||
final RenderParagraph bParagraph = b.renderObject as RenderParagraph;
|
||||
final RenderParagraph aParagraph = a.renderObject! as RenderParagraph;
|
||||
final RenderParagraph bParagraph = b.renderObject! as RenderParagraph;
|
||||
return aParagraph.text.style!.fontSize!.compareTo(
|
||||
bParagraph.text.style!.fontSize!
|
||||
);
|
||||
|
@ -301,7 +301,7 @@ void main() {
|
||||
final BoxDecoration decoration = tester.widget<Container>(find.descendant(
|
||||
of: find.byType(UnconstrainedBox),
|
||||
matching: find.byType(Container),
|
||||
)).decoration as BoxDecoration;
|
||||
)).decoration! as BoxDecoration;
|
||||
|
||||
expect(getRenderSegmentedControl(tester).thumbColor.value, CupertinoColors.systemGreen.color.value);
|
||||
expect(decoration.color!.value, CupertinoColors.systemRed.color.value);
|
||||
@ -312,7 +312,7 @@ void main() {
|
||||
final BoxDecoration decorationDark = tester.widget<Container>(find.descendant(
|
||||
of: find.byType(UnconstrainedBox),
|
||||
matching: find.byType(Container),
|
||||
)).decoration as BoxDecoration;
|
||||
)).decoration! as BoxDecoration;
|
||||
|
||||
|
||||
expect(getRenderSegmentedControl(tester).thumbColor.value, CupertinoColors.systemGreen.darkColor.value);
|
||||
|
@ -76,7 +76,7 @@ void main() {
|
||||
test('subtreeDepth 1', () {
|
||||
final Map<String, Object?> result = testTree.toDiagnosticsNode().toJsonMap(const DiagnosticsSerializationDelegate(subtreeDepth: 1));
|
||||
expect(result.containsKey('properties'), isFalse);
|
||||
final List<Map<String, Object>> children = result['children'] as List<Map<String, Object>>;
|
||||
final List<Map<String, Object>> children = result['children']! as List<Map<String, Object>>;
|
||||
expect(children[0].containsKey('children'), isFalse);
|
||||
expect(children[1].containsKey('children'), isFalse);
|
||||
expect(children[2].containsKey('children'), isFalse);
|
||||
@ -85,7 +85,7 @@ void main() {
|
||||
test('subtreeDepth 5', () {
|
||||
final Map<String, Object?> result = testTree.toDiagnosticsNode().toJsonMap(const DiagnosticsSerializationDelegate(subtreeDepth: 5));
|
||||
expect(result.containsKey('properties'), isFalse);
|
||||
final List<Map<String, Object>> children = result['children'] as List<Map<String, Object>>;
|
||||
final List<Map<String, Object>> children = result['children']! as List<Map<String, Object>>;
|
||||
expect(children[0]['children'], hasLength(0));
|
||||
expect(children[1]['children'], hasLength(3));
|
||||
expect(children[2]['children'], hasLength(0));
|
||||
@ -103,7 +103,7 @@ void main() {
|
||||
subtreeDepth: 1,
|
||||
));
|
||||
expect(result['properties'], hasLength(7));
|
||||
final List<Map<String, Object>> children = result['children'] as List<Map<String, Object>>;
|
||||
final List<Map<String, Object>> children = result['children']! as List<Map<String, Object>>;
|
||||
expect(children, hasLength(3));
|
||||
expect(children[0]['properties'], hasLength(0));
|
||||
expect(children[1]['properties'], hasLength(2));
|
||||
@ -119,11 +119,11 @@ void main() {
|
||||
},
|
||||
));
|
||||
expect(result['foo'], isTrue);
|
||||
final List<Map<String, Object>> properties = result['properties'] as List<Map<String, Object>>;
|
||||
final List<Map<String, Object>> properties = result['properties']! as List<Map<String, Object>>;
|
||||
expect(properties, hasLength(7));
|
||||
expect(properties.every((Map<String, Object> property) => property['foo'] == true), isTrue);
|
||||
|
||||
final List<Map<String, Object>> children = result['children'] as List<Map<String, Object>>;
|
||||
final List<Map<String, Object>> children = result['children']! as List<Map<String, Object>>;
|
||||
expect(children, hasLength(3));
|
||||
expect(children.every((Map<String, Object> child) => child['foo'] == true), isTrue);
|
||||
});
|
||||
@ -135,7 +135,7 @@ void main() {
|
||||
return nodes.whereType<StringProperty>().toList();
|
||||
},
|
||||
));
|
||||
final List<Map<String, Object>> properties = result['properties'] as List<Map<String, Object>>;
|
||||
final List<Map<String, Object>> properties = result['properties']! as List<Map<String, Object>>;
|
||||
expect(properties, hasLength(3));
|
||||
expect(properties.every((Map<String, Object> property) => property['type'] == 'StringProperty'), isTrue);
|
||||
});
|
||||
@ -154,7 +154,7 @@ void main() {
|
||||
];
|
||||
},
|
||||
));
|
||||
final List<Map<String, Object>> properties = result['properties'] as List<Map<String, Object>>;
|
||||
final List<Map<String, Object>> properties = result['properties']! as List<Map<String, Object>>;
|
||||
expect(properties, hasLength(1));
|
||||
expect(properties.single['name'], 'foo');
|
||||
});
|
||||
@ -166,7 +166,7 @@ void main() {
|
||||
return nodes.where((DiagnosticsNode node) => node.getProperties().isEmpty).toList();
|
||||
},
|
||||
));
|
||||
final List<Map<String, Object>> children = result['children'] as List<Map<String, Object>>;
|
||||
final List<Map<String, Object>> children = result['children']! as List<Map<String, Object>>;
|
||||
expect(children, hasLength(1));
|
||||
});
|
||||
|
||||
@ -177,7 +177,7 @@ void main() {
|
||||
return nodes.expand((DiagnosticsNode node) => node.getChildren()).toList();
|
||||
},
|
||||
));
|
||||
final List<Map<String, Object>> children = result['children'] as List<Map<String, Object>>;
|
||||
final List<Map<String, Object>> children = result['children']! as List<Map<String, Object>>;
|
||||
expect(children, hasLength(3));
|
||||
expect(children.first['name'], 'child node B1');
|
||||
});
|
||||
@ -190,11 +190,11 @@ void main() {
|
||||
return nodes.take(2).toList();
|
||||
},
|
||||
));
|
||||
final List<Map<String, Object>> children = result['children'] as List<Map<String, Object>>;
|
||||
final List<Map<String, Object>> children = result['children']! as List<Map<String, Object>>;
|
||||
expect(children, hasLength(3));
|
||||
expect(children.last['truncated'], isTrue);
|
||||
|
||||
final List<Map<String, Object>> properties = result['properties'] as List<Map<String, Object>>;
|
||||
final List<Map<String, Object>> properties = result['properties']! as List<Map<String, Object>>;
|
||||
expect(properties, hasLength(3));
|
||||
expect(properties.last['truncated'], isTrue);
|
||||
});
|
||||
@ -207,11 +207,11 @@ void main() {
|
||||
return delegate.copyWith(includeProperties: false);
|
||||
},
|
||||
));
|
||||
final List<Map<String, Object>> properties = result['properties'] as List<Map<String, Object>>;
|
||||
final List<Map<String, Object>> properties = result['properties']! as List<Map<String, Object>>;
|
||||
expect(properties, hasLength(7));
|
||||
expect(properties.every((Map<String, Object> property) => !property.containsKey('properties')), isTrue);
|
||||
|
||||
final List<Map<String, Object>> children = result['children'] as List<Map<String, Object>>;
|
||||
final List<Map<String, Object>> children = result['children']! as List<Map<String, Object>>;
|
||||
expect(children, hasLength(3));
|
||||
expect(children.every((Map<String, Object> child) => !child.containsKey('properties')), isTrue);
|
||||
});
|
||||
|
@ -137,7 +137,7 @@ void validateIterableFlagsPropertyJsonSerialization(FlagsSummary<Object?> proper
|
||||
void validateIterablePropertyJsonSerialization(IterableProperty<Object> property) {
|
||||
final Map<String, Object> json = simulateJsonSerialization(property);
|
||||
if (property.value != null) {
|
||||
final List<Object> valuesJson = json['values'] as List<Object>;
|
||||
final List<Object> valuesJson = json['values']! as List<Object>;
|
||||
final List<String> expectedValues = property.value!.map<String>((Object value) => value.toString()).toList();
|
||||
expect(listEquals(valuesJson, expectedValues), isTrue);
|
||||
} else {
|
||||
|
@ -25,7 +25,7 @@ void main() {
|
||||
|
||||
final RenderConstrainedBox box = tester.renderObject(find.byType(CircleAvatar));
|
||||
expect(box.size, equals(const Size(100.0, 100.0)));
|
||||
final RenderDecoratedBox child = box.child as RenderDecoratedBox;
|
||||
final RenderDecoratedBox child = box.child! as RenderDecoratedBox;
|
||||
final BoxDecoration decoration = child.decoration as BoxDecoration;
|
||||
expect(decoration.color, equals(backgroundColor));
|
||||
|
||||
@ -47,7 +47,7 @@ void main() {
|
||||
|
||||
final RenderConstrainedBox box = tester.renderObject(find.byType(CircleAvatar));
|
||||
expect(box.size, equals(const Size(100.0, 100.0)));
|
||||
final RenderDecoratedBox child = box.child as RenderDecoratedBox;
|
||||
final RenderDecoratedBox child = box.child! as RenderDecoratedBox;
|
||||
final BoxDecoration decoration = child.decoration as BoxDecoration;
|
||||
expect(decoration.color, equals(backgroundColor));
|
||||
|
||||
@ -67,7 +67,7 @@ void main() {
|
||||
|
||||
final RenderConstrainedBox box = tester.renderObject(find.byType(CircleAvatar));
|
||||
expect(box.size, equals(const Size(100.0, 100.0)));
|
||||
final RenderDecoratedBox child = box.child as RenderDecoratedBox;
|
||||
final RenderDecoratedBox child = box.child! as RenderDecoratedBox;
|
||||
final BoxDecoration decoration = child.decoration as BoxDecoration;
|
||||
expect(decoration.image!.fit, equals(BoxFit.cover));
|
||||
});
|
||||
@ -87,7 +87,7 @@ void main() {
|
||||
|
||||
final RenderConstrainedBox box = tester.renderObject(find.byType(CircleAvatar));
|
||||
expect(box.size, equals(const Size(40.0, 40.0)));
|
||||
final RenderDecoratedBox child = box.child as RenderDecoratedBox;
|
||||
final RenderDecoratedBox child = box.child! as RenderDecoratedBox;
|
||||
final BoxDecoration decoration = child.decoration as BoxDecoration;
|
||||
expect(decoration.color, equals(fallback.primaryColorDark));
|
||||
|
||||
@ -112,7 +112,7 @@ void main() {
|
||||
);
|
||||
|
||||
final RenderConstrainedBox box = tester.renderObject(find.byType(CircleAvatar));
|
||||
final RenderDecoratedBox child = box.child as RenderDecoratedBox;
|
||||
final RenderDecoratedBox child = box.child! as RenderDecoratedBox;
|
||||
final BoxDecoration decoration = child.decoration as BoxDecoration;
|
||||
expect(decoration.color, equals(theme.primaryColorLight));
|
||||
|
||||
@ -137,7 +137,7 @@ void main() {
|
||||
);
|
||||
|
||||
final RenderConstrainedBox box = tester.renderObject(find.byType(CircleAvatar));
|
||||
final RenderDecoratedBox child = box.child as RenderDecoratedBox;
|
||||
final RenderDecoratedBox child = box.child! as RenderDecoratedBox;
|
||||
final BoxDecoration decoration = child.decoration as BoxDecoration;
|
||||
expect(decoration.color, equals(theme.primaryColorDark));
|
||||
|
||||
@ -204,7 +204,7 @@ void main() {
|
||||
|
||||
final RenderConstrainedBox box = tester.renderObject(find.byType(CircleAvatar));
|
||||
expect(box.size, equals(const Size(100.0, 100.0)));
|
||||
final RenderDecoratedBox child = box.child as RenderDecoratedBox;
|
||||
final RenderDecoratedBox child = box.child! as RenderDecoratedBox;
|
||||
final BoxDecoration decoration = child.decoration as BoxDecoration;
|
||||
expect(decoration.color, equals(backgroundColor));
|
||||
|
||||
@ -226,7 +226,7 @@ void main() {
|
||||
|
||||
final RenderConstrainedBox box = tester.renderObject(find.byType(CircleAvatar));
|
||||
expect(box.size, equals(const Size(100.0, 100.0)));
|
||||
final RenderDecoratedBox child = box.child as RenderDecoratedBox;
|
||||
final RenderDecoratedBox child = box.child! as RenderDecoratedBox;
|
||||
final BoxDecoration decoration = child.decoration as BoxDecoration;
|
||||
expect(decoration.color, equals(backgroundColor));
|
||||
|
||||
@ -249,7 +249,7 @@ void main() {
|
||||
|
||||
final RenderConstrainedBox box = tester.renderObject(find.byType(CircleAvatar));
|
||||
expect(box.size, equals(const Size(100.0, 100.0)));
|
||||
final RenderDecoratedBox child = box.child as RenderDecoratedBox;
|
||||
final RenderDecoratedBox child = box.child! as RenderDecoratedBox;
|
||||
final BoxDecoration decoration = child.decoration as BoxDecoration;
|
||||
expect(decoration.color, equals(backgroundColor));
|
||||
|
||||
|
@ -956,7 +956,7 @@ void main() {
|
||||
|
||||
Table table = tester.widget(find.byType(Table));
|
||||
TableRow tableRow = table.children.last;
|
||||
BoxDecoration boxDecoration = tableRow.decoration as BoxDecoration;
|
||||
BoxDecoration boxDecoration = tableRow.decoration! as BoxDecoration;
|
||||
expect(boxDecoration.border!.top.width, 1.0);
|
||||
|
||||
const double thickness = 4.2;
|
||||
@ -973,7 +973,7 @@ void main() {
|
||||
);
|
||||
table = tester.widget(find.byType(Table));
|
||||
tableRow = table.children.last;
|
||||
boxDecoration = tableRow.decoration as BoxDecoration;
|
||||
boxDecoration = tableRow.decoration! as BoxDecoration;
|
||||
expect(boxDecoration.border!.top.width, thickness);
|
||||
});
|
||||
|
||||
@ -1007,7 +1007,7 @@ void main() {
|
||||
|
||||
Table table = tester.widget(find.byType(Table));
|
||||
TableRow tableRow = table.children.last;
|
||||
BoxDecoration boxDecoration = tableRow.decoration as BoxDecoration;
|
||||
BoxDecoration boxDecoration = tableRow.decoration! as BoxDecoration;
|
||||
expect(boxDecoration.border!.bottom.width, 1.0);
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -1022,7 +1022,7 @@ void main() {
|
||||
);
|
||||
table = tester.widget(find.byType(Table));
|
||||
tableRow = table.children.last;
|
||||
boxDecoration = tableRow.decoration as BoxDecoration;
|
||||
boxDecoration = tableRow.decoration! as BoxDecoration;
|
||||
expect(boxDecoration.border!.bottom.width, 0.0);
|
||||
});
|
||||
|
||||
@ -1175,7 +1175,7 @@ void main() {
|
||||
BoxDecoration lastTableRowBoxDecoration() {
|
||||
final Table table = tester.widget(find.byType(Table));
|
||||
final TableRow tableRow = table.children.last;
|
||||
return tableRow.decoration as BoxDecoration;
|
||||
return tableRow.decoration! as BoxDecoration;
|
||||
}
|
||||
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
@ -1229,7 +1229,7 @@ void main() {
|
||||
BoxDecoration lastTableRowBoxDecoration() {
|
||||
final Table table = tester.widget(find.byType(Table));
|
||||
final TableRow tableRow = table.children.last;
|
||||
return tableRow.decoration as BoxDecoration;
|
||||
return tableRow.decoration! as BoxDecoration;
|
||||
}
|
||||
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
@ -1276,7 +1276,7 @@ void main() {
|
||||
|
||||
final TestGesture gesture = await tester.startGesture(tester.getCenter(find.text('Content1')));
|
||||
await tester.pump(const Duration(milliseconds: 200)); // splash is well underway
|
||||
final RenderBox box = Material.of(tester.element(find.byType(InkWell))) as RenderBox;
|
||||
final RenderBox box = Material.of(tester.element(find.byType(InkWell)))! as RenderBox;
|
||||
expect(box, paints..circle(x: 68.0, y: 24.0, color: pressedColor));
|
||||
await gesture.up();
|
||||
});
|
||||
|
@ -246,5 +246,5 @@ void main() {
|
||||
BoxDecoration _tableRowBoxDecoration({required WidgetTester tester, required int index}) {
|
||||
final Table table = tester.widget(find.byType(Table));
|
||||
final TableRow tableRow = table.children[index];
|
||||
return tableRow.decoration as BoxDecoration;
|
||||
return tableRow.decoration! as BoxDecoration;
|
||||
}
|
||||
|
@ -635,7 +635,7 @@ void main() {
|
||||
BorderSide getBorderSide() {
|
||||
final OutlinedBorder border = tester.widget<Material>(
|
||||
find.descendant(of: outlinedButton, matching: find.byType(Material))
|
||||
).shape as OutlinedBorder;
|
||||
).shape! as OutlinedBorder;
|
||||
return border.side;
|
||||
}
|
||||
|
||||
@ -1180,11 +1180,11 @@ PhysicalModelLayer _findPhysicalLayer(Element element) {
|
||||
expect(element, isNotNull);
|
||||
RenderObject? object = element.renderObject;
|
||||
while (object != null && object is! RenderRepaintBoundary && object is! RenderView) {
|
||||
object = object.parent as RenderObject;
|
||||
object = object.parent as RenderObject?;
|
||||
}
|
||||
expect(object!.debugLayer, isNotNull);
|
||||
expect(object.debugLayer!.firstChild, isA<PhysicalModelLayer>());
|
||||
final PhysicalModelLayer layer = object.debugLayer!.firstChild as PhysicalModelLayer;
|
||||
final PhysicalModelLayer layer = object.debugLayer!.firstChild! as PhysicalModelLayer;
|
||||
final Layer child = layer.firstChild!;
|
||||
return child is PhysicalModelLayer ? child : layer;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ void main() {
|
||||
await tester.tap(find.text('BUTTON'));
|
||||
await tester.pump(const Duration(milliseconds: 10));
|
||||
|
||||
final RenderBox splash = Material.of(tester.element(find.byType(InkWell))) as RenderBox;
|
||||
final RenderBox splash = Material.of(tester.element(find.byType(InkWell)))! as RenderBox;
|
||||
expect(splash, paints..circle(color: splashColor));
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
@ -72,7 +72,7 @@ void main() {
|
||||
await tester.pump(const Duration(milliseconds: 10));
|
||||
|
||||
if (!kIsWeb) {
|
||||
final RenderBox splash = Material.of(tester.element(find.byType(InkWell))) as RenderBox;
|
||||
final RenderBox splash = Material.of(tester.element(find.byType(InkWell)))! as RenderBox;
|
||||
expect(splash, paints..circle(color: splashColor));
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ void main() {
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.space);
|
||||
await tester.pump(const Duration(milliseconds: 10));
|
||||
|
||||
final RenderBox splash = Material.of(tester.element(find.byType(InkWell))) as RenderBox;
|
||||
final RenderBox splash = Material.of(tester.element(find.byType(InkWell)))! as RenderBox;
|
||||
expect(splash, paints..circle(color: splashColor));
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
@ -195,7 +195,7 @@ void main() {
|
||||
await tester.pump(); // start gesture
|
||||
await tester.pump(const Duration(milliseconds: 200)); // wait for splash to be well under way
|
||||
|
||||
final RenderBox box = Material.of(tester.element(find.byType(InkWell))) as RenderBox;
|
||||
final RenderBox box = Material.of(tester.element(find.byType(InkWell)))! as RenderBox;
|
||||
// centered in material button.
|
||||
expect(box, paints..circle(x: 44.0, y: 18.0, color: splashColor));
|
||||
await gesture.up();
|
||||
@ -226,7 +226,7 @@ void main() {
|
||||
final TestGesture gesture = await tester.startGesture(top);
|
||||
await tester.pump(); // start gesture
|
||||
await tester.pump(const Duration(milliseconds: 200)); // wait for splash to be well under way
|
||||
final RenderBox box = Material.of(tester.element(find.byType(InkWell))) as RenderBox;
|
||||
final RenderBox box = Material.of(tester.element(find.byType(InkWell)))! as RenderBox;
|
||||
// paints above above material
|
||||
expect(box, paints..circle(x: 44.0, y: 0.0, color: splashColor));
|
||||
await gesture.up();
|
||||
@ -325,7 +325,7 @@ void main() {
|
||||
),
|
||||
),
|
||||
);
|
||||
final RenderBox box = Material.of(tester.element(find.byType(InkWell))) as RenderBox;
|
||||
final RenderBox box = Material.of(tester.element(find.byType(InkWell)))! as RenderBox;
|
||||
expect(box, isNot(paints..rect(color: focusColor)));
|
||||
|
||||
focusNode.requestFocus();
|
||||
@ -424,7 +424,7 @@ void main() {
|
||||
),
|
||||
),
|
||||
);
|
||||
final RenderBox box = Material.of(tester.element(find.byType(InkWell))) as RenderBox;
|
||||
final RenderBox box = Material.of(tester.element(find.byType(InkWell)))! as RenderBox;
|
||||
final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse);
|
||||
await gesture.addPointer();
|
||||
addTearDown(gesture.removePointer);
|
||||
|
@ -429,7 +429,7 @@ void main() {
|
||||
|
||||
test('ColorDiagnosticsProperty includes valueProperties in JSON', () {
|
||||
ColorProperty property = ColorProperty('foo', const Color.fromARGB(10, 20, 30, 40));
|
||||
final Map<String, Object> valueProperties = property.toJsonMap(const DiagnosticsSerializationDelegate())['valueProperties'] as Map<String, Object>;
|
||||
final Map<String, Object> valueProperties = property.toJsonMap(const DiagnosticsSerializationDelegate())['valueProperties']! as Map<String, Object>;
|
||||
expect(valueProperties['alpha'], 10);
|
||||
expect(valueProperties['red'], 20);
|
||||
expect(valueProperties['green'], 30);
|
||||
|
@ -134,13 +134,13 @@ void main() {
|
||||
const BoxDecoration a = BoxDecoration(color: Color(0xFFFFFFFF));
|
||||
const BoxDecoration b = BoxDecoration(color: Color(0x00000000));
|
||||
|
||||
BoxDecoration c = Decoration.lerp(a, b, 0.0) as BoxDecoration;
|
||||
BoxDecoration c = Decoration.lerp(a, b, 0.0)! as BoxDecoration;
|
||||
expect(c.color, equals(a.color));
|
||||
|
||||
c = Decoration.lerp(a, b, 0.25) as BoxDecoration;
|
||||
c = Decoration.lerp(a, b, 0.25)! as BoxDecoration;
|
||||
expect(c.color, equals(Color.lerp(const Color(0xFFFFFFFF), const Color(0x00000000), 0.25)));
|
||||
|
||||
c = Decoration.lerp(a, b, 1.0) as BoxDecoration;
|
||||
c = Decoration.lerp(a, b, 1.0)! as BoxDecoration;
|
||||
expect(c.color, equals(b.color));
|
||||
});
|
||||
|
||||
|
@ -161,10 +161,10 @@ void main() {
|
||||
|
||||
final TestImageStreamCompleter resultingCompleter1 = imageCache!.putIfAbsent(testImage, () {
|
||||
return completer1;
|
||||
}) as TestImageStreamCompleter;
|
||||
})! as TestImageStreamCompleter;
|
||||
final TestImageStreamCompleter resultingCompleter2 = imageCache!.putIfAbsent(testImage, () {
|
||||
return completer2;
|
||||
}) as TestImageStreamCompleter;
|
||||
})! as TestImageStreamCompleter;
|
||||
|
||||
expect(resultingCompleter1, completer1);
|
||||
expect(resultingCompleter2, completer1);
|
||||
@ -178,7 +178,7 @@ void main() {
|
||||
|
||||
final TestImageStreamCompleter resultingCompleter1 = imageCache!.putIfAbsent(testImage, () {
|
||||
return completer1;
|
||||
}) as TestImageStreamCompleter;
|
||||
})! as TestImageStreamCompleter;
|
||||
|
||||
expect(imageCache!.statusForKey(testImage).pending, true);
|
||||
expect(imageCache!.statusForKey(testImage).live, true);
|
||||
@ -191,7 +191,7 @@ void main() {
|
||||
|
||||
final TestImageStreamCompleter resultingCompleter2 = imageCache!.putIfAbsent(testImage, () {
|
||||
return completer2;
|
||||
}) as TestImageStreamCompleter;
|
||||
})! as TestImageStreamCompleter;
|
||||
|
||||
expect(resultingCompleter1, completer1);
|
||||
expect(resultingCompleter2, completer2);
|
||||
@ -205,13 +205,13 @@ void main() {
|
||||
|
||||
final TestImageStreamCompleter resultingCompleter1 = imageCache!.putIfAbsent(testImage, () {
|
||||
return completer1;
|
||||
}) as TestImageStreamCompleter;
|
||||
})! as TestImageStreamCompleter;
|
||||
|
||||
imageCache!.evict(testImage);
|
||||
|
||||
final TestImageStreamCompleter resultingCompleter2 = imageCache!.putIfAbsent(testImage, () {
|
||||
return completer2;
|
||||
}) as TestImageStreamCompleter;
|
||||
})! as TestImageStreamCompleter;
|
||||
|
||||
expect(resultingCompleter1, completer1);
|
||||
expect(resultingCompleter2, completer2);
|
||||
@ -242,7 +242,7 @@ void main() {
|
||||
|
||||
final TestImageStreamCompleter resultingCompleter1 = imageCache!.putIfAbsent(testImage, () {
|
||||
return completer1;
|
||||
}) as TestImageStreamCompleter;
|
||||
})! as TestImageStreamCompleter;
|
||||
|
||||
expect(resultingCompleter1, completer1);
|
||||
expect(imageCache!.containsKey(testImage), true);
|
||||
@ -255,7 +255,7 @@ void main() {
|
||||
|
||||
final TestImageStreamCompleter resultingCompleter1 = imageCache!.putIfAbsent(testImage, () {
|
||||
return completer1;
|
||||
}) as TestImageStreamCompleter;
|
||||
})! as TestImageStreamCompleter;
|
||||
|
||||
// Mark as complete
|
||||
completer1.testSetImage(testImage);
|
||||
@ -276,7 +276,7 @@ void main() {
|
||||
|
||||
final TestImageStreamCompleter resultingCompleter1 = imageCache!.putIfAbsent(testImage, () {
|
||||
return completer1;
|
||||
}) as TestImageStreamCompleter;
|
||||
})! as TestImageStreamCompleter;
|
||||
|
||||
expect(imageCache!.statusForKey(testImage).pending, false);
|
||||
expect(imageCache!.statusForKey(testImage).keepAlive, true);
|
||||
@ -284,7 +284,7 @@ void main() {
|
||||
expect(imageCache!.statusForKey(testImage2).untracked, true);
|
||||
final TestImageStreamCompleter resultingCompleter2 = imageCache!.putIfAbsent(testImage2, () {
|
||||
return completer2;
|
||||
}) as TestImageStreamCompleter;
|
||||
})! as TestImageStreamCompleter;
|
||||
|
||||
|
||||
expect(imageCache!.statusForKey(testImage).pending, false);
|
||||
|
@ -43,7 +43,7 @@ void main() {
|
||||
// 0 12345678 9 101234567 18 90123456 27
|
||||
style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0),
|
||||
);
|
||||
TextSpan textSpan = painter.text as TextSpan;
|
||||
TextSpan textSpan = painter.text! as TextSpan;
|
||||
expect(textSpan.text!.length, 28);
|
||||
painter.layout();
|
||||
|
||||
@ -127,7 +127,7 @@ void main() {
|
||||
// The list is currently in the wrong order (so selection boxes will paint in the wrong order).
|
||||
);
|
||||
|
||||
textSpan = painter.text as TextSpan;
|
||||
textSpan = painter.text! as TextSpan;
|
||||
final List<List<TextBox>> list = <List<TextBox>>[
|
||||
for (int index = 0; index < textSpan.text!.length; index += 1)
|
||||
painter.getBoxesForSelection(TextSelection(baseOffset: index, extentOffset: index + 1)),
|
||||
@ -175,7 +175,7 @@ void main() {
|
||||
// 0 12345678 9 101234567 18 90123456 27
|
||||
style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0),
|
||||
);
|
||||
final TextSpan textSpan = painter.text as TextSpan;
|
||||
final TextSpan textSpan = painter.text! as TextSpan;
|
||||
expect(textSpan.text!.length, 28);
|
||||
painter.layout();
|
||||
|
||||
@ -265,7 +265,7 @@ void main() {
|
||||
text: 'A\u05D0', // A, Alef
|
||||
style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0),
|
||||
);
|
||||
final TextSpan textSpan = painter.text as TextSpan;
|
||||
final TextSpan textSpan = painter.text! as TextSpan;
|
||||
expect(textSpan.text!.length, 2);
|
||||
painter.layout(maxWidth: 10.0);
|
||||
|
||||
|
@ -20,7 +20,7 @@ void main() {
|
||||
child: child = RenderSizedBox(const Size(100.0, 100.0)),
|
||||
),
|
||||
);
|
||||
final BoxParentData childParentData = child.parentData as BoxParentData;
|
||||
final BoxParentData childParentData = child.parentData! as BoxParentData;
|
||||
|
||||
layout(root, phase: EnginePhase.layout);
|
||||
expect(childParentData.offset.dx, equals(0.0));
|
||||
|
@ -308,7 +308,7 @@ void main() {
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
);
|
||||
layout(paddedBox);
|
||||
final BoxParentData parentData = coloredBox.parentData as BoxParentData;
|
||||
final BoxParentData parentData = coloredBox.parentData! as BoxParentData;
|
||||
expect(parentData.offset.dx, isNot(equals(0.0)));
|
||||
paddedBox.child = null;
|
||||
|
||||
@ -535,7 +535,7 @@ void main() {
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
);
|
||||
final FlexParentData flexParentData = flexible.parentData as FlexParentData;
|
||||
final FlexParentData flexParentData = flexible.parentData! as FlexParentData;
|
||||
flexParentData.flex = 1;
|
||||
flexParentData.fit = FlexFit.tight;
|
||||
|
||||
@ -559,7 +559,7 @@ void main() {
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
);
|
||||
final FlexParentData flexParentData = flexible.parentData as FlexParentData;
|
||||
final FlexParentData flexParentData = flexible.parentData! as FlexParentData;
|
||||
flexParentData.flex = 1;
|
||||
flexParentData.fit = FlexFit.tight;
|
||||
|
||||
|
@ -82,7 +82,7 @@ void main() {
|
||||
flexible,
|
||||
],
|
||||
);
|
||||
final FlexParentData flexParentData = flexible.parentData as FlexParentData;
|
||||
final FlexParentData flexParentData = flexible.parentData! as FlexParentData;
|
||||
flexParentData.flex = 1;
|
||||
const BoxConstraints viewport = BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
|
||||
layout(flex, constraints: viewport);
|
||||
@ -105,7 +105,7 @@ void main() {
|
||||
flexible,
|
||||
],
|
||||
);
|
||||
final FlexParentData flexParentData = flexible.parentData as FlexParentData;
|
||||
final FlexParentData flexParentData = flexible.parentData! as FlexParentData;
|
||||
flexParentData.flex = 1;
|
||||
const BoxConstraints viewport = BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
|
||||
layout(flex, constraints: viewport);
|
||||
@ -165,7 +165,7 @@ void main() {
|
||||
expect(box2.size.width, equals(0.0));
|
||||
expect(box2.size.height, equals(0.0));
|
||||
|
||||
final FlexParentData box2ParentData = box2.parentData as FlexParentData;
|
||||
final FlexParentData box2ParentData = box2.parentData! as FlexParentData;
|
||||
box2ParentData.flex = 1;
|
||||
flex.markNeedsLayout();
|
||||
pumpFrame();
|
||||
@ -180,7 +180,7 @@ void main() {
|
||||
final RenderDecoratedBox box2 = RenderDecoratedBox(decoration: const BoxDecoration());
|
||||
final RenderFlex flex = RenderFlex(textDirection: TextDirection.ltr);
|
||||
flex.setupParentData(box2);
|
||||
final FlexParentData box2ParentData = box2.parentData as FlexParentData;
|
||||
final FlexParentData box2ParentData = box2.parentData! as FlexParentData;
|
||||
box2ParentData.flex = 2;
|
||||
flex.addAll(<RenderBox>[box1, box2]);
|
||||
layout(flex, constraints: const BoxConstraints(
|
||||
@ -216,7 +216,7 @@ void main() {
|
||||
minWidth: 0.0, maxWidth: 500.0, minHeight: 0.0, maxHeight: 400.0),
|
||||
);
|
||||
Offset getOffset(RenderBox box) {
|
||||
final FlexParentData parentData = box.parentData as FlexParentData;
|
||||
final FlexParentData parentData = box.parentData! as FlexParentData;
|
||||
return parentData.offset;
|
||||
}
|
||||
expect(getOffset(box1).dx, equals(50.0));
|
||||
@ -246,7 +246,7 @@ void main() {
|
||||
minWidth: 0.0, maxWidth: 500.0, minHeight: 0.0, maxHeight: 400.0),
|
||||
);
|
||||
Offset getOffset(RenderBox box) {
|
||||
final FlexParentData parentData = box.parentData as FlexParentData;
|
||||
final FlexParentData parentData = box.parentData! as FlexParentData;
|
||||
return parentData.offset;
|
||||
}
|
||||
expect(getOffset(box1).dx, equals(0.0));
|
||||
@ -257,7 +257,7 @@ void main() {
|
||||
expect(box3.size.width, equals(100.0));
|
||||
|
||||
void setFit(RenderBox box, FlexFit fit) {
|
||||
final FlexParentData parentData = box.parentData as FlexParentData;
|
||||
final FlexParentData parentData = box.parentData! as FlexParentData;
|
||||
parentData.flex = 1;
|
||||
parentData.fit = fit;
|
||||
}
|
||||
@ -298,7 +298,7 @@ void main() {
|
||||
minWidth: 0.0, maxWidth: 500.0, minHeight: 0.0, maxHeight: 400.0),
|
||||
);
|
||||
Offset getOffset(RenderBox box) {
|
||||
final FlexParentData parentData = box.parentData as FlexParentData;
|
||||
final FlexParentData parentData = box.parentData! as FlexParentData;
|
||||
return parentData.offset;
|
||||
}
|
||||
expect(getOffset(box1).dx, equals(0.0));
|
||||
@ -310,7 +310,7 @@ void main() {
|
||||
expect(flex.size.width, equals(300.0));
|
||||
|
||||
void setFit(RenderBox box, FlexFit fit) {
|
||||
final FlexParentData parentData = box.parentData as FlexParentData;
|
||||
final FlexParentData parentData = box.parentData! as FlexParentData;
|
||||
parentData.flex = 1;
|
||||
parentData.fit = fit;
|
||||
}
|
||||
@ -360,7 +360,7 @@ void main() {
|
||||
flex.addAll(<RenderBox>[box1, box2, box3]);
|
||||
layout(parent);
|
||||
expect(flex.size, const Size(300.0, 100.0));
|
||||
final FlexParentData box2ParentData = box2.parentData as FlexParentData;
|
||||
final FlexParentData box2ParentData = box2.parentData! as FlexParentData;
|
||||
box2ParentData.flex = 1;
|
||||
box2ParentData.fit = FlexFit.loose;
|
||||
flex.markNeedsLayout();
|
||||
@ -399,7 +399,7 @@ void main() {
|
||||
child: flex,
|
||||
);
|
||||
flex.addAll(<RenderBox>[box1, box2, box3]);
|
||||
final FlexParentData box2ParentData = box2.parentData as FlexParentData;
|
||||
final FlexParentData box2ParentData = box2.parentData! as FlexParentData;
|
||||
box2ParentData.flex = 1;
|
||||
final List<dynamic> exceptions = <dynamic>[];
|
||||
layout(parent, onErrors: () {
|
||||
@ -426,7 +426,7 @@ void main() {
|
||||
child: flex,
|
||||
);
|
||||
flex.addAll(<RenderBox>[box1, box2, box3]);
|
||||
final FlexParentData box2ParentData = box2.parentData as FlexParentData;
|
||||
final FlexParentData box2ParentData = box2.parentData! as FlexParentData;
|
||||
box2ParentData.flex = 1;
|
||||
box2ParentData.fit = FlexFit.loose;
|
||||
final List<dynamic> exceptions = <dynamic>[];
|
||||
|
@ -34,7 +34,7 @@ class RealRoot extends AbstractNode {
|
||||
}
|
||||
|
||||
@override
|
||||
PipelineOwner get owner => super.owner as PipelineOwner;
|
||||
PipelineOwner? get owner => super.owner as PipelineOwner?;
|
||||
|
||||
void layout() {
|
||||
child.layout(BoxConstraints.tight(const Size(500.0, 500.0)));
|
||||
|
@ -102,37 +102,37 @@ void main() {
|
||||
|
||||
test('PaintingContext.pushClipRect reuses the layer', () {
|
||||
_testPaintingContextLayerReuse<ClipRectLayer>((PaintingContextCallback painter, PaintingContext context, Offset offset, Layer? oldLayer) {
|
||||
return context.pushClipRect(true, offset, Rect.zero, painter, oldLayer: oldLayer as ClipRectLayer);
|
||||
return context.pushClipRect(true, offset, Rect.zero, painter, oldLayer: oldLayer as ClipRectLayer?);
|
||||
});
|
||||
});
|
||||
|
||||
test('PaintingContext.pushClipRRect reuses the layer', () {
|
||||
_testPaintingContextLayerReuse<ClipRRectLayer>((PaintingContextCallback painter, PaintingContext context, Offset offset, Layer? oldLayer) {
|
||||
return context.pushClipRRect(true, offset, Rect.zero, RRect.fromRectAndRadius(Rect.zero, const Radius.circular(1.0)), painter, oldLayer: oldLayer as ClipRRectLayer);
|
||||
return context.pushClipRRect(true, offset, Rect.zero, RRect.fromRectAndRadius(Rect.zero, const Radius.circular(1.0)), painter, oldLayer: oldLayer as ClipRRectLayer?);
|
||||
});
|
||||
});
|
||||
|
||||
test('PaintingContext.pushClipPath reuses the layer', () {
|
||||
_testPaintingContextLayerReuse<ClipPathLayer>((PaintingContextCallback painter, PaintingContext context, Offset offset, Layer? oldLayer) {
|
||||
return context.pushClipPath(true, offset, Rect.zero, Path(), painter, oldLayer: oldLayer as ClipPathLayer);
|
||||
return context.pushClipPath(true, offset, Rect.zero, Path(), painter, oldLayer: oldLayer as ClipPathLayer?);
|
||||
});
|
||||
});
|
||||
|
||||
test('PaintingContext.pushColorFilter reuses the layer', () {
|
||||
_testPaintingContextLayerReuse<ColorFilterLayer>((PaintingContextCallback painter, PaintingContext context, Offset offset, Layer? oldLayer) {
|
||||
return context.pushColorFilter(offset, const ColorFilter.mode(Color.fromRGBO(0, 0, 0, 1.0), BlendMode.clear), painter, oldLayer: oldLayer as ColorFilterLayer);
|
||||
return context.pushColorFilter(offset, const ColorFilter.mode(Color.fromRGBO(0, 0, 0, 1.0), BlendMode.clear), painter, oldLayer: oldLayer as ColorFilterLayer?);
|
||||
});
|
||||
});
|
||||
|
||||
test('PaintingContext.pushTransform reuses the layer', () {
|
||||
_testPaintingContextLayerReuse<TransformLayer>((PaintingContextCallback painter, PaintingContext context, Offset offset, Layer? oldLayer) {
|
||||
return context.pushTransform(true, offset, Matrix4.identity(), painter, oldLayer: oldLayer as TransformLayer);
|
||||
return context.pushTransform(true, offset, Matrix4.identity(), painter, oldLayer: oldLayer as TransformLayer?);
|
||||
});
|
||||
});
|
||||
|
||||
test('PaintingContext.pushOpacity reuses the layer', () {
|
||||
_testPaintingContextLayerReuse<OpacityLayer>((PaintingContextCallback painter, PaintingContext context, Offset offset, Layer? oldLayer) {
|
||||
return context.pushOpacity(offset, 100, painter, oldLayer: oldLayer as OpacityLayer);
|
||||
return context.pushOpacity(offset, 100, painter, oldLayer: oldLayer as OpacityLayer?);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ void main() {
|
||||
expect(getPixel(0, 0), equals(0x00000080));
|
||||
expect(getPixel(image.width - 1, 0 ), equals(0xffffffff));
|
||||
|
||||
final OffsetLayer layer = boundary.debugLayer as OffsetLayer;
|
||||
final OffsetLayer layer = boundary.debugLayer! as OffsetLayer;
|
||||
|
||||
image = await layer.toImage(Offset.zero & const Size(20.0, 20.0));
|
||||
expect(image.width, equals(20));
|
||||
|
@ -912,7 +912,7 @@ class TestRenderSliverBoxChildManager extends RenderSliverBoxChildManager {
|
||||
RenderSliverList createRenderSliverList() {
|
||||
assert(_renderObject == null);
|
||||
_renderObject = RenderSliverList(childManager: this);
|
||||
return _renderObject as RenderSliverList;
|
||||
return _renderObject! as RenderSliverList;
|
||||
}
|
||||
|
||||
RenderSliverFixedExtentList createRenderSliverFixedExtentList() {
|
||||
@ -921,7 +921,7 @@ class TestRenderSliverBoxChildManager extends RenderSliverBoxChildManager {
|
||||
childManager: this,
|
||||
itemExtent: 100.0,
|
||||
);
|
||||
return _renderObject as RenderSliverFixedExtentList;
|
||||
return _renderObject! as RenderSliverFixedExtentList;
|
||||
}
|
||||
|
||||
RenderSliverGrid createRenderSliverGrid() {
|
||||
@ -933,7 +933,7 @@ class TestRenderSliverBoxChildManager extends RenderSliverBoxChildManager {
|
||||
childAspectRatio: 4.0,
|
||||
),
|
||||
);
|
||||
return _renderObject as RenderSliverGrid;
|
||||
return _renderObject! as RenderSliverGrid;
|
||||
}
|
||||
|
||||
int? _currentlyUpdatingChildIndex;
|
||||
@ -973,7 +973,7 @@ class TestRenderSliverBoxChildManager extends RenderSliverBoxChildManager {
|
||||
@override
|
||||
void didAdoptChild(RenderBox child) {
|
||||
assert(_currentlyUpdatingChildIndex != null);
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
childParentData.index = _currentlyUpdatingChildIndex;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ class TestRenderSliverBoxChildManager extends RenderSliverBoxChildManager {
|
||||
_renderObject = RenderSliverFillViewport(
|
||||
childManager: this,
|
||||
);
|
||||
return _renderObject as RenderSliverFillViewport;
|
||||
return _renderObject! as RenderSliverFillViewport;
|
||||
}
|
||||
|
||||
int? _currentlyUpdatingChildIndex;
|
||||
@ -96,7 +96,7 @@ class TestRenderSliverBoxChildManager extends RenderSliverBoxChildManager {
|
||||
@override
|
||||
void didAdoptChild(RenderBox child) {
|
||||
assert(_currentlyUpdatingChildIndex != null);
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
childParentData.index = _currentlyUpdatingChildIndex;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ class TestRenderSliverBoxChildManager extends RenderSliverBoxChildManager {
|
||||
@override
|
||||
void didAdoptChild(RenderBox child) {
|
||||
assert(_currentlyUpdatingChildIndex != null);
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
childParentData.index = _currentlyUpdatingChildIndex;
|
||||
}
|
||||
|
||||
@ -288,7 +288,7 @@ void main() {
|
||||
);
|
||||
layout(root);
|
||||
|
||||
final SliverMultiBoxAdaptorParentData parentData = a.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData parentData = a.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
parentData.layoutOffset = 0.001;
|
||||
|
||||
root.offset = ViewportOffset.fixed(900.0);
|
||||
@ -323,7 +323,7 @@ void main() {
|
||||
);
|
||||
layout(root);
|
||||
|
||||
final SliverMultiBoxAdaptorParentData parentData = a.parentData as SliverMultiBoxAdaptorParentData;
|
||||
final SliverMultiBoxAdaptorParentData parentData = a.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
// Simulate double precision error.
|
||||
parentData.layoutOffset = -0.0000000000001;
|
||||
|
||||
|
@ -288,11 +288,11 @@ void main() {
|
||||
expect(root.size.width, equals(800.0));
|
||||
expect(root.size.height, equals(600.0));
|
||||
|
||||
final RenderSliver sliverA = a.parent as RenderSliver;
|
||||
final RenderSliver sliverB = b.parent as RenderSliver;
|
||||
final RenderSliver sliverC = c.parent as RenderSliver;
|
||||
final RenderSliver sliverD = d.parent as RenderSliver;
|
||||
final RenderSliver sliverE = e.parent as RenderSliver;
|
||||
final RenderSliver sliverA = a.parent! as RenderSliver;
|
||||
final RenderSliver sliverB = b.parent! as RenderSliver;
|
||||
final RenderSliver sliverC = c.parent! as RenderSliver;
|
||||
final RenderSliver sliverD = d.parent! as RenderSliver;
|
||||
final RenderSliver sliverE = e.parent! as RenderSliver;
|
||||
|
||||
expect(a.localToGlobal(const Offset(0.0, 0.0)), const Offset(0.0, 0.0));
|
||||
expect(b.localToGlobal(const Offset(0.0, 0.0)), const Offset(400.0, 0.0));
|
||||
|
@ -30,7 +30,7 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
children: <RenderBox>[red, green],
|
||||
);
|
||||
final StackParentData greenParentData = green.parentData as StackParentData;
|
||||
final StackParentData greenParentData = green.parentData! as StackParentData;
|
||||
greenParentData
|
||||
..top = 0.0
|
||||
..right = 0.0
|
||||
@ -79,7 +79,7 @@ void main() {
|
||||
clipBehavior: clip,
|
||||
);
|
||||
{ // Make sure that the child is positioned so the stack will consider it as overflowed.
|
||||
final StackParentData parentData = child.parentData as StackParentData;
|
||||
final StackParentData parentData = child.parentData! as StackParentData;
|
||||
parentData.left = parentData.right = 0;
|
||||
}
|
||||
layout(stack, constraints: viewport, phase: EnginePhase.composite, onErrors: expectOverflowedErrors);
|
||||
|
@ -45,7 +45,7 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
final RenderDecoratedBox box = key.currentContext!.findRenderObject() as RenderDecoratedBox;
|
||||
final RenderDecoratedBox box = key.currentContext!.findRenderObject()! as RenderDecoratedBox;
|
||||
actualDecoration = box.decoration as BoxDecoration;
|
||||
expect(actualDecoration.color, equals(decorationA.color));
|
||||
|
||||
|
@ -42,12 +42,12 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(50.0 + 70.0 / 2.0, 30.0 + 110.0 / 2.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(50.0 + 70.0 / 2.0, 30.0 + 110.0 / 2.0)));
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -69,17 +69,17 @@ void main() {
|
||||
const Offset first = Offset(50.0 + 70.0 / 2.0, 30.0 + 110.0 / 2.0);
|
||||
const Offset last = Offset(37.0 + 59.0 / 2.0, 31.0 + 71.0 / 2.0);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(first));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(Offset.lerp(first, last, 0.5)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(last));
|
||||
|
||||
expect(box, hasAGoodToStringDeep);
|
||||
@ -126,12 +126,12 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(50.0 + 70.0 / 2.0, 30.0 + 110.0 / 2.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(50.0 + 70.0 / 2.0, 30.0 + 110.0 / 2.0)));
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -155,17 +155,17 @@ void main() {
|
||||
const Offset first = Offset(50.0 + 70.0 / 2.0, 30.0 + 110.0 / 2.0);
|
||||
const Offset last = Offset(37.0 + 59.0 / 2.0, 31.0 + 71.0 / 2.0);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(first));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(Offset.lerp(first, last, 0.5)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(last));
|
||||
|
||||
expect(box, hasAGoodToStringDeep);
|
||||
@ -212,12 +212,12 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(800.0 - 50.0 - 70.0 / 2.0, 30.0 + 110.0 / 2.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(800.0 - 50.0 - 70.0 / 2.0, 30.0 + 110.0 / 2.0)));
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -241,17 +241,17 @@ void main() {
|
||||
const Offset first = Offset(800.0 - 50.0 - 70.0 / 2.0, 30.0 + 110.0 / 2.0);
|
||||
const Offset last = Offset(800.0 - 37.0 - 59.0 / 2.0, 31.0 + 71.0 / 2.0);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(first));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(Offset.lerp(first, last, 0.5)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(last));
|
||||
|
||||
expect(box, hasAGoodToStringDeep);
|
||||
@ -296,12 +296,12 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(50.0, 50.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(50.0, 50.0)));
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -320,12 +320,12 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(50.0, 50.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(100.0, 100.0)));
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -344,17 +344,17 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(100.0, 100.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(150.0, 150.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(200.0, 200.0)));
|
||||
});
|
||||
|
||||
@ -379,12 +379,12 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(50.0, 50.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(50.0, 50.0)));
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -403,17 +403,17 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(350.0, 50.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(350.0, 100.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(350.0, 150.0)));
|
||||
});
|
||||
|
||||
@ -440,12 +440,12 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(50.0, 50.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(50.0, 50.0)));
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -466,12 +466,12 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(50.0, 50.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(100.0, 100.0)));
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -492,17 +492,17 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(100.0, 100.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(150.0, 150.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(200.0, 200.0)));
|
||||
});
|
||||
|
||||
@ -529,12 +529,12 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(50.0, 50.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(50.0, 50.0)));
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -555,17 +555,17 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(350.0, 50.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(350.0, 100.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(350.0, 150.0)));
|
||||
});
|
||||
|
||||
@ -592,12 +592,12 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(750.0, 50.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(750.0, 50.0)));
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -618,12 +618,12 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(750.0, 50.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(700.0, 100.0)));
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -644,17 +644,17 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(700.0, 100.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(650.0, 150.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(600.0, 200.0)));
|
||||
});
|
||||
|
||||
@ -681,12 +681,12 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(750.0, 50.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(750.0, 50.0)));
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -707,17 +707,17 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(450.0, 50.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(450.0, 100.0)));
|
||||
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
box = key.currentContext!.findRenderObject() as RenderBox;
|
||||
box = key.currentContext!.findRenderObject()! as RenderBox;
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(450.0, 150.0)));
|
||||
});
|
||||
|
||||
|
@ -25,11 +25,10 @@ Future<ui.Image> captureImage(Element element) {
|
||||
assert(element.renderObject != null);
|
||||
RenderObject renderObject = element.renderObject!;
|
||||
while (!renderObject.isRepaintBoundary) {
|
||||
renderObject = renderObject.parent as RenderObject;
|
||||
assert(renderObject != null);
|
||||
renderObject = renderObject.parent! as RenderObject;
|
||||
}
|
||||
assert(!renderObject.debugNeedsPaint);
|
||||
final OffsetLayer layer = renderObject.debugLayer as OffsetLayer;
|
||||
final OffsetLayer layer = renderObject.debugLayer! as OffsetLayer;
|
||||
return layer.toImage(renderObject.paintBounds);
|
||||
}
|
||||
|
||||
|
@ -83,8 +83,7 @@ RenderObject _findRepaintBoundary(Element element) {
|
||||
assert(element.renderObject != null);
|
||||
RenderObject renderObject = element.renderObject!;
|
||||
while (!renderObject.isRepaintBoundary) {
|
||||
renderObject = renderObject.parent as RenderObject;
|
||||
assert(renderObject != null);
|
||||
renderObject = renderObject.parent! as RenderObject;
|
||||
}
|
||||
return renderObject;
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ class MinimumTextContrastGuideline extends AccessibilityGuideline {
|
||||
Future<Evaluation> evaluate(WidgetTester tester) async {
|
||||
final SemanticsNode root = tester.binding.pipelineOwner.semanticsOwner!.rootSemanticsNode!;
|
||||
final RenderView renderView = tester.binding.renderView;
|
||||
final OffsetLayer layer = renderView.debugLayer as OffsetLayer;
|
||||
final OffsetLayer layer = renderView.debugLayer! as OffsetLayer;
|
||||
ui.Image? image;
|
||||
final ByteData byteData = (await tester.binding.runAsync<ByteData?>(() async {
|
||||
// Needs to be the same pixel ratio otherwise our dimensions won't match the
|
||||
@ -370,7 +370,7 @@ class CustomMinimumContrastGuideline extends AccessibilityGuideline {
|
||||
// Obtain rendered image.
|
||||
|
||||
final RenderView renderView = tester.binding.renderView;
|
||||
final OffsetLayer layer = renderView.debugLayer as OffsetLayer;
|
||||
final OffsetLayer layer = renderView.debugLayer! as OffsetLayer;
|
||||
ui.Image? image;
|
||||
final ByteData byteData = (await tester.binding.runAsync<ByteData?>(() async {
|
||||
// Needs to be the same pixel ratio otherwise our dimensions won't match the
|
||||
@ -383,7 +383,7 @@ class CustomMinimumContrastGuideline extends AccessibilityGuideline {
|
||||
// How to evaluate a single element.
|
||||
|
||||
Evaluation evaluateElement(Element element) {
|
||||
final RenderBox renderObject = element.renderObject as RenderBox;
|
||||
final RenderBox renderObject = element.renderObject! as RenderBox;
|
||||
|
||||
final Rect originalPaintBounds = renderObject.paintBounds;
|
||||
|
||||
|
@ -205,7 +205,7 @@ abstract class WidgetController {
|
||||
/// * Use [renderObjectList] if you expect to match several render objects and want all of them.
|
||||
T renderObject<T extends RenderObject>(Finder finder) {
|
||||
TestAsyncUtils.guardSync();
|
||||
return finder.evaluate().single.renderObject as T;
|
||||
return finder.evaluate().single.renderObject! as T;
|
||||
}
|
||||
|
||||
/// The render object of the first matching widget according to a
|
||||
@ -216,7 +216,7 @@ abstract class WidgetController {
|
||||
/// * Use [renderObject] if you only expect to match one render object.
|
||||
T firstRenderObject<T extends RenderObject>(Finder finder) {
|
||||
TestAsyncUtils.guardSync();
|
||||
return finder.evaluate().first.renderObject as T;
|
||||
return finder.evaluate().first.renderObject! as T;
|
||||
}
|
||||
|
||||
/// The render objects of the matching widgets in the widget tree.
|
||||
@ -226,7 +226,7 @@ abstract class WidgetController {
|
||||
Iterable<T> renderObjectList<T extends RenderObject>(Finder finder) {
|
||||
TestAsyncUtils.guardSync();
|
||||
return finder.evaluate().map<T>((Element element) {
|
||||
final T result = element.renderObject as T;
|
||||
final T result = element.renderObject! as T;
|
||||
return result;
|
||||
});
|
||||
}
|
||||
@ -812,8 +812,7 @@ abstract class WidgetController {
|
||||
Offset _getElementPoint(Finder finder, Offset sizeToPoint(Size size)) {
|
||||
TestAsyncUtils.guardSync();
|
||||
final Element element = finder.evaluate().single;
|
||||
final RenderBox box = element.renderObject as RenderBox;
|
||||
assert(box != null);
|
||||
final RenderBox box = element.renderObject! as RenderBox;
|
||||
return box.localToGlobal(sizeToPoint(box.size));
|
||||
}
|
||||
|
||||
@ -822,8 +821,7 @@ abstract class WidgetController {
|
||||
Size getSize(Finder finder) {
|
||||
TestAsyncUtils.guardSync();
|
||||
final Element element = finder.evaluate().single;
|
||||
final RenderBox box = element.renderObject as RenderBox;
|
||||
assert(box != null);
|
||||
final RenderBox box = element.renderObject! as RenderBox;
|
||||
return box.size;
|
||||
}
|
||||
|
||||
|
@ -516,8 +516,7 @@ class _HitTestableFinder extends ChainedFinder {
|
||||
@override
|
||||
Iterable<Element> filter(Iterable<Element> parentCandidates) sync* {
|
||||
for (final Element candidate in parentCandidates) {
|
||||
final RenderBox box = candidate.renderObject as RenderBox;
|
||||
assert(box != null);
|
||||
final RenderBox box = candidate.renderObject! as RenderBox;
|
||||
final Offset absoluteOffset = box.localToGlobal(alignment.alongSize(box.size));
|
||||
final HitTestResult hitResult = HitTestResult();
|
||||
WidgetsBinding.instance!.hitTest(hitResult, absoluteOffset);
|
||||
|
@ -1362,7 +1362,7 @@ class _RendersOnPhysicalModel extends _MatchRenderObject<RenderPhysicalShape, Re
|
||||
bool renderObjectMatchesM(Map<dynamic, dynamic> matchState, RenderPhysicalShape renderObject) {
|
||||
if (renderObject.clipper.runtimeType != ShapeBorderClipper)
|
||||
return failWithDescription(matchState, 'clipper was: ${renderObject.clipper}');
|
||||
final ShapeBorderClipper shapeClipper = renderObject.clipper as ShapeBorderClipper;
|
||||
final ShapeBorderClipper shapeClipper = renderObject.clipper! as ShapeBorderClipper;
|
||||
|
||||
if (borderRadius != null && !assertRoundedRectangle(shapeClipper, borderRadius!, matchState))
|
||||
return false;
|
||||
@ -1430,7 +1430,7 @@ class _RendersOnPhysicalShape extends _MatchRenderObject<RenderPhysicalShape, Re
|
||||
bool renderObjectMatchesM(Map<dynamic, dynamic> matchState, RenderPhysicalShape renderObject) {
|
||||
if (renderObject.clipper.runtimeType != ShapeBorderClipper)
|
||||
return failWithDescription(matchState, 'clipper was: ${renderObject.clipper}');
|
||||
final ShapeBorderClipper shapeClipper = renderObject.clipper as ShapeBorderClipper;
|
||||
final ShapeBorderClipper shapeClipper = renderObject.clipper! as ShapeBorderClipper;
|
||||
|
||||
if (shapeClipper.shape != shape)
|
||||
return failWithDescription(matchState, 'shape was: ${shapeClipper.shape}');
|
||||
@ -1469,7 +1469,7 @@ class _ClipsWithBoundingRect extends _MatchRenderObject<RenderClipPath, RenderCl
|
||||
bool renderObjectMatchesM(Map<dynamic, dynamic> matchState, RenderClipPath renderObject) {
|
||||
if (renderObject.clipper.runtimeType != ShapeBorderClipper)
|
||||
return failWithDescription(matchState, 'clipper was: ${renderObject.clipper}');
|
||||
final ShapeBorderClipper shapeClipper = renderObject.clipper as ShapeBorderClipper;
|
||||
final ShapeBorderClipper shapeClipper = renderObject.clipper! as ShapeBorderClipper;
|
||||
if (shapeClipper.shape.runtimeType != RoundedRectangleBorder)
|
||||
return failWithDescription(matchState, 'shape was: ${shapeClipper.shape}');
|
||||
final RoundedRectangleBorder border = shapeClipper.shape as RoundedRectangleBorder;
|
||||
@ -1504,7 +1504,7 @@ class _ClipsWithBoundingRRect extends _MatchRenderObject<RenderClipPath, RenderC
|
||||
bool renderObjectMatchesM(Map<dynamic, dynamic> matchState, RenderClipPath renderObject) {
|
||||
if (renderObject.clipper.runtimeType != ShapeBorderClipper)
|
||||
return failWithDescription(matchState, 'clipper was: ${renderObject.clipper}');
|
||||
final ShapeBorderClipper shapeClipper = renderObject.clipper as ShapeBorderClipper;
|
||||
final ShapeBorderClipper shapeClipper = renderObject.clipper! as ShapeBorderClipper;
|
||||
if (shapeClipper.shape.runtimeType != RoundedRectangleBorder)
|
||||
return failWithDescription(matchState, 'shape was: ${shapeClipper.shape}');
|
||||
final RoundedRectangleBorder border = shapeClipper.shape as RoundedRectangleBorder;
|
||||
@ -1527,7 +1527,7 @@ class _ClipsWithShapeBorder extends _MatchRenderObject<RenderClipPath, RenderCli
|
||||
bool renderObjectMatchesM(Map<dynamic, dynamic> matchState, RenderClipPath renderObject) {
|
||||
if (renderObject.clipper.runtimeType != ShapeBorderClipper)
|
||||
return failWithDescription(matchState, 'clipper was: ${renderObject.clipper}');
|
||||
final ShapeBorderClipper shapeClipper = renderObject.clipper as ShapeBorderClipper;
|
||||
final ShapeBorderClipper shapeClipper = renderObject.clipper! as ShapeBorderClipper;
|
||||
if (shapeClipper.shape != shape)
|
||||
return failWithDescription(matchState, 'shape was: ${shapeClipper.shape}');
|
||||
return true;
|
||||
|
@ -681,7 +681,7 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
|
||||
'therefore no restoration data has been collected to restore from. Did you forget to wrap '
|
||||
'your widget tree in a RootRestorationScope?',
|
||||
);
|
||||
final Widget widget = (binding.renderViewElement as RenderObjectToWidgetElement<RenderObject>).widget.child!;
|
||||
final Widget widget = (binding.renderViewElement! as RenderObjectToWidgetElement<RenderObject>).widget.child!;
|
||||
final TestRestorationData restorationData = binding.restorationManager.restorationData;
|
||||
runApp(Container(key: UniqueKey()));
|
||||
await pump();
|
||||
|
Loading…
x
Reference in New Issue
Block a user