Commit aa071efd authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by Flutter GitHub Bot

implicit-casts:false in flutter/lib/src/cupertino (#45502)

parent a72cca13
...@@ -416,10 +416,10 @@ class _CupertinoAlertRenderElement extends RenderObjectElement { ...@@ -416,10 +416,10 @@ class _CupertinoAlertRenderElement extends RenderObjectElement {
Element _actionsElement; Element _actionsElement;
@override @override
_CupertinoAlertRenderWidget get widget => super.widget; _CupertinoAlertRenderWidget get widget => super.widget as _CupertinoAlertRenderWidget;
@override @override
_RenderCupertinoAlert get renderObject => super.renderObject; _RenderCupertinoAlert get renderObject => super.renderObject as _RenderCupertinoAlert;
@override @override
void visitChildren(ElementVisitor visitor) { void visitChildren(ElementVisitor visitor) {
...@@ -483,10 +483,10 @@ class _CupertinoAlertRenderElement extends RenderObjectElement { ...@@ -483,10 +483,10 @@ class _CupertinoAlertRenderElement extends RenderObjectElement {
assert(slot != null); assert(slot != null);
switch (slot) { switch (slot) {
case _AlertSections.contentSection: case _AlertSections.contentSection:
renderObject.contentSection = child; renderObject.contentSection = child as RenderBox;
break; break;
case _AlertSections.actionsSection: case _AlertSections.actionsSection:
renderObject.actionsSection = child; renderObject.actionsSection = child as RenderBox;
break; break;
} }
} }
...@@ -694,13 +694,13 @@ class _RenderCupertinoAlert extends RenderBox { ...@@ -694,13 +694,13 @@ class _RenderCupertinoAlert extends RenderBox {
// Set the position of the actions box to sit at the bottom of the alert. // 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. // The content box defaults to the top left, which is where we want it.
assert(actionsSection.parentData is MultiChildLayoutParentData); assert(actionsSection.parentData is MultiChildLayoutParentData);
final MultiChildLayoutParentData actionParentData = actionsSection.parentData; final MultiChildLayoutParentData actionParentData = actionsSection.parentData as MultiChildLayoutParentData;
actionParentData.offset = Offset(0.0, contentSize.height + dividerThickness); actionParentData.offset = Offset(0.0, contentSize.height + dividerThickness);
} }
@override @override
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
final MultiChildLayoutParentData contentParentData = contentSection.parentData; final MultiChildLayoutParentData contentParentData = contentSection.parentData as MultiChildLayoutParentData;
contentSection.paint(context, offset + contentParentData.offset); contentSection.paint(context, offset + contentParentData.offset);
final bool hasDivider = contentSection.size.height > 0.0 && actionsSection.size.height > 0.0; final bool hasDivider = contentSection.size.height > 0.0 && actionsSection.size.height > 0.0;
...@@ -708,7 +708,7 @@ class _RenderCupertinoAlert extends RenderBox { ...@@ -708,7 +708,7 @@ class _RenderCupertinoAlert extends RenderBox {
_paintDividerBetweenContentAndActions(context.canvas, offset); _paintDividerBetweenContentAndActions(context.canvas, offset);
} }
final MultiChildLayoutParentData actionsParentData = actionsSection.parentData; final MultiChildLayoutParentData actionsParentData = actionsSection.parentData as MultiChildLayoutParentData;
actionsSection.paint(context, offset + actionsParentData.offset); actionsSection.paint(context, offset + actionsParentData.offset);
} }
...@@ -726,8 +726,8 @@ class _RenderCupertinoAlert extends RenderBox { ...@@ -726,8 +726,8 @@ class _RenderCupertinoAlert extends RenderBox {
@override @override
bool hitTestChildren(BoxHitTestResult result, { Offset position }) { bool hitTestChildren(BoxHitTestResult result, { Offset position }) {
final MultiChildLayoutParentData contentSectionParentData = contentSection.parentData; final MultiChildLayoutParentData contentSectionParentData = contentSection.parentData as MultiChildLayoutParentData;
final MultiChildLayoutParentData actionsSectionParentData = actionsSection.parentData; final MultiChildLayoutParentData actionsSectionParentData = actionsSection.parentData as MultiChildLayoutParentData;
return result.addWithPaintOffset( return result.addWithPaintOffset(
offset: contentSectionParentData.offset, offset: contentSectionParentData.offset,
position: position, position: position,
...@@ -965,7 +965,7 @@ class _ActionButtonParentDataWidget extends ParentDataWidget<_CupertinoAlertActi ...@@ -965,7 +965,7 @@ class _ActionButtonParentDataWidget extends ParentDataWidget<_CupertinoAlertActi
@override @override
void applyParentData(RenderObject renderObject) { void applyParentData(RenderObject renderObject) {
assert(renderObject.parentData is _ActionButtonParentData); assert(renderObject.parentData is _ActionButtonParentData);
final _ActionButtonParentData parentData = renderObject.parentData; final _ActionButtonParentData parentData = renderObject.parentData as _ActionButtonParentData;
if (parentData.isPressed != isPressed) { if (parentData.isPressed != isPressed) {
parentData.isPressed = isPressed; parentData.isPressed = isPressed;
...@@ -1217,7 +1217,7 @@ class _RenderCupertinoAlertActions extends RenderBox ...@@ -1217,7 +1217,7 @@ class _RenderCupertinoAlertActions extends RenderBox
); );
assert(child.parentData is MultiChildLayoutParentData); assert(child.parentData is MultiChildLayoutParentData);
final MultiChildLayoutParentData parentData = child.parentData; final MultiChildLayoutParentData parentData = child.parentData as MultiChildLayoutParentData;
parentData.offset = Offset(0.0, verticalOffset); parentData.offset = Offset(0.0, verticalOffset);
verticalOffset += child.size.height; verticalOffset += child.size.height;
...@@ -1259,14 +1259,13 @@ class _RenderCupertinoAlertActions extends RenderBox ...@@ -1259,14 +1259,13 @@ class _RenderCupertinoAlertActions extends RenderBox
RenderBox prevChild; RenderBox prevChild;
while (child != null) { while (child != null) {
assert(child.parentData is _ActionButtonParentData); assert(child.parentData is _ActionButtonParentData);
final _ActionButtonParentData currentButtonParentData = child.parentData; final _ActionButtonParentData currentButtonParentData = child.parentData as _ActionButtonParentData;
final bool isButtonPressed = currentButtonParentData.isPressed; final bool isButtonPressed = currentButtonParentData.isPressed;
bool isPrevButtonPressed = false; bool isPrevButtonPressed = false;
if (prevChild != null) { if (prevChild != null) {
assert(prevChild.parentData is _ActionButtonParentData); assert(prevChild.parentData is _ActionButtonParentData);
final _ActionButtonParentData previousButtonParentData = prevChild final _ActionButtonParentData previousButtonParentData = prevChild.parentData as _ActionButtonParentData;
.parentData;
isPrevButtonPressed = previousButtonParentData.isPressed; isPrevButtonPressed = previousButtonParentData.isPressed;
} }
...@@ -1316,7 +1315,7 @@ class _RenderCupertinoAlertActions extends RenderBox ...@@ -1316,7 +1315,7 @@ class _RenderCupertinoAlertActions extends RenderBox
void _drawButtons(PaintingContext context, Offset offset) { void _drawButtons(PaintingContext context, Offset offset) {
RenderBox child = firstChild; RenderBox child = firstChild;
while (child != null) { while (child != null) {
final MultiChildLayoutParentData childParentData = child.parentData; final MultiChildLayoutParentData childParentData = child.parentData as MultiChildLayoutParentData;
context.paintChild(child, childParentData.offset + offset); context.paintChild(child, childParentData.offset + offset);
child = childAfter(child); child = childAfter(child);
} }
......
...@@ -271,7 +271,7 @@ class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget { ...@@ -271,7 +271,7 @@ class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget {
Color backgroundColor, Color backgroundColor,
Color activeColor, Color activeColor,
Color inactiveColor, Color inactiveColor,
Size iconSize, double iconSize,
Border border, Border border,
int currentIndex, int currentIndex,
ValueChanged<int> onTap, ValueChanged<int> onTap,
......
...@@ -978,7 +978,7 @@ class CupertinoDynamicColor extends Color with DiagnosticableMixin implements Di ...@@ -978,7 +978,7 @@ class CupertinoDynamicColor extends Color with DiagnosticableMixin implements Di
Element _debugContext; Element _debugContext;
assert(() { assert(() {
_debugContext = context; _debugContext = context as Element;
return true; return true;
}()); }());
return CupertinoDynamicColor._( return CupertinoDynamicColor._(
......
...@@ -39,7 +39,7 @@ typedef _ContextMenuPreviewBuilderChildless = Widget Function( ...@@ -39,7 +39,7 @@ typedef _ContextMenuPreviewBuilderChildless = Widget Function(
// paintBounds in global coordinates. // paintBounds in global coordinates.
Rect _getRect(GlobalKey globalKey) { Rect _getRect(GlobalKey globalKey) {
assert(globalKey.currentContext != null); assert(globalKey.currentContext != null);
final RenderBox renderBoxContainer = globalKey.currentContext.findRenderObject(); final RenderBox renderBoxContainer = globalKey.currentContext.findRenderObject() as RenderBox;
final Offset containerOffset = renderBoxContainer.localToGlobal( final Offset containerOffset = renderBoxContainer.localToGlobal(
renderBoxContainer.paintBounds.topLeft, renderBoxContainer.paintBounds.topLeft,
); );
...@@ -990,7 +990,7 @@ class _ContextMenuRouteStaticState extends State<_ContextMenuRouteStatic> with T ...@@ -990,7 +990,7 @@ class _ContextMenuRouteStaticState extends State<_ContextMenuRouteStatic> with T
_moveAnimation = Tween<Offset>( _moveAnimation = Tween<Offset>(
begin: Offset.zero, begin: Offset.zero,
end: Offset( end: Offset(
endX.clamp(-_kPadding, _kPadding), endX.clamp(-_kPadding, _kPadding) as double,
endY, endY,
), ),
).animate( ).animate(
......
...@@ -408,10 +408,10 @@ class _CupertinoDialogRenderElement extends RenderObjectElement { ...@@ -408,10 +408,10 @@ class _CupertinoDialogRenderElement extends RenderObjectElement {
Element _actionsElement; Element _actionsElement;
@override @override
_CupertinoDialogRenderWidget get widget => super.widget; _CupertinoDialogRenderWidget get widget => super.widget as _CupertinoDialogRenderWidget;
@override @override
_RenderCupertinoDialog get renderObject => super.renderObject; _RenderCupertinoDialog get renderObject => super.renderObject as _RenderCupertinoDialog;
@override @override
void visitChildren(ElementVisitor visitor) { void visitChildren(ElementVisitor visitor) {
...@@ -435,10 +435,10 @@ class _CupertinoDialogRenderElement extends RenderObjectElement { ...@@ -435,10 +435,10 @@ class _CupertinoDialogRenderElement extends RenderObjectElement {
assert(slot != null); assert(slot != null);
switch (slot) { switch (slot) {
case _AlertDialogSections.contentSection: case _AlertDialogSections.contentSection:
renderObject.contentSection = child; renderObject.contentSection = child as RenderBox;
break; break;
case _AlertDialogSections.actionsSection: case _AlertDialogSections.actionsSection:
renderObject.actionsSection = child; renderObject.actionsSection = child as RenderBox;
break; break;
} }
} }
...@@ -707,7 +707,7 @@ class _RenderCupertinoDialog extends RenderBox { ...@@ -707,7 +707,7 @@ class _RenderCupertinoDialog extends RenderBox {
// Set the position of the actions box to sit at the bottom of the dialog. // 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. // The content box defaults to the top left, which is where we want it.
assert(actionsSection.parentData is BoxParentData); assert(actionsSection.parentData is BoxParentData);
final BoxParentData actionParentData = actionsSection.parentData; final BoxParentData actionParentData = actionsSection.parentData as BoxParentData;
actionParentData.offset = Offset(0.0, contentSize.height + dividerThickness); actionParentData.offset = Offset(0.0, contentSize.height + dividerThickness);
} }
...@@ -769,13 +769,13 @@ class _RenderCupertinoDialog extends RenderBox { ...@@ -769,13 +769,13 @@ class _RenderCupertinoDialog extends RenderBox {
// Set the position of the actions box to sit at the bottom of the dialog. // 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. // The content box defaults to the top left, which is where we want it.
assert(actionsSection.parentData is BoxParentData); assert(actionsSection.parentData is BoxParentData);
final BoxParentData actionParentData = actionsSection.parentData; final BoxParentData actionParentData = actionsSection.parentData as BoxParentData;
actionParentData.offset = Offset(0.0, contentSize.height + dividerThickness); actionParentData.offset = Offset(0.0, contentSize.height + dividerThickness);
} }
@override @override
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
final BoxParentData contentParentData = contentSection.parentData; final BoxParentData contentParentData = contentSection.parentData as BoxParentData;
contentSection.paint(context, offset + contentParentData.offset); contentSection.paint(context, offset + contentParentData.offset);
final bool hasDivider = contentSection.size.height > 0.0 && actionsSection.size.height > 0.0; final bool hasDivider = contentSection.size.height > 0.0 && actionsSection.size.height > 0.0;
...@@ -783,7 +783,7 @@ class _RenderCupertinoDialog extends RenderBox { ...@@ -783,7 +783,7 @@ class _RenderCupertinoDialog extends RenderBox {
_paintDividerBetweenContentAndActions(context.canvas, offset); _paintDividerBetweenContentAndActions(context.canvas, offset);
} }
final BoxParentData actionsParentData = actionsSection.parentData; final BoxParentData actionsParentData = actionsSection.parentData as BoxParentData;
actionsSection.paint(context, offset + actionsParentData.offset); actionsSection.paint(context, offset + actionsParentData.offset);
} }
...@@ -801,8 +801,8 @@ class _RenderCupertinoDialog extends RenderBox { ...@@ -801,8 +801,8 @@ class _RenderCupertinoDialog extends RenderBox {
@override @override
bool hitTestChildren(BoxHitTestResult result, { Offset position }) { bool hitTestChildren(BoxHitTestResult result, { Offset position }) {
final BoxParentData contentSectionParentData = contentSection.parentData; final BoxParentData contentSectionParentData = contentSection.parentData as BoxParentData;
final BoxParentData actionsSectionParentData = actionsSection.parentData; final BoxParentData actionsSectionParentData = actionsSection.parentData as BoxParentData;
return result.addWithPaintOffset( return result.addWithPaintOffset(
offset: contentSectionParentData.offset, offset: contentSectionParentData.offset,
position: position, position: position,
...@@ -1032,7 +1032,7 @@ class _ActionButtonParentDataWidget extends ParentDataWidget<_CupertinoDialogAct ...@@ -1032,7 +1032,7 @@ class _ActionButtonParentDataWidget extends ParentDataWidget<_CupertinoDialogAct
@override @override
void applyParentData(RenderObject renderObject) { void applyParentData(RenderObject renderObject) {
assert(renderObject.parentData is _ActionButtonParentData); assert(renderObject.parentData is _ActionButtonParentData);
final _ActionButtonParentData parentData = renderObject.parentData; final _ActionButtonParentData parentData = renderObject.parentData as _ActionButtonParentData;
if (parentData.isPressed != isPressed) { if (parentData.isPressed != isPressed) {
parentData.isPressed = isPressed; parentData.isPressed = isPressed;
...@@ -1384,7 +1384,7 @@ class _RenderCupertinoDialogActions extends RenderBox ...@@ -1384,7 +1384,7 @@ class _RenderCupertinoDialogActions extends RenderBox
RenderBox currentChild = firstChild; RenderBox currentChild = firstChild;
while (currentChild != null) { while (currentChild != null) {
assert(currentChild.parentData is _ActionButtonParentData); assert(currentChild.parentData is _ActionButtonParentData);
final _ActionButtonParentData parentData = currentChild.parentData; final _ActionButtonParentData parentData = currentChild.parentData as _ActionButtonParentData;
if (parentData.isPressed) { if (parentData.isPressed) {
yield currentChild; yield currentChild;
} }
...@@ -1396,7 +1396,7 @@ class _RenderCupertinoDialogActions extends RenderBox ...@@ -1396,7 +1396,7 @@ class _RenderCupertinoDialogActions extends RenderBox
RenderBox currentChild = firstChild; RenderBox currentChild = firstChild;
while (currentChild != null) { while (currentChild != null) {
assert(currentChild.parentData is _ActionButtonParentData); assert(currentChild.parentData is _ActionButtonParentData);
final _ActionButtonParentData parentData = currentChild.parentData; final _ActionButtonParentData parentData = currentChild.parentData as _ActionButtonParentData;
if (parentData.isPressed) { if (parentData.isPressed) {
return true; return true;
} }
...@@ -1569,7 +1569,7 @@ class _RenderCupertinoDialogActions extends RenderBox ...@@ -1569,7 +1569,7 @@ class _RenderCupertinoDialogActions extends RenderBox
// The 2nd button needs to be offset to the right. // The 2nd button needs to be offset to the right.
assert(lastChild.parentData is MultiChildLayoutParentData); assert(lastChild.parentData is MultiChildLayoutParentData);
final MultiChildLayoutParentData secondButtonParentData = lastChild.parentData; final MultiChildLayoutParentData secondButtonParentData = lastChild.parentData as MultiChildLayoutParentData;
secondButtonParentData.offset = Offset(firstChild.size.width + dividerThickness, 0.0); secondButtonParentData.offset = Offset(firstChild.size.width + dividerThickness, 0.0);
// Calculate our size based on the button sizes. // Calculate our size based on the button sizes.
...@@ -1600,7 +1600,7 @@ class _RenderCupertinoDialogActions extends RenderBox ...@@ -1600,7 +1600,7 @@ class _RenderCupertinoDialogActions extends RenderBox
); );
assert(child.parentData is MultiChildLayoutParentData); assert(child.parentData is MultiChildLayoutParentData);
final MultiChildLayoutParentData parentData = child.parentData; final MultiChildLayoutParentData parentData = child.parentData as MultiChildLayoutParentData;
parentData.offset = Offset(0.0, verticalOffset); parentData.offset = Offset(0.0, verticalOffset);
verticalOffset += child.size.height; verticalOffset += child.size.height;
...@@ -1650,7 +1650,7 @@ class _RenderCupertinoDialogActions extends RenderBox ...@@ -1650,7 +1650,7 @@ class _RenderCupertinoDialogActions extends RenderBox
: Rect.zero; : Rect.zero;
final List<Rect> pressedButtonRects = _pressedButtons.map<Rect>((RenderBox pressedButton) { final List<Rect> pressedButtonRects = _pressedButtons.map<Rect>((RenderBox pressedButton) {
final MultiChildLayoutParentData buttonParentData = pressedButton.parentData; final MultiChildLayoutParentData buttonParentData = pressedButton.parentData as MultiChildLayoutParentData;
return Rect.fromLTWH( return Rect.fromLTWH(
offset.dx + buttonParentData.offset.dx, offset.dx + buttonParentData.offset.dx,
...@@ -1713,14 +1713,13 @@ class _RenderCupertinoDialogActions extends RenderBox ...@@ -1713,14 +1713,13 @@ class _RenderCupertinoDialogActions extends RenderBox
RenderBox prevChild; RenderBox prevChild;
while (child != null) { while (child != null) {
assert(child.parentData is _ActionButtonParentData); assert(child.parentData is _ActionButtonParentData);
final _ActionButtonParentData currentButtonParentData = child.parentData; final _ActionButtonParentData currentButtonParentData = child.parentData as _ActionButtonParentData;
final bool isButtonPressed = currentButtonParentData.isPressed; final bool isButtonPressed = currentButtonParentData.isPressed;
bool isPrevButtonPressed = false; bool isPrevButtonPressed = false;
if (prevChild != null) { if (prevChild != null) {
assert(prevChild.parentData is _ActionButtonParentData); assert(prevChild.parentData is _ActionButtonParentData);
final _ActionButtonParentData previousButtonParentData = prevChild final _ActionButtonParentData previousButtonParentData = prevChild.parentData as _ActionButtonParentData;
.parentData;
isPrevButtonPressed = previousButtonParentData.isPressed; isPrevButtonPressed = previousButtonParentData.isPressed;
} }
...@@ -1770,7 +1769,7 @@ class _RenderCupertinoDialogActions extends RenderBox ...@@ -1770,7 +1769,7 @@ class _RenderCupertinoDialogActions extends RenderBox
void _drawButtons(PaintingContext context, Offset offset) { void _drawButtons(PaintingContext context, Offset offset) {
RenderBox child = firstChild; RenderBox child = firstChild;
while (child != null) { while (child != null) {
final MultiChildLayoutParentData childParentData = child.parentData; final MultiChildLayoutParentData childParentData = child.parentData as MultiChildLayoutParentData;
context.paintChild(child, childParentData.offset + offset); context.paintChild(child, childParentData.offset + offset);
child = childAfter(child); child = childAfter(child);
} }
......
...@@ -69,8 +69,8 @@ class _HeroTag { ...@@ -69,8 +69,8 @@ class _HeroTag {
if (other.runtimeType != runtimeType) { if (other.runtimeType != runtimeType) {
return false; return false;
} }
final _HeroTag otherTag = other; return other is _HeroTag
return navigator == otherTag.navigator; && other.navigator == navigator;
} }
@override @override
...@@ -1416,7 +1416,7 @@ class _BackLabel extends StatelessWidget { ...@@ -1416,7 +1416,7 @@ class _BackLabel extends StatelessWidget {
if (specifiedPreviousTitle != null) { if (specifiedPreviousTitle != null) {
return _buildPreviousTitleWidget(context, specifiedPreviousTitle, null); return _buildPreviousTitleWidget(context, specifiedPreviousTitle, null);
} else if (route is CupertinoPageRoute<dynamic> && !route.isFirst) { } else if (route is CupertinoPageRoute<dynamic> && !route.isFirst) {
final CupertinoPageRoute<dynamic> cupertinoRoute = route; final CupertinoPageRoute<dynamic> cupertinoRoute = route as CupertinoPageRoute<dynamic>;
// There is no timing issue because the previousTitle Listenable changes // There is no timing issue because the previousTitle Listenable changes
// happen during route modifications before the ValueListenableBuilder // happen during route modifications before the ValueListenableBuilder
// is built. // is built.
...@@ -1465,7 +1465,7 @@ class _TransitionableNavigationBar extends StatelessWidget { ...@@ -1465,7 +1465,7 @@ class _TransitionableNavigationBar extends StatelessWidget {
final Widget child; final Widget child;
RenderBox get renderBox { RenderBox get renderBox {
final RenderBox box = componentsKeys.navBarBoxKey.currentContext.findRenderObject(); final RenderBox box = componentsKeys.navBarBoxKey.currentContext.findRenderObject() as RenderBox;
assert( assert(
box.attached, box.attached,
'_TransitionableNavigationBar.renderBox should be called when building ' '_TransitionableNavigationBar.renderBox should be called when building '
...@@ -1697,7 +1697,7 @@ class _NavigationBarComponentsTransition { ...@@ -1697,7 +1697,7 @@ class _NavigationBarComponentsTransition {
GlobalKey key, { GlobalKey key, {
@required RenderBox from, @required RenderBox from,
}) { }) {
final RenderBox componentBox = key.currentContext.findRenderObject(); final RenderBox componentBox = key.currentContext.findRenderObject() as RenderBox;
assert(componentBox.attached); assert(componentBox.attached);
return RelativeRect.fromRect( return RelativeRect.fromRect(
...@@ -1724,8 +1724,8 @@ class _NavigationBarComponentsTransition { ...@@ -1724,8 +1724,8 @@ class _NavigationBarComponentsTransition {
}) { }) {
final RelativeRect fromRect = positionInTransitionBox(fromKey, from: fromNavBarBox); final RelativeRect fromRect = positionInTransitionBox(fromKey, from: fromNavBarBox);
final RenderBox fromBox = fromKey.currentContext.findRenderObject(); final RenderBox fromBox = fromKey.currentContext.findRenderObject() as RenderBox;
final RenderBox toBox = toKey.currentContext.findRenderObject(); final RenderBox toBox = toKey.currentContext.findRenderObject() as RenderBox;
// We move a box with the size of the 'from' render object such that its // 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. // upper left corner is at the upper left corner of the 'to' render object.
...@@ -1764,7 +1764,7 @@ class _NavigationBarComponentsTransition { ...@@ -1764,7 +1764,7 @@ class _NavigationBarComponentsTransition {
} }
Widget get bottomLeading { Widget get bottomLeading {
final KeyedSubtree bottomLeading = bottomComponents.leadingKey.currentWidget; final KeyedSubtree bottomLeading = bottomComponents.leadingKey.currentWidget as KeyedSubtree;
if (bottomLeading == null) { if (bottomLeading == null) {
return null; return null;
...@@ -1780,7 +1780,7 @@ class _NavigationBarComponentsTransition { ...@@ -1780,7 +1780,7 @@ class _NavigationBarComponentsTransition {
} }
Widget get bottomBackChevron { Widget get bottomBackChevron {
final KeyedSubtree bottomBackChevron = bottomComponents.backChevronKey.currentWidget; final KeyedSubtree bottomBackChevron = bottomComponents.backChevronKey.currentWidget as KeyedSubtree;
if (bottomBackChevron == null) { if (bottomBackChevron == null) {
return null; return null;
...@@ -1799,7 +1799,7 @@ class _NavigationBarComponentsTransition { ...@@ -1799,7 +1799,7 @@ class _NavigationBarComponentsTransition {
} }
Widget get bottomBackLabel { Widget get bottomBackLabel {
final KeyedSubtree bottomBackLabel = bottomComponents.backLabelKey.currentWidget; final KeyedSubtree bottomBackLabel = bottomComponents.backLabelKey.currentWidget as KeyedSubtree;
if (bottomBackLabel == null) { if (bottomBackLabel == null) {
return null; return null;
...@@ -1831,9 +1831,9 @@ class _NavigationBarComponentsTransition { ...@@ -1831,9 +1831,9 @@ class _NavigationBarComponentsTransition {
} }
Widget get bottomMiddle { Widget get bottomMiddle {
final KeyedSubtree bottomMiddle = bottomComponents.middleKey.currentWidget; final KeyedSubtree bottomMiddle = bottomComponents.middleKey.currentWidget as KeyedSubtree;
final KeyedSubtree topBackLabel = topComponents.backLabelKey.currentWidget; final KeyedSubtree topBackLabel = topComponents.backLabelKey.currentWidget as KeyedSubtree;
final KeyedSubtree topLeading = topComponents.leadingKey.currentWidget; final KeyedSubtree topLeading = topComponents.leadingKey.currentWidget as KeyedSubtree;
// The middle component is non-null when the nav bar is a large title // The middle component is non-null when the nav bar is a large title
// nav bar but would be invisible when expanded, therefore don't show it here. // nav bar but would be invisible when expanded, therefore don't show it here.
...@@ -1890,9 +1890,9 @@ class _NavigationBarComponentsTransition { ...@@ -1890,9 +1890,9 @@ class _NavigationBarComponentsTransition {
} }
Widget get bottomLargeTitle { Widget get bottomLargeTitle {
final KeyedSubtree bottomLargeTitle = bottomComponents.largeTitleKey.currentWidget; final KeyedSubtree bottomLargeTitle = bottomComponents.largeTitleKey.currentWidget as KeyedSubtree;
final KeyedSubtree topBackLabel = topComponents.backLabelKey.currentWidget; final KeyedSubtree topBackLabel = topComponents.backLabelKey.currentWidget as KeyedSubtree;
final KeyedSubtree topLeading = topComponents.leadingKey.currentWidget; final KeyedSubtree topLeading = topComponents.leadingKey.currentWidget as KeyedSubtree;
if (bottomLargeTitle == null || !bottomLargeExpanded) { if (bottomLargeTitle == null || !bottomLargeExpanded) {
return null; return null;
...@@ -1961,7 +1961,7 @@ class _NavigationBarComponentsTransition { ...@@ -1961,7 +1961,7 @@ class _NavigationBarComponentsTransition {
} }
Widget get bottomTrailing { Widget get bottomTrailing {
final KeyedSubtree bottomTrailing = bottomComponents.trailingKey.currentWidget; final KeyedSubtree bottomTrailing = bottomComponents.trailingKey.currentWidget as KeyedSubtree;
if (bottomTrailing == null) { if (bottomTrailing == null) {
return null; return null;
...@@ -1977,7 +1977,7 @@ class _NavigationBarComponentsTransition { ...@@ -1977,7 +1977,7 @@ class _NavigationBarComponentsTransition {
} }
Widget get topLeading { Widget get topLeading {
final KeyedSubtree topLeading = topComponents.leadingKey.currentWidget; final KeyedSubtree topLeading = topComponents.leadingKey.currentWidget as KeyedSubtree;
if (topLeading == null) { if (topLeading == null) {
return null; return null;
...@@ -1993,8 +1993,8 @@ class _NavigationBarComponentsTransition { ...@@ -1993,8 +1993,8 @@ class _NavigationBarComponentsTransition {
} }
Widget get topBackChevron { Widget get topBackChevron {
final KeyedSubtree topBackChevron = topComponents.backChevronKey.currentWidget; final KeyedSubtree topBackChevron = topComponents.backChevronKey.currentWidget as KeyedSubtree;
final KeyedSubtree bottomBackChevron = bottomComponents.backChevronKey.currentWidget; final KeyedSubtree bottomBackChevron = bottomComponents.backChevronKey.currentWidget as KeyedSubtree;
if (topBackChevron == null) { if (topBackChevron == null) {
return null; return null;
...@@ -2006,7 +2006,7 @@ class _NavigationBarComponentsTransition { ...@@ -2006,7 +2006,7 @@ class _NavigationBarComponentsTransition {
// If it's the first page with a back chevron, shift in slightly from the // If it's the first page with a back chevron, shift in slightly from the
// right. // right.
if (bottomBackChevron == null) { if (bottomBackChevron == null) {
final RenderBox topBackChevronBox = topComponents.backChevronKey.currentContext.findRenderObject(); final RenderBox topBackChevronBox = topComponents.backChevronKey.currentContext.findRenderObject() as RenderBox;
from = to.shift( from = to.shift(
Offset( Offset(
forwardDirection * topBackChevronBox.size.width * 2.0, forwardDirection * topBackChevronBox.size.width * 2.0,
...@@ -2033,9 +2033,9 @@ class _NavigationBarComponentsTransition { ...@@ -2033,9 +2033,9 @@ class _NavigationBarComponentsTransition {
} }
Widget get topBackLabel { Widget get topBackLabel {
final KeyedSubtree bottomMiddle = bottomComponents.middleKey.currentWidget; final KeyedSubtree bottomMiddle = bottomComponents.middleKey.currentWidget as KeyedSubtree;
final KeyedSubtree bottomLargeTitle = bottomComponents.largeTitleKey.currentWidget; final KeyedSubtree bottomLargeTitle = bottomComponents.largeTitleKey.currentWidget as KeyedSubtree;
final KeyedSubtree topBackLabel = topComponents.backLabelKey.currentWidget; final KeyedSubtree topBackLabel = topComponents.backLabelKey.currentWidget as KeyedSubtree;
if (topBackLabel == null) { if (topBackLabel == null) {
return null; return null;
...@@ -2109,7 +2109,7 @@ class _NavigationBarComponentsTransition { ...@@ -2109,7 +2109,7 @@ class _NavigationBarComponentsTransition {
} }
Widget get topMiddle { Widget get topMiddle {
final KeyedSubtree topMiddle = topComponents.middleKey.currentWidget; final KeyedSubtree topMiddle = topComponents.middleKey.currentWidget as KeyedSubtree;
if (topMiddle == null) { if (topMiddle == null) {
return null; return null;
...@@ -2147,7 +2147,7 @@ class _NavigationBarComponentsTransition { ...@@ -2147,7 +2147,7 @@ class _NavigationBarComponentsTransition {
} }
Widget get topTrailing { Widget get topTrailing {
final KeyedSubtree topTrailing = topComponents.trailingKey.currentWidget; final KeyedSubtree topTrailing = topComponents.trailingKey.currentWidget as KeyedSubtree;
if (topTrailing == null) { if (topTrailing == null) {
return null; return null;
...@@ -2163,7 +2163,7 @@ class _NavigationBarComponentsTransition { ...@@ -2163,7 +2163,7 @@ class _NavigationBarComponentsTransition {
} }
Widget get topLargeTitle { Widget get topLargeTitle {
final KeyedSubtree topLargeTitle = topComponents.largeTitleKey.currentWidget; final KeyedSubtree topLargeTitle = topComponents.largeTitleKey.currentWidget as KeyedSubtree;
if (topLargeTitle == null || !topLargeExpanded) { if (topLargeTitle == null || !topLargeExpanded) {
return null; return null;
...@@ -2251,14 +2251,14 @@ final HeroFlightShuttleBuilder _navBarHeroFlightShuttleBuilder = ( ...@@ -2251,14 +2251,14 @@ final HeroFlightShuttleBuilder _navBarHeroFlightShuttleBuilder = (
assert(fromHeroContext.widget is Hero); assert(fromHeroContext.widget is Hero);
assert(toHeroContext.widget is Hero); assert(toHeroContext.widget is Hero);
final Hero fromHeroWidget = fromHeroContext.widget; final Hero fromHeroWidget = fromHeroContext.widget as Hero;
final Hero toHeroWidget = toHeroContext.widget; final Hero toHeroWidget = toHeroContext.widget as Hero;
assert(fromHeroWidget.child is _TransitionableNavigationBar); assert(fromHeroWidget.child is _TransitionableNavigationBar);
assert(toHeroWidget.child is _TransitionableNavigationBar); assert(toHeroWidget.child is _TransitionableNavigationBar);
final _TransitionableNavigationBar fromNavBar = fromHeroWidget.child; final _TransitionableNavigationBar fromNavBar = fromHeroWidget.child as _TransitionableNavigationBar;
final _TransitionableNavigationBar toNavBar = toHeroWidget.child; final _TransitionableNavigationBar toNavBar = toHeroWidget.child as _TransitionableNavigationBar;
assert(fromNavBar.componentsKeys != null); assert(fromNavBar.componentsKeys != null);
assert(toNavBar.componentsKeys != null); assert(toNavBar.componentsKeys != null);
......
...@@ -716,16 +716,16 @@ class _CupertinoEdgeShadowDecoration extends Decoration { ...@@ -716,16 +716,16 @@ class _CupertinoEdgeShadowDecoration extends Decoration {
@override @override
_CupertinoEdgeShadowDecoration lerpFrom(Decoration a, double t) { _CupertinoEdgeShadowDecoration lerpFrom(Decoration a, double t) {
if (a is! _CupertinoEdgeShadowDecoration) if (a is _CupertinoEdgeShadowDecoration)
return _CupertinoEdgeShadowDecoration.lerp(null, this, t); return _CupertinoEdgeShadowDecoration.lerp(a, this, t);
return _CupertinoEdgeShadowDecoration.lerp(a, this, t); return _CupertinoEdgeShadowDecoration.lerp(null, this, t);
} }
@override @override
_CupertinoEdgeShadowDecoration lerpTo(Decoration b, double t) { _CupertinoEdgeShadowDecoration lerpTo(Decoration b, double t) {
if (b is! _CupertinoEdgeShadowDecoration) if (b is _CupertinoEdgeShadowDecoration)
return _CupertinoEdgeShadowDecoration.lerp(this, null, t); return _CupertinoEdgeShadowDecoration.lerp(this, b, t);
return _CupertinoEdgeShadowDecoration.lerp(this, b, t); return _CupertinoEdgeShadowDecoration.lerp(this, null, t);
} }
@override @override
...@@ -737,8 +737,8 @@ class _CupertinoEdgeShadowDecoration extends Decoration { ...@@ -737,8 +737,8 @@ class _CupertinoEdgeShadowDecoration extends Decoration {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final _CupertinoEdgeShadowDecoration typedOther = other; return other is _CupertinoEdgeShadowDecoration
return edgeGradient == typedOther.edgeGradient; && other.edgeGradient == edgeGradient;
} }
@override @override
......
...@@ -416,9 +416,9 @@ bool _hitTestInteractive(GlobalKey customPaintKey, Offset offset) { ...@@ -416,9 +416,9 @@ bool _hitTestInteractive(GlobalKey customPaintKey, Offset offset) {
if (customPaintKey.currentContext == null) { if (customPaintKey.currentContext == null) {
return false; return false;
} }
final CustomPaint customPaint = customPaintKey.currentContext.widget; final CustomPaint customPaint = customPaintKey.currentContext.widget as CustomPaint;
final ScrollbarPainter painter = customPaint.foregroundPainter; final ScrollbarPainter painter = customPaint.foregroundPainter as ScrollbarPainter;
final RenderBox renderBox = customPaintKey.currentContext.findRenderObject(); final RenderBox renderBox = customPaintKey.currentContext.findRenderObject() as RenderBox;
final Offset localOffset = renderBox.globalToLocal(offset); final Offset localOffset = renderBox.globalToLocal(offset);
return painter.hitTestInteractive(localOffset); return painter.hitTestInteractive(localOffset);
} }
...@@ -541,7 +541,7 @@ class _RenderSegmentedControl<T> extends RenderBox ...@@ -541,7 +541,7 @@ class _RenderSegmentedControl<T> extends RenderBox
RenderBox child = firstChild; RenderBox child = firstChild;
double minWidth = 0.0; double minWidth = 0.0;
while (child != null) { while (child != null) {
final _SegmentedControlContainerBoxParentData childParentData = child.parentData; final _SegmentedControlContainerBoxParentData childParentData = child.parentData as _SegmentedControlContainerBoxParentData;
final double childWidth = child.getMinIntrinsicWidth(height); final double childWidth = child.getMinIntrinsicWidth(height);
minWidth = math.max(minWidth, childWidth); minWidth = math.max(minWidth, childWidth);
child = childParentData.nextSibling; child = childParentData.nextSibling;
...@@ -554,7 +554,7 @@ class _RenderSegmentedControl<T> extends RenderBox ...@@ -554,7 +554,7 @@ class _RenderSegmentedControl<T> extends RenderBox
RenderBox child = firstChild; RenderBox child = firstChild;
double maxWidth = 0.0; double maxWidth = 0.0;
while (child != null) { while (child != null) {
final _SegmentedControlContainerBoxParentData childParentData = child.parentData; final _SegmentedControlContainerBoxParentData childParentData = child.parentData as _SegmentedControlContainerBoxParentData;
final double childWidth = child.getMaxIntrinsicWidth(height); final double childWidth = child.getMaxIntrinsicWidth(height);
maxWidth = math.max(maxWidth, childWidth); maxWidth = math.max(maxWidth, childWidth);
child = childParentData.nextSibling; child = childParentData.nextSibling;
...@@ -567,7 +567,7 @@ class _RenderSegmentedControl<T> extends RenderBox ...@@ -567,7 +567,7 @@ class _RenderSegmentedControl<T> extends RenderBox
RenderBox child = firstChild; RenderBox child = firstChild;
double minHeight = 0.0; double minHeight = 0.0;
while (child != null) { while (child != null) {
final _SegmentedControlContainerBoxParentData childParentData = child.parentData; final _SegmentedControlContainerBoxParentData childParentData = child.parentData as _SegmentedControlContainerBoxParentData;
final double childHeight = child.getMinIntrinsicHeight(width); final double childHeight = child.getMinIntrinsicHeight(width);
minHeight = math.max(minHeight, childHeight); minHeight = math.max(minHeight, childHeight);
child = childParentData.nextSibling; child = childParentData.nextSibling;
...@@ -580,7 +580,7 @@ class _RenderSegmentedControl<T> extends RenderBox ...@@ -580,7 +580,7 @@ class _RenderSegmentedControl<T> extends RenderBox
RenderBox child = firstChild; RenderBox child = firstChild;
double maxHeight = 0.0; double maxHeight = 0.0;
while (child != null) { while (child != null) {
final _SegmentedControlContainerBoxParentData childParentData = child.parentData; final _SegmentedControlContainerBoxParentData childParentData = child.parentData as _SegmentedControlContainerBoxParentData;
final double childHeight = child.getMaxIntrinsicHeight(width); final double childHeight = child.getMaxIntrinsicHeight(width);
maxHeight = math.max(maxHeight, childHeight); maxHeight = math.max(maxHeight, childHeight);
child = childParentData.nextSibling; child = childParentData.nextSibling;
...@@ -604,7 +604,7 @@ class _RenderSegmentedControl<T> extends RenderBox ...@@ -604,7 +604,7 @@ class _RenderSegmentedControl<T> extends RenderBox
RenderBox child = leftChild; RenderBox child = leftChild;
double start = 0.0; double start = 0.0;
while (child != null) { while (child != null) {
final _SegmentedControlContainerBoxParentData childParentData = child.parentData; final _SegmentedControlContainerBoxParentData childParentData = child.parentData as _SegmentedControlContainerBoxParentData;
final Offset childOffset = Offset(start, 0.0); final Offset childOffset = Offset(start, 0.0);
childParentData.offset = childOffset; childParentData.offset = childOffset;
final Rect childRect = Rect.fromLTWH(start, 0.0, child.size.width, child.size.height); final Rect childRect = Rect.fromLTWH(start, 0.0, child.size.width, child.size.height);
...@@ -688,7 +688,7 @@ class _RenderSegmentedControl<T> extends RenderBox ...@@ -688,7 +688,7 @@ class _RenderSegmentedControl<T> extends RenderBox
void _paintChild(PaintingContext context, Offset offset, RenderBox child, int childIndex) { void _paintChild(PaintingContext context, Offset offset, RenderBox child, int childIndex) {
assert(child != null); assert(child != null);
final _SegmentedControlContainerBoxParentData childParentData = child.parentData; final _SegmentedControlContainerBoxParentData childParentData = child.parentData as _SegmentedControlContainerBoxParentData;
context.canvas.drawRRect( context.canvas.drawRRect(
childParentData.surroundingRect.shift(offset), childParentData.surroundingRect.shift(offset),
...@@ -712,7 +712,7 @@ class _RenderSegmentedControl<T> extends RenderBox ...@@ -712,7 +712,7 @@ class _RenderSegmentedControl<T> extends RenderBox
assert(position != null); assert(position != null);
RenderBox child = lastChild; RenderBox child = lastChild;
while (child != null) { while (child != null) {
final _SegmentedControlContainerBoxParentData childParentData = child.parentData; final _SegmentedControlContainerBoxParentData childParentData = child.parentData as _SegmentedControlContainerBoxParentData;
if (childParentData.surroundingRect.contains(position)) { if (childParentData.surroundingRect.contains(position)) {
final Offset center = (Offset.zero & child.size).center; final Offset center = (Offset.zero & child.size).center;
return result.addWithRawTransform( return result.addWithRawTransform(
......
...@@ -426,7 +426,7 @@ class _RenderCupertinoSlider extends RenderConstrainedBox { ...@@ -426,7 +426,7 @@ class _RenderCupertinoSlider extends RenderConstrainedBox {
double _currentDragValue = 0.0; double _currentDragValue = 0.0;
double get _discretizedCurrentDragValue { double get _discretizedCurrentDragValue {
double dragValue = _currentDragValue.clamp(0.0, 1.0); double dragValue = _currentDragValue.clamp(0.0, 1.0) as double;
if (divisions != null) if (divisions != null)
dragValue = (dragValue * divisions).round() / divisions; dragValue = (dragValue * divisions).round() / divisions;
return dragValue; return dragValue;
...@@ -558,11 +558,11 @@ class _RenderCupertinoSlider extends RenderConstrainedBox { ...@@ -558,11 +558,11 @@ class _RenderCupertinoSlider extends RenderConstrainedBox {
void _increaseAction() { void _increaseAction() {
if (isInteractive) if (isInteractive)
onChanged((value + _semanticActionUnit).clamp(0.0, 1.0)); onChanged((value + _semanticActionUnit).clamp(0.0, 1.0) as double);
} }
void _decreaseAction() { void _decreaseAction() {
if (isInteractive) if (isInteractive)
onChanged((value - _semanticActionUnit).clamp(0.0, 1.0)); onChanged((value - _semanticActionUnit).clamp(0.0, 1.0) as double);
} }
} }
...@@ -686,9 +686,9 @@ class _RenderSegmentedControl<T> extends RenderBox ...@@ -686,9 +686,9 @@ class _RenderSegmentedControl<T> extends RenderBox
return childCount == 0 return childCount == 0
? null ? null
// This assumes all children have the same width. // This assumes all children have the same width.
: (location.dx / (size.width / childCount)) : ((location.dx / (size.width / childCount))
.floor() .floor()
.clamp(0, childCount - 1); .clamp(0, childCount - 1) as int);
} }
void _onTapUp(TapUpDetails details) { void _onTapUp(TapUpDetails details) {
...@@ -761,7 +761,8 @@ class _RenderSegmentedControl<T> extends RenderBox ...@@ -761,7 +761,8 @@ class _RenderSegmentedControl<T> extends RenderBox
RenderBox child = firstChild; RenderBox child = firstChild;
double maxMinChildWidth = 0; double maxMinChildWidth = 0;
while (child != null) { while (child != null) {
final _SegmentedControlContainerBoxParentData childParentData = child.parentData; final _SegmentedControlContainerBoxParentData childParentData =
child.parentData as _SegmentedControlContainerBoxParentData;
final double childWidth = child.getMinIntrinsicWidth(height); final double childWidth = child.getMinIntrinsicWidth(height);
maxMinChildWidth = math.max(maxMinChildWidth, childWidth); maxMinChildWidth = math.max(maxMinChildWidth, childWidth);
child = childParentData.nextSibling; child = childParentData.nextSibling;
...@@ -774,7 +775,8 @@ class _RenderSegmentedControl<T> extends RenderBox ...@@ -774,7 +775,8 @@ class _RenderSegmentedControl<T> extends RenderBox
RenderBox child = firstChild; RenderBox child = firstChild;
double maxMaxChildWidth = 0; double maxMaxChildWidth = 0;
while (child != null) { while (child != null) {
final _SegmentedControlContainerBoxParentData childParentData = child.parentData; final _SegmentedControlContainerBoxParentData childParentData =
child.parentData as _SegmentedControlContainerBoxParentData;
final double childWidth = child.getMaxIntrinsicWidth(height); final double childWidth = child.getMaxIntrinsicWidth(height);
maxMaxChildWidth = math.max(maxMaxChildWidth, childWidth); maxMaxChildWidth = math.max(maxMaxChildWidth, childWidth);
child = childParentData.nextSibling; child = childParentData.nextSibling;
...@@ -787,7 +789,8 @@ class _RenderSegmentedControl<T> extends RenderBox ...@@ -787,7 +789,8 @@ class _RenderSegmentedControl<T> extends RenderBox
RenderBox child = firstChild; RenderBox child = firstChild;
double maxMinChildHeight = 0; double maxMinChildHeight = 0;
while (child != null) { while (child != null) {
final _SegmentedControlContainerBoxParentData childParentData = child.parentData; final _SegmentedControlContainerBoxParentData childParentData =
child.parentData as _SegmentedControlContainerBoxParentData;
final double childHeight = child.getMinIntrinsicHeight(width); final double childHeight = child.getMinIntrinsicHeight(width);
maxMinChildHeight = math.max(maxMinChildHeight, childHeight); maxMinChildHeight = math.max(maxMinChildHeight, childHeight);
child = childParentData.nextSibling; child = childParentData.nextSibling;
...@@ -800,7 +803,8 @@ class _RenderSegmentedControl<T> extends RenderBox ...@@ -800,7 +803,8 @@ class _RenderSegmentedControl<T> extends RenderBox
RenderBox child = firstChild; RenderBox child = firstChild;
double maxMaxChildHeight = 0; double maxMaxChildHeight = 0;
while (child != null) { while (child != null) {
final _SegmentedControlContainerBoxParentData childParentData = child.parentData; final _SegmentedControlContainerBoxParentData childParentData =
child.parentData as _SegmentedControlContainerBoxParentData;
final double childHeight = child.getMaxIntrinsicHeight(width); final double childHeight = child.getMaxIntrinsicHeight(width);
maxMaxChildHeight = math.max(maxMaxChildHeight, childHeight); maxMaxChildHeight = math.max(maxMaxChildHeight, childHeight);
child = childParentData.nextSibling; child = childParentData.nextSibling;
...@@ -859,7 +863,8 @@ class _RenderSegmentedControl<T> extends RenderBox ...@@ -859,7 +863,8 @@ class _RenderSegmentedControl<T> extends RenderBox
child = firstChild; child = firstChild;
while (child != null) { while (child != null) {
final _SegmentedControlContainerBoxParentData childParentData = child.parentData; final _SegmentedControlContainerBoxParentData childParentData =
child.parentData as _SegmentedControlContainerBoxParentData;
final Offset childOffset = Offset(start, 0); final Offset childOffset = Offset(start, 0);
childParentData.offset = childOffset; childParentData.offset = childOffset;
start += child.size.width + _kSeparatorWidth + _kSeparatorInset.horizontal; start += child.size.width + _kSeparatorWidth + _kSeparatorInset.horizontal;
...@@ -888,7 +893,8 @@ class _RenderSegmentedControl<T> extends RenderBox ...@@ -888,7 +893,8 @@ class _RenderSegmentedControl<T> extends RenderBox
final RenderBox selectedChild = children[highlightedIndex]; final RenderBox selectedChild = children[highlightedIndex];
final _SegmentedControlContainerBoxParentData childParentData = selectedChild.parentData; final _SegmentedControlContainerBoxParentData childParentData =
selectedChild.parentData as _SegmentedControlContainerBoxParentData;
final Rect unscaledThumbTargetRect = _kThumbInsets.inflateRect(childParentData.offset & selectedChild.size); final Rect unscaledThumbTargetRect = _kThumbInsets.inflateRect(childParentData.offset & selectedChild.size);
// Update related Tweens before animation update phase. // Update related Tweens before animation update phase.
...@@ -948,7 +954,8 @@ class _RenderSegmentedControl<T> extends RenderBox ...@@ -948,7 +954,8 @@ class _RenderSegmentedControl<T> extends RenderBox
// Paint the separator to the right of the given child. // Paint the separator to the right of the given child.
void _paintSeparator(PaintingContext context, Offset offset, RenderBox child) { void _paintSeparator(PaintingContext context, Offset offset, RenderBox child) {
assert(child != null); assert(child != null);
final _SegmentedControlContainerBoxParentData childParentData = child.parentData; final _SegmentedControlContainerBoxParentData childParentData =
child.parentData as _SegmentedControlContainerBoxParentData;
final Paint paint = Paint(); final Paint paint = Paint();
...@@ -970,7 +977,8 @@ class _RenderSegmentedControl<T> extends RenderBox ...@@ -970,7 +977,8 @@ class _RenderSegmentedControl<T> extends RenderBox
void _paintChild(PaintingContext context, Offset offset, RenderBox child, int childIndex) { void _paintChild(PaintingContext context, Offset offset, RenderBox child, int childIndex) {
assert(child != null); assert(child != null);
final _SegmentedControlContainerBoxParentData childParentData = child.parentData; final _SegmentedControlContainerBoxParentData childParentData =
child.parentData as _SegmentedControlContainerBoxParentData;
context.paintChild(child, childParentData.offset + offset); context.paintChild(child, childParentData.offset + offset);
} }
...@@ -1011,7 +1019,8 @@ class _RenderSegmentedControl<T> extends RenderBox ...@@ -1011,7 +1019,8 @@ class _RenderSegmentedControl<T> extends RenderBox
assert(position != null); assert(position != null);
RenderBox child = lastChild; RenderBox child = lastChild;
while (child != null) { while (child != null) {
final _SegmentedControlContainerBoxParentData childParentData = child.parentData; final _SegmentedControlContainerBoxParentData childParentData =
child.parentData as _SegmentedControlContainerBoxParentData;
if ((childParentData.offset & child.size).contains(position)) { if ((childParentData.offset & child.size).contains(position)) {
final Offset center = (Offset.zero & child.size).center; final Offset center = (Offset.zero & child.size).center;
return result.addWithRawTransform( return result.addWithRawTransform(
......
...@@ -98,7 +98,7 @@ class _CupertinoTextFieldSelectionGestureDetectorBuilder extends TextSelectionGe ...@@ -98,7 +98,7 @@ class _CupertinoTextFieldSelectionGestureDetectorBuilder extends TextSelectionGe
// this handler. If the clear button widget recognizes the up event, // this handler. If the clear button widget recognizes the up event,
// then do not handle it. // then do not handle it.
if (_state._clearGlobalKey.currentContext != null) { if (_state._clearGlobalKey.currentContext != null) {
final RenderBox renderBox = _state._clearGlobalKey.currentContext.findRenderObject(); final RenderBox renderBox = _state._clearGlobalKey.currentContext.findRenderObject() as RenderBox;
final Offset localOffset = renderBox.globalToLocal(details.globalPosition); final Offset localOffset = renderBox.globalToLocal(details.globalPosition);
if (renderBox.hitTest(BoxHitTestResult(), position: localOffset)) { if (renderBox.hitTest(BoxHitTestResult(), position: localOffset)) {
return; return;
...@@ -854,7 +854,7 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with AutomaticK ...@@ -854,7 +854,7 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with AutomaticK
final Color decorationColor = CupertinoDynamicColor.resolve(widget.decoration?.color, context); final Color decorationColor = CupertinoDynamicColor.resolve(widget.decoration?.color, context);
final BoxBorder border = widget.decoration?.border; final BoxBorder border = widget.decoration?.border;
Border resolvedBorder = border; Border resolvedBorder = border as Border;
if (border is Border) { if (border is Border) {
BorderSide resolveBorderSide(BorderSide side) { BorderSide resolveBorderSide(BorderSide side) {
return side == BorderSide.none return side == BorderSide.none
......
...@@ -169,12 +169,12 @@ class _ToolbarRenderBox extends RenderShiftedBox { ...@@ -169,12 +169,12 @@ class _ToolbarRenderBox extends RenderShiftedBox {
.loosen(); .loosen();
child.layout(heightConstraint.enforce(enforcedConstraint), parentUsesSize: true,); child.layout(heightConstraint.enforce(enforcedConstraint), parentUsesSize: true,);
final _ToolbarParentData childParentData = child.parentData; final _ToolbarParentData childParentData = child.parentData as _ToolbarParentData;
// The local x-coordinate of the center of the toolbar. // The local x-coordinate of the center of the toolbar.
final double lowerBound = child.size.width/2 + _kToolbarScreenPadding; final double lowerBound = child.size.width/2 + _kToolbarScreenPadding;
final double upperBound = size.width - child.size.width/2 - _kToolbarScreenPadding; final double upperBound = size.width - child.size.width/2 - _kToolbarScreenPadding;
final double adjustedCenterX = _arrowTipX.clamp(lowerBound, upperBound); final double adjustedCenterX = _arrowTipX.clamp(lowerBound, upperBound) as double;
childParentData.offset = Offset(adjustedCenterX - child.size.width / 2, _barTopY); childParentData.offset = Offset(adjustedCenterX - child.size.width / 2, _barTopY);
childParentData.arrowXOffsetFromCenter = _arrowTipX - adjustedCenterX; childParentData.arrowXOffsetFromCenter = _arrowTipX - adjustedCenterX;
...@@ -182,7 +182,7 @@ class _ToolbarRenderBox extends RenderShiftedBox { ...@@ -182,7 +182,7 @@ class _ToolbarRenderBox extends RenderShiftedBox {
// The path is described in the toolbar's coordinate system. // The path is described in the toolbar's coordinate system.
Path _clipPath() { Path _clipPath() {
final _ToolbarParentData childParentData = child.parentData; final _ToolbarParentData childParentData = child.parentData as _ToolbarParentData;
final Path rrect = Path() final Path rrect = Path()
..addRRect( ..addRRect(
RRect.fromRectAndRadius( RRect.fromRectAndRadius(
...@@ -215,7 +215,7 @@ class _ToolbarRenderBox extends RenderShiftedBox { ...@@ -215,7 +215,7 @@ class _ToolbarRenderBox extends RenderShiftedBox {
return; return;
} }
final _ToolbarParentData childParentData = child.parentData; final _ToolbarParentData childParentData = child.parentData as _ToolbarParentData;
context.pushClipPath( context.pushClipPath(
needsCompositing, needsCompositing,
offset + childParentData.offset, offset + childParentData.offset,
...@@ -245,7 +245,7 @@ class _ToolbarRenderBox extends RenderShiftedBox { ...@@ -245,7 +245,7 @@ class _ToolbarRenderBox extends RenderShiftedBox {
..strokeWidth = 2.0 ..strokeWidth = 2.0
..style = PaintingStyle.stroke; ..style = PaintingStyle.stroke;
final _ToolbarParentData childParentData = child.parentData; final _ToolbarParentData childParentData = child.parentData as _ToolbarParentData;
context.canvas.drawPath(_clipPath().shift(offset + childParentData.offset), _debugPaint); context.canvas.drawPath(_clipPath().shift(offset + childParentData.offset), _debugPaint);
return true; return true;
}()); }());
...@@ -322,7 +322,7 @@ class _CupertinoTextSelectionControls extends TextSelectionControls { ...@@ -322,7 +322,7 @@ class _CupertinoTextSelectionControls extends TextSelectionControls {
final double arrowTipX = (position.dx + globalEditableRegion.left).clamp( final double arrowTipX = (position.dx + globalEditableRegion.left).clamp(
_kArrowScreenPadding + mediaQuery.padding.left, _kArrowScreenPadding + mediaQuery.padding.left,
mediaQuery.size.width - mediaQuery.padding.right - _kArrowScreenPadding, mediaQuery.size.width - mediaQuery.padding.right - _kArrowScreenPadding,
); ) as double;
// The y-coordinate has to be calculated instead of directly quoting postion.dy, // The y-coordinate has to be calculated instead of directly quoting postion.dy,
// since the caller (TextSelectionOverlay._buildToolbar) does not know whether // since the caller (TextSelectionOverlay._buildToolbar) does not know whether
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment