Unverified Commit d81d9160 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

implicit-casts:false in flutter/lib/src/material (#45567)

* implicit-casts:false in flutter/lib/src/material

* address review comments
parent 0497235c
...@@ -104,7 +104,7 @@ class AnimatedIcon extends StatelessWidget { ...@@ -104,7 +104,7 @@ class AnimatedIcon extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final _AnimatedIconData iconData = icon; final _AnimatedIconData iconData = icon as _AnimatedIconData;
final IconThemeData iconTheme = IconTheme.of(context); final IconThemeData iconTheme = IconTheme.of(context);
final double iconSize = size ?? iconTheme.size; final double iconSize = size ?? iconTheme.size;
final TextDirection textDirection = this.textDirection ?? Directionality.of(context); final TextDirection textDirection = this.textDirection ?? Directionality.of(context);
...@@ -161,7 +161,7 @@ class _AnimatedIconPainter extends CustomPainter { ...@@ -161,7 +161,7 @@ class _AnimatedIconPainter extends CustomPainter {
canvas.translate(-size.width, -size.height); canvas.translate(-size.width, -size.height);
} }
final double clampedProgress = progress.value.clamp(0.0, 1.0); final double clampedProgress = progress.value.clamp(0.0, 1.0) as double;
for (_PathFrames path in paths) for (_PathFrames path in paths)
path.paint(canvas, color, uiPathFactory, clampedProgress); path.paint(canvas, color, uiPathFactory, clampedProgress);
} }
......
...@@ -750,7 +750,7 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate { ...@@ -750,7 +750,7 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
// 1 | 1 | 0 || 1.0 // 1 | 1 | 0 || 1.0
// 1 | 1 | 1 || fade // 1 | 1 | 1 || fade
final double toolbarOpacity = !pinned || (floating && bottom != null) final double toolbarOpacity = !pinned || (floating && bottom != null)
? ((visibleMainHeight - _bottomHeight) / kToolbarHeight).clamp(0.0, 1.0) ? ((visibleMainHeight - _bottomHeight) / kToolbarHeight).clamp(0.0, 1.0) as double
: 1.0; : 1.0;
final Widget appBar = FlexibleSpaceBar.createSettings( final Widget appBar = FlexibleSpaceBar.createSettings(
...@@ -778,7 +778,7 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate { ...@@ -778,7 +778,7 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
titleSpacing: titleSpacing, titleSpacing: titleSpacing,
shape: shape, shape: shape,
toolbarOpacity: toolbarOpacity, toolbarOpacity: toolbarOpacity,
bottomOpacity: pinned ? 1.0 : (visibleMainHeight / _bottomHeight).clamp(0.0, 1.0), bottomOpacity: pinned ? 1.0 : ((visibleMainHeight / _bottomHeight).clamp(0.0, 1.0) as double),
), ),
); );
return floating ? _FloatingAppBar(child: appBar) : appBar; return floating ? _FloatingAppBar(child: appBar) : appBar;
......
...@@ -128,13 +128,13 @@ class AppBarTheme extends Diagnosticable { ...@@ -128,13 +128,13 @@ class AppBarTheme extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final AppBarTheme typedOther = other; return other is AppBarTheme
return typedOther.brightness == brightness && other.brightness == brightness
&& typedOther.color == color && other.color == color
&& typedOther.elevation == elevation && other.elevation == elevation
&& typedOther.iconTheme == iconTheme && other.iconTheme == iconTheme
&& typedOther.actionsIconTheme == actionsIconTheme && other.actionsIconTheme == actionsIconTheme
&& typedOther.textTheme == textTheme; && other.textTheme == textTheme;
} }
@override @override
......
...@@ -193,14 +193,14 @@ const List<_Diagonal> _allDiagonals = <_Diagonal>[ ...@@ -193,14 +193,14 @@ const List<_Diagonal> _allDiagonals = <_Diagonal>[
_Diagonal(_CornerId.bottomLeft, _CornerId.topRight), _Diagonal(_CornerId.bottomLeft, _CornerId.topRight),
]; ];
typedef _KeyFunc<T> = dynamic Function(T input); typedef _KeyFunc<T> = double Function(T input);
// Select the element for which the key function returns the maximum value. // Select the element for which the key function returns the maximum value.
T _maxBy<T>(Iterable<T> input, _KeyFunc<T> keyFunc) { T _maxBy<T>(Iterable<T> input, _KeyFunc<T> keyFunc) {
T maxValue; T maxValue;
dynamic maxKey; double maxKey;
for (T value in input) { for (T value in input) {
final dynamic key = keyFunc(value); final double key = keyFunc(value);
if (maxKey == null || key > maxKey) { if (maxKey == null || key > maxKey) {
maxValue = value; maxValue = value;
maxKey = key; maxKey = key;
......
...@@ -73,8 +73,8 @@ class MaterialBannerThemeData extends Diagnosticable { ...@@ -73,8 +73,8 @@ class MaterialBannerThemeData extends Diagnosticable {
return MaterialBannerThemeData( return MaterialBannerThemeData(
backgroundColor: Color.lerp(a?.backgroundColor, b?.backgroundColor, t), backgroundColor: Color.lerp(a?.backgroundColor, b?.backgroundColor, t),
contentTextStyle: TextStyle.lerp(a?.contentTextStyle, b?.contentTextStyle, t), contentTextStyle: TextStyle.lerp(a?.contentTextStyle, b?.contentTextStyle, t),
padding: EdgeInsets.lerp(a?.padding, b?.padding, t), padding: EdgeInsetsGeometry.lerp(a?.padding, b?.padding, t),
leadingPadding: EdgeInsets.lerp(a?.leadingPadding, b?.leadingPadding, t), leadingPadding: EdgeInsetsGeometry.lerp(a?.leadingPadding, b?.leadingPadding, t),
); );
} }
...@@ -94,11 +94,11 @@ class MaterialBannerThemeData extends Diagnosticable { ...@@ -94,11 +94,11 @@ class MaterialBannerThemeData extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final MaterialBannerThemeData typedOther = other; return other is MaterialBannerThemeData
return typedOther.backgroundColor == backgroundColor && other.backgroundColor == backgroundColor
&& typedOther.contentTextStyle == contentTextStyle && other.contentTextStyle == contentTextStyle
&& typedOther.padding == padding && other.padding == padding
&& typedOther.leadingPadding == leadingPadding; && other.leadingPadding == leadingPadding;
} }
@override @override
......
...@@ -92,10 +92,10 @@ class BottomAppBarTheme extends Diagnosticable { ...@@ -92,10 +92,10 @@ class BottomAppBarTheme extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final BottomAppBarTheme typedOther = other; return other is BottomAppBarTheme
return typedOther.color == color && other.color == color
&& typedOther.elevation == elevation && other.elevation == elevation
&& typedOther.shape == shape; && other.shape == shape;
} }
@override @override
......
...@@ -152,7 +152,7 @@ class _BottomSheetState extends State<BottomSheet> { ...@@ -152,7 +152,7 @@ class _BottomSheetState extends State<BottomSheet> {
final GlobalKey _childKey = GlobalKey(debugLabel: 'BottomSheet child'); final GlobalKey _childKey = GlobalKey(debugLabel: 'BottomSheet child');
double get _childHeight { double get _childHeight {
final RenderBox renderBox = _childKey.currentContext.findRenderObject(); final RenderBox renderBox = _childKey.currentContext.findRenderObject() as RenderBox;
return renderBox.size.height; return renderBox.size.height;
} }
......
...@@ -123,13 +123,13 @@ class BottomSheetThemeData extends Diagnosticable { ...@@ -123,13 +123,13 @@ class BottomSheetThemeData extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final BottomSheetThemeData typedOther = other; return other is BottomSheetThemeData
return typedOther.backgroundColor == backgroundColor && other.backgroundColor == backgroundColor
&& typedOther.elevation == elevation && other.elevation == elevation
&& typedOther.modalBackgroundColor == modalBackgroundColor && other.modalBackgroundColor == modalBackgroundColor
&& typedOther.modalElevation == modalElevation && other.modalElevation == modalElevation
&& typedOther.shape == shape && other.shape == shape
&& typedOther.clipBehavior == clipBehavior; && other.clipBehavior == clipBehavior;
} }
@override @override
......
...@@ -367,8 +367,8 @@ class _RawMaterialButtonState extends State<RawMaterialButton> { ...@@ -367,8 +367,8 @@ class _RawMaterialButtonState extends State<RawMaterialButton> {
final ShapeBorder effectiveShape = MaterialStateProperty.resolveAs<ShapeBorder>(widget.shape, _states); final ShapeBorder effectiveShape = MaterialStateProperty.resolveAs<ShapeBorder>(widget.shape, _states);
final Offset densityAdjustment = widget.visualDensity.baseSizeAdjustment; final Offset densityAdjustment = widget.visualDensity.baseSizeAdjustment;
final BoxConstraints effectiveConstraints = widget.constraints.copyWith( final BoxConstraints effectiveConstraints = widget.constraints.copyWith(
minWidth: widget.constraints.minWidth != null ? (widget.constraints.minWidth + densityAdjustment.dx).clamp(0.0, double.infinity) : null, minWidth: widget.constraints.minWidth != null ? (widget.constraints.minWidth + densityAdjustment.dx).clamp(0.0, double.infinity) as double : null,
minHeight: widget.constraints.minWidth != null ? (widget.constraints.minHeight + densityAdjustment.dy).clamp(0.0, double.infinity) : null, minHeight: widget.constraints.minWidth != null ? (widget.constraints.minHeight + densityAdjustment.dy).clamp(0.0, double.infinity) as double : null,
); );
final EdgeInsetsGeometry padding = widget.padding.add( final EdgeInsetsGeometry padding = widget.padding.add(
EdgeInsets.only( EdgeInsets.only(
...@@ -517,8 +517,8 @@ class _RenderInputPadding extends RenderShiftedBox { ...@@ -517,8 +517,8 @@ class _RenderInputPadding extends RenderShiftedBox {
final double height = math.max(child.size.width, minSize.width); final double height = math.max(child.size.width, minSize.width);
final double width = math.max(child.size.height, minSize.height); final double width = math.max(child.size.height, minSize.height);
size = constraints.constrain(Size(height, width)); size = constraints.constrain(Size(height, width));
final BoxParentData childParentData = child.parentData; final BoxParentData childParentData = child.parentData as BoxParentData;
childParentData.offset = Alignment.center.alongOffset(size - child.size); childParentData.offset = Alignment.center.alongOffset(size - child.size as Offset);
} else { } else {
size = Size.zero; size = Size.zero;
} }
......
...@@ -316,7 +316,7 @@ class _RenderButtonBarRow extends RenderFlex { ...@@ -316,7 +316,7 @@ class _RenderButtonBarRow extends RenderFlex {
double currentHeight = 0.0; double currentHeight = 0.0;
while (child != null) { while (child != null) {
final FlexParentData childParentData = child.parentData; final FlexParentData childParentData = child.parentData as FlexParentData;
// Lay out the child with the button bar's original constraints, but // Lay out the child with the button bar's original constraints, but
// with minimum width set to zero. // with minimum width set to zero.
......
...@@ -136,7 +136,7 @@ class ButtonBarThemeData extends Diagnosticable { ...@@ -136,7 +136,7 @@ class ButtonBarThemeData extends Diagnosticable {
buttonTextTheme: t < 0.5 ? a.buttonTextTheme : b.buttonTextTheme, buttonTextTheme: t < 0.5 ? a.buttonTextTheme : b.buttonTextTheme,
buttonMinWidth: lerpDouble(a?.buttonMinWidth, b?.buttonMinWidth, t), buttonMinWidth: lerpDouble(a?.buttonMinWidth, b?.buttonMinWidth, t),
buttonHeight: lerpDouble(a?.buttonHeight, b?.buttonHeight, t), buttonHeight: lerpDouble(a?.buttonHeight, b?.buttonHeight, t),
buttonPadding: EdgeInsets.lerp(a?.buttonPadding, b?.buttonPadding, t), buttonPadding: EdgeInsetsGeometry.lerp(a?.buttonPadding, b?.buttonPadding, t),
buttonAlignedDropdown: t < 0.5 ? a.buttonAlignedDropdown : b.buttonAlignedDropdown, buttonAlignedDropdown: t < 0.5 ? a.buttonAlignedDropdown : b.buttonAlignedDropdown,
layoutBehavior: t < 0.5 ? a.layoutBehavior : b.layoutBehavior, layoutBehavior: t < 0.5 ? a.layoutBehavior : b.layoutBehavior,
); );
...@@ -162,15 +162,15 @@ class ButtonBarThemeData extends Diagnosticable { ...@@ -162,15 +162,15 @@ class ButtonBarThemeData extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final ButtonBarThemeData typedOther = other; return other is ButtonBarThemeData
return typedOther.alignment == alignment && other.alignment == alignment
&& typedOther.mainAxisSize == mainAxisSize && other.mainAxisSize == mainAxisSize
&& typedOther.buttonTextTheme == buttonTextTheme && other.buttonTextTheme == buttonTextTheme
&& typedOther.buttonMinWidth == buttonMinWidth && other.buttonMinWidth == buttonMinWidth
&& typedOther.buttonHeight == buttonHeight && other.buttonHeight == buttonHeight
&& typedOther.buttonPadding == buttonPadding && other.buttonPadding == buttonPadding
&& typedOther.buttonAlignedDropdown == buttonAlignedDropdown && other.buttonAlignedDropdown == buttonAlignedDropdown
&& typedOther.layoutBehavior == layoutBehavior; && other.layoutBehavior == layoutBehavior;
} }
@override @override
......
...@@ -907,21 +907,21 @@ class ButtonThemeData extends Diagnosticable { ...@@ -907,21 +907,21 @@ class ButtonThemeData extends Diagnosticable {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final ButtonThemeData typedOther = other; return other is ButtonThemeData
return textTheme == typedOther.textTheme && other.textTheme == textTheme
&& minWidth == typedOther.minWidth && other.minWidth == minWidth
&& height == typedOther.height && other.height == height
&& padding == typedOther.padding && other.padding == padding
&& shape == typedOther.shape && other.shape == shape
&& alignedDropdown == typedOther.alignedDropdown && other.alignedDropdown == alignedDropdown
&& _buttonColor == typedOther._buttonColor && other._buttonColor == _buttonColor
&& _disabledColor == typedOther._disabledColor && other._disabledColor == _disabledColor
&& _focusColor == typedOther._focusColor && other._focusColor == _focusColor
&& _hoverColor == typedOther._hoverColor && other._hoverColor == _hoverColor
&& _highlightColor == typedOther._highlightColor && other._highlightColor == _highlightColor
&& _splashColor == typedOther._splashColor && other._splashColor == _splashColor
&& colorScheme == typedOther.colorScheme && other.colorScheme == colorScheme
&& _materialTapTargetSize == typedOther._materialTapTargetSize; && other._materialTapTargetSize == _materialTapTargetSize;
} }
@override @override
......
...@@ -122,12 +122,12 @@ class CardTheme extends Diagnosticable { ...@@ -122,12 +122,12 @@ class CardTheme extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final CardTheme typedOther = other; return other is CardTheme
return typedOther.clipBehavior == clipBehavior && other.clipBehavior == clipBehavior
&& typedOther.color == color && other.color == color
&& typedOther.elevation == elevation && other.elevation == elevation
&& typedOther.margin == margin && other.margin == margin
&& typedOther.shape == shape; && other.shape == shape;
} }
@override @override
......
...@@ -458,7 +458,7 @@ class _RenderCheckbox extends RenderToggleable { ...@@ -458,7 +458,7 @@ class _RenderCheckbox extends RenderToggleable {
paintRadialReaction(canvas, offset, size.center(Offset.zero)); paintRadialReaction(canvas, offset, size.center(Offset.zero));
final Paint strokePaint = _createStrokePaint(); final Paint strokePaint = _createStrokePaint();
final Offset origin = offset + (size / 2.0 - const Size.square(_kEdgeSize) / 2.0); final Offset origin = offset + (size / 2.0 - const Size.square(_kEdgeSize) / 2.0 as Offset);
final AnimationStatus status = position.status; final AnimationStatus status = position.status;
final double tNormalized = status == AnimationStatus.forward || status == AnimationStatus.completed final double tNormalized = status == AnimationStatus.forward || status == AnimationStatus.completed
? position.value ? position.value
......
...@@ -1532,7 +1532,7 @@ class RawChip extends StatefulWidget ...@@ -1532,7 +1532,7 @@ class RawChip extends StatefulWidget
@override @override
final Color checkmarkColor; final Color checkmarkColor;
@override @override
final CircleBorder avatarBorder; final ShapeBorder avatarBorder;
/// If set, this indicates that the chip should be disabled if all of the /// If set, this indicates that the chip should be disabled if all of the
/// tap callbacks ([onSelected], [onPressed]) are null. /// tap callbacks ([onSelected], [onPressed]) are null.
...@@ -2045,10 +2045,10 @@ class _RenderChipElement extends RenderObjectElement { ...@@ -2045,10 +2045,10 @@ class _RenderChipElement extends RenderObjectElement {
final Map<Element, _ChipSlot> childToSlot = <Element, _ChipSlot>{}; final Map<Element, _ChipSlot> childToSlot = <Element, _ChipSlot>{};
@override @override
_ChipRenderWidget get widget => super.widget; _ChipRenderWidget get widget => super.widget as _ChipRenderWidget;
@override @override
_RenderChip get renderObject => super.renderObject; _RenderChip get renderObject => super.renderObject as _RenderChip;
@override @override
void visitChildren(ElementVisitor visitor) { void visitChildren(ElementVisitor visitor) {
...@@ -2110,13 +2110,13 @@ class _RenderChipElement extends RenderObjectElement { ...@@ -2110,13 +2110,13 @@ class _RenderChipElement extends RenderObjectElement {
void _updateRenderObject(RenderObject child, _ChipSlot slot) { void _updateRenderObject(RenderObject child, _ChipSlot slot) {
switch (slot) { switch (slot) {
case _ChipSlot.avatar: case _ChipSlot.avatar:
renderObject.avatar = child; renderObject.avatar = child as RenderBox;
break; break;
case _ChipSlot.label: case _ChipSlot.label:
renderObject.label = child; renderObject.label = child as RenderBox;
break; break;
case _ChipSlot.deleteIcon: case _ChipSlot.deleteIcon:
renderObject.deleteIcon = child; renderObject.deleteIcon = child as RenderBox;
break; break;
} }
} }
...@@ -2125,7 +2125,7 @@ class _RenderChipElement extends RenderObjectElement { ...@@ -2125,7 +2125,7 @@ class _RenderChipElement extends RenderObjectElement {
void insertChildRenderObject(RenderObject child, dynamic slotValue) { void insertChildRenderObject(RenderObject child, dynamic slotValue) {
assert(child is RenderBox); assert(child is RenderBox);
assert(slotValue is _ChipSlot); assert(slotValue is _ChipSlot);
final _ChipSlot slot = slotValue; final _ChipSlot slot = slotValue as _ChipSlot;
_updateRenderObject(child, slot); _updateRenderObject(child, slot);
assert(renderObject.childToSlot.keys.contains(child)); assert(renderObject.childToSlot.keys.contains(child));
assert(renderObject.slotToChild.keys.contains(slot)); assert(renderObject.slotToChild.keys.contains(slot));
...@@ -2181,17 +2181,17 @@ class _ChipRenderTheme { ...@@ -2181,17 +2181,17 @@ class _ChipRenderTheme {
if (other.runtimeType != runtimeType) { if (other.runtimeType != runtimeType) {
return false; return false;
} }
final _ChipRenderTheme typedOther = other; return other is _ChipRenderTheme
return typedOther.avatar == avatar && other.avatar == avatar
&& typedOther.label == label && other.label == label
&& typedOther.deleteIcon == deleteIcon && other.deleteIcon == deleteIcon
&& typedOther.brightness == brightness && other.brightness == brightness
&& typedOther.padding == padding && other.padding == padding
&& typedOther.labelPadding == labelPadding && other.labelPadding == labelPadding
&& typedOther.showAvatar == showAvatar && other.showAvatar == showAvatar
&& typedOther.showCheckmark == showCheckmark && other.showCheckmark == showCheckmark
&& typedOther.checkmarkColor == checkmarkColor && other.checkmarkColor == checkmarkColor
&& typedOther.canTapBody == canTapBody; && other.canTapBody == canTapBody;
} }
@override @override
...@@ -2373,7 +2373,7 @@ class _RenderChip extends RenderBox { ...@@ -2373,7 +2373,7 @@ class _RenderChip extends RenderBox {
static Rect _boxRect(RenderBox box) => box == null ? Rect.zero : _boxParentData(box).offset & box.size; static Rect _boxRect(RenderBox box) => box == null ? Rect.zero : _boxParentData(box).offset & box.size;
static BoxParentData _boxParentData(RenderBox box) => box.parentData; static BoxParentData _boxParentData(RenderBox box) => box.parentData as BoxParentData;
@override @override
double computeMinIntrinsicWidth(double height) { double computeMinIntrinsicWidth(double height) {
...@@ -2895,7 +2895,7 @@ class _LocationAwareInkRippleFactory extends InteractiveInkFeatureFactory { ...@@ -2895,7 +2895,7 @@ class _LocationAwareInkRippleFactory extends InteractiveInkFeatureFactory {
if (tapIsOnDeleteIcon) { if (tapIsOnDeleteIcon) {
final RenderBox currentBox = referenceBox; final RenderBox currentBox = referenceBox;
referenceBox = deleteIconKey.currentContext.findRenderObject(); referenceBox = deleteIconKey.currentContext.findRenderObject() as RenderBox;
position = referenceBox.globalToLocal(currentBox.localToGlobal(position)); position = referenceBox.globalToLocal(currentBox.localToGlobal(position));
containedInkWell = false; containedInkWell = false;
} }
......
...@@ -484,23 +484,23 @@ class ChipThemeData extends Diagnosticable { ...@@ -484,23 +484,23 @@ class ChipThemeData extends Diagnosticable {
if (other.runtimeType != runtimeType) { if (other.runtimeType != runtimeType) {
return false; return false;
} }
final ChipThemeData otherData = other; return other is ChipThemeData
return otherData.backgroundColor == backgroundColor && other.backgroundColor == backgroundColor
&& otherData.deleteIconColor == deleteIconColor && other.deleteIconColor == deleteIconColor
&& otherData.disabledColor == disabledColor && other.disabledColor == disabledColor
&& otherData.selectedColor == selectedColor && other.selectedColor == selectedColor
&& otherData.secondarySelectedColor == secondarySelectedColor && other.secondarySelectedColor == secondarySelectedColor
&& otherData.shadowColor == shadowColor && other.shadowColor == shadowColor
&& otherData.selectedShadowColor == selectedShadowColor && other.selectedShadowColor == selectedShadowColor
&& otherData.checkmarkColor == checkmarkColor && other.checkmarkColor == checkmarkColor
&& otherData.labelPadding == labelPadding && other.labelPadding == labelPadding
&& otherData.padding == padding && other.padding == padding
&& otherData.shape == shape && other.shape == shape
&& otherData.labelStyle == labelStyle && other.labelStyle == labelStyle
&& otherData.secondaryLabelStyle == secondaryLabelStyle && other.secondaryLabelStyle == secondaryLabelStyle
&& otherData.brightness == brightness && other.brightness == brightness
&& otherData.elevation == elevation && other.elevation == elevation
&& otherData.pressElevation == pressElevation; && other.pressElevation == pressElevation;
} }
@override @override
......
...@@ -268,20 +268,20 @@ class ColorScheme extends Diagnosticable { ...@@ -268,20 +268,20 @@ class ColorScheme extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final ColorScheme otherScheme = other; return other is ColorScheme
return otherScheme.primary == primary && other.primary == primary
&& otherScheme.primaryVariant == primaryVariant && other.primaryVariant == primaryVariant
&& otherScheme.secondary == secondary && other.secondary == secondary
&& otherScheme.secondaryVariant == secondaryVariant && other.secondaryVariant == secondaryVariant
&& otherScheme.surface == surface && other.surface == surface
&& otherScheme.background == background && other.background == background
&& otherScheme.error == error && other.error == error
&& otherScheme.onPrimary == onPrimary && other.onPrimary == onPrimary
&& otherScheme.onSecondary == onSecondary && other.onSecondary == onSecondary
&& otherScheme.onSurface == onSurface && other.onSurface == onSurface
&& otherScheme.onBackground == onBackground && other.onBackground == onBackground
&& otherScheme.onError == onError && other.onError == onError
&& otherScheme.brightness == brightness; && other.brightness == brightness;
} }
@override @override
......
...@@ -750,14 +750,14 @@ class TableRowInkWell extends InkResponse { ...@@ -750,14 +750,14 @@ class TableRowInkWell extends InkResponse {
AbstractNode table = cell.parent; AbstractNode table = cell.parent;
final Matrix4 transform = Matrix4.identity(); final Matrix4 transform = Matrix4.identity();
while (table is RenderObject && table is! RenderTable) { while (table is RenderObject && table is! RenderTable) {
final RenderTable parentBox = table; final RenderObject parentBox = table as RenderObject;
parentBox.applyPaintTransform(cell, transform); parentBox.applyPaintTransform(cell, transform);
assert(table == cell.parent); assert(table == cell.parent);
cell = table; cell = parentBox;
table = table.parent; table = table.parent;
} }
if (table is RenderTable) { if (table is RenderTable) {
final TableCellParentData cellParentData = cell.parentData; final TableCellParentData cellParentData = cell.parentData as TableCellParentData;
assert(cellParentData.y != null); assert(cellParentData.y != null);
final Rect rect = table.getRowBox(cellParentData.y); final Rect rect = table.getRowBox(cellParentData.y);
// The rect is in the table's coordinate space. We need to change it to the // The rect is in the table's coordinate space. We need to change it to the
......
...@@ -109,12 +109,12 @@ class DialogTheme extends Diagnosticable { ...@@ -109,12 +109,12 @@ class DialogTheme extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final DialogTheme typedOther = other; return other is DialogTheme
return typedOther.backgroundColor == backgroundColor && other.backgroundColor == backgroundColor
&& typedOther.elevation == elevation && other.elevation == elevation
&& typedOther.shape == shape && other.shape == shape
&& typedOther.titleTextStyle == titleTextStyle && other.titleTextStyle == titleTextStyle
&& typedOther.contentTextStyle == contentTextStyle; && other.contentTextStyle == contentTextStyle;
} }
@override @override
......
...@@ -110,12 +110,12 @@ class DividerThemeData extends Diagnosticable { ...@@ -110,12 +110,12 @@ class DividerThemeData extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final DividerThemeData typedOther = other; return other is DividerThemeData
return typedOther.color == color && other.color == color
&& typedOther.space == space && other.space == space
&& typedOther.thickness == thickness && other.thickness == thickness
&& typedOther.indent == indent && other.indent == indent
&& typedOther.endIndent == endIndent; && other.endIndent == endIndent;
} }
@override @override
......
...@@ -381,7 +381,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro ...@@ -381,7 +381,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
final GlobalKey _drawerKey = GlobalKey(); final GlobalKey _drawerKey = GlobalKey();
double get _width { double get _width {
final RenderBox box = _drawerKey.currentContext?.findRenderObject(); final RenderBox box = _drawerKey.currentContext?.findRenderObject() as RenderBox;
if (box != null) if (box != null)
return box.size.width; return box.size.width;
return _kWidth; // drawer not being shown currently return _kWidth; // drawer not being shown currently
......
...@@ -62,12 +62,12 @@ class _DropdownMenuPainter extends CustomPainter { ...@@ -62,12 +62,12 @@ class _DropdownMenuPainter extends CustomPainter {
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
final double selectedItemOffset = getSelectedItemOffset(); final double selectedItemOffset = getSelectedItemOffset();
final Tween<double> top = Tween<double>( final Tween<double> top = Tween<double>(
begin: selectedItemOffset.clamp(0.0, size.height - _kMenuItemHeight), begin: selectedItemOffset.clamp(0.0, size.height - _kMenuItemHeight) as double,
end: 0.0, end: 0.0,
); );
final Tween<double> bottom = Tween<double>( final Tween<double> bottom = Tween<double>(
begin: (top.begin + _kMenuItemHeight).clamp(_kMenuItemHeight, size.height), begin: (top.begin + _kMenuItemHeight).clamp(_kMenuItemHeight, size.height) as double,
end: size.height, end: size.height,
); );
...@@ -162,8 +162,8 @@ class _DropdownMenuItemButtonState<T> extends State<_DropdownMenuItemButton<T>> ...@@ -162,8 +162,8 @@ class _DropdownMenuItemButtonState<T> extends State<_DropdownMenuItemButton<T>>
if (widget.itemIndex == widget.route.selectedIndex) { if (widget.itemIndex == widget.route.selectedIndex) {
opacity = CurvedAnimation(parent: widget.route.animation, curve: const Threshold(0.0)); opacity = CurvedAnimation(parent: widget.route.animation, curve: const Threshold(0.0));
} else { } else {
final double start = (0.5 + (widget.itemIndex + 1) * unit).clamp(0.0, 1.0); final double start = (0.5 + (widget.itemIndex + 1) * unit).clamp(0.0, 1.0) as double;
final double end = (start + 1.5 * unit).clamp(0.0, 1.0); final double end = (start + 1.5 * unit).clamp(0.0, 1.0) as double;
opacity = CurvedAnimation(parent: widget.route.animation, curve: Interval(start, end)); opacity = CurvedAnimation(parent: widget.route.animation, curve: Interval(start, end));
} }
Widget child = FadeTransition( Widget child = FadeTransition(
...@@ -341,10 +341,10 @@ class _DropdownMenuRouteLayout<T> extends SingleChildLayoutDelegate { ...@@ -341,10 +341,10 @@ class _DropdownMenuRouteLayout<T> extends SingleChildLayoutDelegate {
double left; double left;
switch (textDirection) { switch (textDirection) {
case TextDirection.rtl: case TextDirection.rtl:
left = buttonRect.right.clamp(0.0, size.width) - childSize.width; left = (buttonRect.right.clamp(0.0, size.width) as double) - childSize.width;
break; break;
case TextDirection.ltr: case TextDirection.ltr:
left = buttonRect.left.clamp(0.0, size.width - childSize.width); left = buttonRect.left.clamp(0.0, size.width - childSize.width) as double;
break; break;
} }
...@@ -367,10 +367,8 @@ class _DropdownRouteResult<T> { ...@@ -367,10 +367,8 @@ class _DropdownRouteResult<T> {
@override @override
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (other is! _DropdownRouteResult<T>) return other is _DropdownRouteResult<T>
return false; && other.result == result;
final _DropdownRouteResult<T> typedOther = other;
return result == typedOther.result;
} }
@override @override
...@@ -1133,7 +1131,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi ...@@ -1133,7 +1131,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
TextStyle get _textStyle => widget.style ?? Theme.of(context).textTheme.subhead; TextStyle get _textStyle => widget.style ?? Theme.of(context).textTheme.subhead;
void _handleTap() { void _handleTap() {
final RenderBox itemBox = context.findRenderObject(); final RenderBox itemBox = context.findRenderObject() as RenderBox;
final Rect itemRect = itemBox.localToGlobal(Offset.zero) & itemBox.size; final Rect itemRect = itemBox.localToGlobal(Offset.zero) & itemBox.size;
final TextDirection textDirection = Directionality.of(context); final TextDirection textDirection = Directionality.of(context);
final EdgeInsetsGeometry menuMargin = ButtonTheme.of(context).alignedDropdown final EdgeInsetsGeometry menuMargin = ButtonTheme.of(context).alignedDropdown
...@@ -1476,7 +1474,7 @@ class DropdownButtonFormField<T> extends FormField<T> { ...@@ -1476,7 +1474,7 @@ class DropdownButtonFormField<T> extends FormField<T> {
class _DropdownButtonFormFieldState<T> extends FormFieldState<T> { class _DropdownButtonFormFieldState<T> extends FormFieldState<T> {
@override @override
DropdownButtonFormField<T> get widget => super.widget; DropdownButtonFormField<T> get widget => super.widget as DropdownButtonFormField<T>;
@override @override
void didChange(T value) { void didChange(T value) {
......
...@@ -25,9 +25,9 @@ class _SaltedKey<S, V> extends LocalKey { ...@@ -25,9 +25,9 @@ class _SaltedKey<S, V> extends LocalKey {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final _SaltedKey<S, V> typedOther = other; return other is _SaltedKey<S, V>
return salt == typedOther.salt && other.salt == salt
&& value == typedOther.value; && other.value == value;
} }
@override @override
...@@ -364,7 +364,8 @@ class _ExpansionPanelListState extends State<ExpansionPanelList> { ...@@ -364,7 +364,8 @@ class _ExpansionPanelListState extends State<ExpansionPanelList> {
if (widget._allowOnlyOnePanelOpen) { if (widget._allowOnlyOnePanelOpen) {
assert(_allIdentifiersUnique(), 'All ExpansionPanelRadio identifier values must be unique.'); assert(_allIdentifiersUnique(), 'All ExpansionPanelRadio identifier values must be unique.');
if (widget.initialOpenPanelValue != null) { if (widget.initialOpenPanelValue != null) {
_currentOpenPanel = searchPanelByValue(widget.children, widget.initialOpenPanelValue); _currentOpenPanel =
searchPanelByValue(widget.children.cast<ExpansionPanelRadio>(), widget.initialOpenPanelValue);
} }
} }
} }
...@@ -378,7 +379,8 @@ class _ExpansionPanelListState extends State<ExpansionPanelList> { ...@@ -378,7 +379,8 @@ class _ExpansionPanelListState extends State<ExpansionPanelList> {
// If the previous widget was non-radio ExpansionPanelList, initialize the // If the previous widget was non-radio ExpansionPanelList, initialize the
// open panel to widget.initialOpenPanelValue // open panel to widget.initialOpenPanelValue
if (!oldWidget._allowOnlyOnePanelOpen) { if (!oldWidget._allowOnlyOnePanelOpen) {
_currentOpenPanel = searchPanelByValue(widget.children, widget.initialOpenPanelValue); _currentOpenPanel =
searchPanelByValue(widget.children.cast<ExpansionPanelRadio>(), widget.initialOpenPanelValue);
} }
} else { } else {
_currentOpenPanel = null; _currentOpenPanel = null;
...@@ -387,7 +389,7 @@ class _ExpansionPanelListState extends State<ExpansionPanelList> { ...@@ -387,7 +389,7 @@ class _ExpansionPanelListState extends State<ExpansionPanelList> {
bool _allIdentifiersUnique() { bool _allIdentifiersUnique() {
final Map<Object, bool> identifierMap = <Object, bool>{}; final Map<Object, bool> identifierMap = <Object, bool>{};
for (ExpansionPanelRadio child in widget.children) { for (ExpansionPanelRadio child in widget.children.cast<ExpansionPanelRadio>()) {
identifierMap[child.value] = true; identifierMap[child.value] = true;
} }
return identifierMap.length == widget.children.length; return identifierMap.length == widget.children.length;
...@@ -395,7 +397,7 @@ class _ExpansionPanelListState extends State<ExpansionPanelList> { ...@@ -395,7 +397,7 @@ class _ExpansionPanelListState extends State<ExpansionPanelList> {
bool _isChildExpanded(int index) { bool _isChildExpanded(int index) {
if (widget._allowOnlyOnePanelOpen) { if (widget._allowOnlyOnePanelOpen) {
final ExpansionPanelRadio radioWidget = widget.children[index]; final ExpansionPanelRadio radioWidget = widget.children[index] as ExpansionPanelRadio;
return _currentOpenPanel?.value == radioWidget.value; return _currentOpenPanel?.value == radioWidget.value;
} }
return widget.children[index].isExpanded; return widget.children[index].isExpanded;
...@@ -406,12 +408,12 @@ class _ExpansionPanelListState extends State<ExpansionPanelList> { ...@@ -406,12 +408,12 @@ class _ExpansionPanelListState extends State<ExpansionPanelList> {
widget.expansionCallback(index, isExpanded); widget.expansionCallback(index, isExpanded);
if (widget._allowOnlyOnePanelOpen) { if (widget._allowOnlyOnePanelOpen) {
final ExpansionPanelRadio pressedChild = widget.children[index]; final ExpansionPanelRadio pressedChild = widget.children[index] as ExpansionPanelRadio;
// If another ExpansionPanelRadio was already open, apply its // If another ExpansionPanelRadio was already open, apply its
// expansionCallback (if any) to false, because it's closing. // expansionCallback (if any) to false, because it's closing.
for (int childIndex = 0; childIndex < widget.children.length; childIndex += 1) { for (int childIndex = 0; childIndex < widget.children.length; childIndex += 1) {
final ExpansionPanelRadio child = widget.children[childIndex]; final ExpansionPanelRadio child = widget.children[childIndex] as ExpansionPanelRadio;
if (widget.expansionCallback != null && if (widget.expansionCallback != null &&
childIndex != index && childIndex != index &&
child.value == _currentOpenPanel?.value) child.value == _currentOpenPanel?.value)
......
...@@ -115,7 +115,7 @@ class _ExpansionTileState extends State<ExpansionTile> with SingleTickerProvider ...@@ -115,7 +115,7 @@ class _ExpansionTileState extends State<ExpansionTile> with SingleTickerProvider
_iconColor = _controller.drive(_iconColorTween.chain(_easeInTween)); _iconColor = _controller.drive(_iconColorTween.chain(_easeInTween));
_backgroundColor = _controller.drive(_backgroundColorTween.chain(_easeOutTween)); _backgroundColor = _controller.drive(_backgroundColorTween.chain(_easeOutTween));
_isExpanded = PageStorage.of(context)?.readState(context) ?? widget.initiallyExpanded; _isExpanded = PageStorage.of(context)?.readState(context) as bool ?? widget.initiallyExpanded;
if (_isExpanded) if (_isExpanded)
_controller.value = 1.0; _controller.value = 1.0;
} }
......
...@@ -288,7 +288,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> { ...@@ -288,7 +288,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
// 0.0 -> Expanded // 0.0 -> Expanded
// 1.0 -> Collapsed to toolbar // 1.0 -> Collapsed to toolbar
final double t = (1.0 - (settings.currentExtent - settings.minExtent) / deltaExtent).clamp(0.0, 1.0); final double t = (1.0 - (settings.currentExtent - settings.minExtent) / deltaExtent).clamp(0.0, 1.0) as double;
// background // background
if (widget.background != null) { if (widget.background != null) {
...@@ -358,7 +358,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> { ...@@ -358,7 +358,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
if (widget.stretchModes.contains(StretchMode.fadeTitle) && if (widget.stretchModes.contains(StretchMode.fadeTitle) &&
constraints.maxHeight > settings.maxExtent) { constraints.maxHeight > settings.maxExtent) {
final double stretchOpacity = 1 - final double stretchOpacity = 1 -
((constraints.maxHeight - settings.maxExtent) / 100).clamp(0.0, 1.0); (((constraints.maxHeight - settings.maxExtent) / 100).clamp(0.0, 1.0) as double);
title = Opacity( title = Opacity(
opacity: stretchOpacity, opacity: stretchOpacity,
child: title, child: title,
......
...@@ -165,18 +165,18 @@ class FloatingActionButtonThemeData extends Diagnosticable { ...@@ -165,18 +165,18 @@ class FloatingActionButtonThemeData extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final FloatingActionButtonThemeData otherData = other; return other is FloatingActionButtonThemeData
return otherData.foregroundColor == foregroundColor && other.foregroundColor == foregroundColor
&& otherData.backgroundColor == backgroundColor && other.backgroundColor == backgroundColor
&& otherData.focusColor == focusColor && other.focusColor == focusColor
&& otherData.hoverColor == hoverColor && other.hoverColor == hoverColor
&& otherData.splashColor == splashColor && other.splashColor == splashColor
&& otherData.elevation == elevation && other.elevation == elevation
&& otherData.focusElevation == focusElevation && other.focusElevation == focusElevation
&& otherData.hoverElevation == hoverElevation && other.hoverElevation == hoverElevation
&& otherData.disabledElevation == disabledElevation && other.disabledElevation == disabledElevation
&& otherData.highlightElevation == highlightElevation && other.highlightElevation == highlightElevation
&& otherData.shape == shape; && other.shape == shape;
} }
@override @override
......
...@@ -252,7 +252,7 @@ class _InkState extends State<Ink> { ...@@ -252,7 +252,7 @@ class _InkState extends State<Ink> {
decoration: widget.decoration, decoration: widget.decoration,
configuration: createLocalImageConfiguration(context), configuration: createLocalImageConfiguration(context),
controller: Material.of(context), controller: Material.of(context),
referenceBox: context.findRenderObject(), referenceBox: context.findRenderObject() as RenderBox,
onRemoved: _handleRemoved, onRemoved: _handleRemoved,
); );
} else { } else {
......
...@@ -511,7 +511,7 @@ class _InkResponseState<T extends InkResponse> extends State<T> with AutomaticKe ...@@ -511,7 +511,7 @@ class _InkResponseState<T extends InkResponse> extends State<T> with AutomaticKe
} }
@override @override
void didUpdateWidget(InkResponse oldWidget) { void didUpdateWidget(T oldWidget) {
super.didUpdateWidget(oldWidget); super.didUpdateWidget(oldWidget);
if (_isWidgetEnabled(widget) != _isWidgetEnabled(oldWidget)) { if (_isWidgetEnabled(widget) != _isWidgetEnabled(oldWidget)) {
_handleHoverChange(_hovering); _handleHoverChange(_hovering);
...@@ -565,7 +565,7 @@ class _InkResponseState<T extends InkResponse> extends State<T> with AutomaticKe ...@@ -565,7 +565,7 @@ class _InkResponseState<T extends InkResponse> extends State<T> with AutomaticKe
return; return;
if (value) { if (value) {
if (highlight == null) { if (highlight == null) {
final RenderBox referenceBox = context.findRenderObject(); final RenderBox referenceBox = context.findRenderObject() as RenderBox;
_highlights[type] = InkHighlight( _highlights[type] = InkHighlight(
controller: Material.of(context), controller: Material.of(context),
referenceBox: referenceBox, referenceBox: referenceBox,
...@@ -603,7 +603,7 @@ class _InkResponseState<T extends InkResponse> extends State<T> with AutomaticKe ...@@ -603,7 +603,7 @@ class _InkResponseState<T extends InkResponse> extends State<T> with AutomaticKe
InteractiveInkFeature _createInkFeature(Offset globalPosition) { InteractiveInkFeature _createInkFeature(Offset globalPosition) {
final MaterialInkController inkController = Material.of(context); final MaterialInkController inkController = Material.of(context);
final RenderBox referenceBox = context.findRenderObject(); final RenderBox referenceBox = context.findRenderObject() as RenderBox;
final Offset position = referenceBox.globalToLocal(globalPosition); final Offset position = referenceBox.globalToLocal(globalPosition);
final Color color = widget.splashColor ?? Theme.of(context).splashColor; final Color color = widget.splashColor ?? Theme.of(context).splashColor;
final RectCallback rectCallback = widget.containedInkWell ? widget.getRectCallback(referenceBox) : null; final RectCallback rectCallback = widget.containedInkWell ? widget.getRectCallback(referenceBox) : null;
...@@ -681,7 +681,7 @@ class _InkResponseState<T extends InkResponse> extends State<T> with AutomaticKe ...@@ -681,7 +681,7 @@ class _InkResponseState<T extends InkResponse> extends State<T> with AutomaticKe
Offset globalPosition; Offset globalPosition;
if (context != null) { if (context != null) {
final RenderBox referenceBox = context.findRenderObject(); final RenderBox referenceBox = context.findRenderObject() as RenderBox;
assert(referenceBox.hasSize, 'InkResponse must be done with layout before starting a splash.'); assert(referenceBox.hasSize, 'InkResponse must be done with layout before starting a splash.');
globalPosition = referenceBox.localToGlobal(referenceBox.paintBounds.center); globalPosition = referenceBox.localToGlobal(referenceBox.paintBounds.center);
} else { } else {
......
...@@ -240,8 +240,8 @@ class UnderlineInputBorder extends InputBorder { ...@@ -240,8 +240,8 @@ class UnderlineInputBorder extends InputBorder {
return true; return true;
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final InputBorder typedOther = other; return other is InputBorder
return typedOther.borderSide == borderSide; && other.borderSide == borderSide;
} }
@override @override
...@@ -497,10 +497,10 @@ class OutlineInputBorder extends InputBorder { ...@@ -497,10 +497,10 @@ class OutlineInputBorder extends InputBorder {
return true; return true;
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final OutlineInputBorder typedOther = other; return other is OutlineInputBorder
return typedOther.borderSide == borderSide && other.borderSide == borderSide
&& typedOther.borderRadius == borderRadius && other.borderRadius == borderRadius
&& typedOther.gapPadding == gapPadding; && other.gapPadding == gapPadding;
} }
@override @override
......
...@@ -975,10 +975,10 @@ class _ListTileElement extends RenderObjectElement { ...@@ -975,10 +975,10 @@ class _ListTileElement extends RenderObjectElement {
final Map<Element, _ListTileSlot> childToSlot = <Element, _ListTileSlot>{}; final Map<Element, _ListTileSlot> childToSlot = <Element, _ListTileSlot>{};
@override @override
_ListTile get widget => super.widget; _ListTile get widget => super.widget as _ListTile;
@override @override
_RenderListTile get renderObject => super.renderObject; _RenderListTile get renderObject => super.renderObject as _RenderListTile;
@override @override
void visitChildren(ElementVisitor visitor) { void visitChildren(ElementVisitor visitor) {
...@@ -1039,7 +1039,7 @@ class _ListTileElement extends RenderObjectElement { ...@@ -1039,7 +1039,7 @@ class _ListTileElement extends RenderObjectElement {
_updateChild(widget.trailing, _ListTileSlot.trailing); _updateChild(widget.trailing, _ListTileSlot.trailing);
} }
void _updateRenderObject(RenderObject child, _ListTileSlot slot) { void _updateRenderObject(RenderBox child, _ListTileSlot slot) {
switch (slot) { switch (slot) {
case _ListTileSlot.leading: case _ListTileSlot.leading:
renderObject.leading = child; renderObject.leading = child;
...@@ -1060,8 +1060,8 @@ class _ListTileElement extends RenderObjectElement { ...@@ -1060,8 +1060,8 @@ class _ListTileElement extends RenderObjectElement {
void insertChildRenderObject(RenderObject child, dynamic slotValue) { void insertChildRenderObject(RenderObject child, dynamic slotValue) {
assert(child is RenderBox); assert(child is RenderBox);
assert(slotValue is _ListTileSlot); assert(slotValue is _ListTileSlot);
final _ListTileSlot slot = slotValue; final _ListTileSlot slot = slotValue as _ListTileSlot;
_updateRenderObject(child, slot); _updateRenderObject(child as RenderBox, slot);
assert(renderObject.childToSlot.keys.contains(child)); assert(renderObject.childToSlot.keys.contains(child));
assert(renderObject.slotToChild.keys.contains(slot)); assert(renderObject.slotToChild.keys.contains(slot));
} }
...@@ -1303,7 +1303,7 @@ class _RenderListTile extends RenderBox { ...@@ -1303,7 +1303,7 @@ class _RenderListTile extends RenderBox {
@override @override
double computeDistanceToActualBaseline(TextBaseline baseline) { double computeDistanceToActualBaseline(TextBaseline baseline) {
assert(title != null); assert(title != null);
final BoxParentData parentData = title.parentData; final BoxParentData parentData = title.parentData as BoxParentData;
return parentData.offset.dy + title.getDistanceToActualBaseline(baseline); return parentData.offset.dy + title.getDistanceToActualBaseline(baseline);
} }
...@@ -1319,7 +1319,7 @@ class _RenderListTile extends RenderBox { ...@@ -1319,7 +1319,7 @@ class _RenderListTile extends RenderBox {
} }
static void _positionBox(RenderBox box, Offset offset) { static void _positionBox(RenderBox box, Offset offset) {
final BoxParentData parentData = box.parentData; final BoxParentData parentData = box.parentData as BoxParentData;
parentData.offset = offset; parentData.offset = offset;
} }
...@@ -1463,7 +1463,7 @@ class _RenderListTile extends RenderBox { ...@@ -1463,7 +1463,7 @@ class _RenderListTile extends RenderBox {
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
void doPaint(RenderBox child) { void doPaint(RenderBox child) {
if (child != null) { if (child != null) {
final BoxParentData parentData = child.parentData; final BoxParentData parentData = child.parentData as BoxParentData;
context.paintChild(child, parentData.offset + offset); context.paintChild(child, parentData.offset + offset);
} }
} }
...@@ -1480,7 +1480,7 @@ class _RenderListTile extends RenderBox { ...@@ -1480,7 +1480,7 @@ class _RenderListTile extends RenderBox {
bool hitTestChildren(BoxHitTestResult result, { @required Offset position }) { bool hitTestChildren(BoxHitTestResult result, { @required Offset position }) {
assert(position != null); assert(position != null);
for (RenderBox child in _children) { for (RenderBox child in _children) {
final BoxParentData parentData = child.parentData; final BoxParentData parentData = child.parentData as BoxParentData;
final bool isHit = result.addWithPaintOffset( final bool isHit = result.addWithPaintOffset(
offset: parentData.offset, offset: parentData.offset,
position: position, position: position,
......
...@@ -358,7 +358,7 @@ class _MaterialState extends State<Material> with TickerProviderStateMixin { ...@@ -358,7 +358,7 @@ class _MaterialState extends State<Material> with TickerProviderStateMixin {
} }
contents = NotificationListener<LayoutChangedNotification>( contents = NotificationListener<LayoutChangedNotification>(
onNotification: (LayoutChangedNotification notification) { onNotification: (LayoutChangedNotification notification) {
final _RenderInkFeatures renderer = _inkFeatureRenderer.currentContext.findRenderObject(); final _RenderInkFeatures renderer = _inkFeatureRenderer.currentContext.findRenderObject() as _RenderInkFeatures;
renderer._didChangeLayout(); renderer._didChangeLayout();
return false; return false;
}, },
...@@ -575,7 +575,7 @@ abstract class InkFeature { ...@@ -575,7 +575,7 @@ abstract class InkFeature {
this.onRemoved, this.onRemoved,
}) : assert(controller != null), }) : assert(controller != null),
assert(referenceBox != null), assert(referenceBox != null),
_controller = controller; _controller = controller as _RenderInkFeatures;
/// The [MaterialInkController] associated with this [InkFeature]. /// The [MaterialInkController] associated with this [InkFeature].
/// ///
...@@ -612,7 +612,7 @@ abstract class InkFeature { ...@@ -612,7 +612,7 @@ abstract class InkFeature {
final List<RenderObject> descendants = <RenderObject>[referenceBox]; final List<RenderObject> descendants = <RenderObject>[referenceBox];
RenderObject node = referenceBox; RenderObject node = referenceBox;
while (node != _controller) { while (node != _controller) {
node = node.parent; node = node.parent as RenderObject;
assert(node != null); assert(node != null);
descendants.add(node); descendants.add(node);
} }
...@@ -734,9 +734,21 @@ class _MaterialInteriorState extends AnimatedWidgetBaseState<_MaterialInterior> ...@@ -734,9 +734,21 @@ class _MaterialInteriorState extends AnimatedWidgetBaseState<_MaterialInterior>
@override @override
void forEachTween(TweenVisitor<dynamic> visitor) { void forEachTween(TweenVisitor<dynamic> visitor) {
_elevation = visitor(_elevation, widget.elevation, (dynamic value) => Tween<double>(begin: value)); _elevation = visitor(
_shadowColor = visitor(_shadowColor, widget.shadowColor, (dynamic value) => ColorTween(begin: value)); _elevation,
_border = visitor(_border, widget.shape, (dynamic value) => ShapeBorderTween(begin: value)); widget.elevation,
(dynamic value) => Tween<double>(begin: value as double),
) as Tween<double>;
_shadowColor = visitor(
_shadowColor,
widget.shadowColor,
(dynamic value) => ColorTween(begin: value as Color),
) as ColorTween;
_border = visitor(
_border,
widget.shape,
(dynamic value) => ShapeBorderTween(begin: value as ShapeBorder),
) as ShapeBorderTween;
} }
@override @override
......
...@@ -164,9 +164,10 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid ...@@ -164,9 +164,10 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
_children = List<MergeableMaterialItem>.from(widget.children); _children = List<MergeableMaterialItem>.from(widget.children);
for (int i = 0; i < _children.length; i += 1) { for (int i = 0; i < _children.length; i += 1) {
if (_children[i] is MaterialGap) { final MergeableMaterialItem child = _children[i];
_initGap(_children[i]); if (child is MaterialGap) {
_animationTuples[_children[i].key].controller.value = 1.0; // Gaps are initially full-sized. _initGap(child);
_animationTuples[child.key].controller.value = 1.0; // Gaps are initially full-sized.
} }
} }
assert(_debugGapsAreValid(_children)); assert(_debugGapsAreValid(_children));
...@@ -323,8 +324,9 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid ...@@ -323,8 +324,9 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
double gapSizeSum = 0.0; double gapSizeSum = 0.0;
while (startOld < j) { while (startOld < j) {
if (_children[startOld] is MaterialGap) { final MergeableMaterialItem child = _children[startOld];
final MaterialGap gap = _children[startOld]; if (child is MaterialGap) {
final MaterialGap gap = child;
gapSizeSum += gap.size; gapSizeSum += gap.size;
} }
...@@ -364,21 +366,19 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid ...@@ -364,21 +366,19 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
double gapSizeSum = 0.0; double gapSizeSum = 0.0;
for (int k = startNew; k < i; k += 1) { for (int k = startNew; k < i; k += 1) {
if (newChildren[k] is MaterialGap) { final MergeableMaterialItem newChild = newChildren[k];
final MaterialGap gap = newChildren[k]; if (newChild is MaterialGap) {
gapSizeSum += gap.size; gapSizeSum += newChild.size;
} }
} }
// All gaps get proportional sizes of the original gap and they will // All gaps get proportional sizes of the original gap and they will
// animate to their actual size. // animate to their actual size.
for (int k = startNew; k < i; k += 1) { for (int k = startNew; k < i; k += 1) {
if (newChildren[k] is MaterialGap) { final MergeableMaterialItem newChild = newChildren[k];
final MaterialGap gap = newChildren[k]; if (newChild is MaterialGap) {
_animationTuples[newChild.key].gapStart = gapSize * newChild.size / gapSizeSum;
_animationTuples[gap.key].gapStart = gapSize * gap.size / _animationTuples[newChild.key].controller
gapSizeSum;
_animationTuples[gap.key].controller
..value = 0.0 ..value = 0.0
..forward(); ..forward();
} }
...@@ -387,11 +387,12 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid ...@@ -387,11 +387,12 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
} else { } else {
// Grow gaps. // Grow gaps.
for (int k = 0; k < newLength; k += 1) { for (int k = 0; k < newLength; k += 1) {
_insertChild(startOld + k, newChildren[startNew + k]); final MergeableMaterialItem newChild = newChildren[startNew + k];
_insertChild(startOld + k, newChild);
if (newChildren[startNew + k] is MaterialGap) { if (newChild is MaterialGap) {
final MaterialGap gap = newChildren[startNew + k]; _animationTuples[newChild.key].controller.forward();
_animationTuples[gap.key].controller.forward();
} }
} }
...@@ -404,9 +405,9 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid ...@@ -404,9 +405,9 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
double gapSizeSum = 0.0; double gapSizeSum = 0.0;
while (startOld < j) { while (startOld < j) {
if (_children[startOld] is MaterialGap) { final MergeableMaterialItem child = _children[startOld];
final MaterialGap gap = _children[startOld]; if (child is MaterialGap) {
gapSizeSum += gap.size; gapSizeSum += child.size;
} }
_removeChild(startOld); _removeChild(startOld);
...@@ -428,7 +429,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid ...@@ -428,7 +429,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
} }
} else if (oldLength == 1) { } else if (oldLength == 1) {
// Shrink gap. // Shrink gap.
final MaterialGap gap = _children[startOld]; final MaterialGap gap = _children[startOld] as MaterialGap;
_animationTuples[gap.key].gapStart = 0.0; _animationTuples[gap.key].gapStart = 0.0;
_animationTuples[gap.key].controller.reverse(); _animationTuples[gap.key].controller.reverse();
} }
...@@ -498,7 +499,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid ...@@ -498,7 +499,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
} }
double _getGapSize(int index) { double _getGapSize(int index) {
final MaterialGap gap = _children[index]; final MaterialGap gap = _children[index] as MaterialGap;
return lerpDouble( return lerpDouble(
_animationTuples[gap.key].gapStart, _animationTuples[gap.key].gapStart,
...@@ -548,7 +549,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid ...@@ -548,7 +549,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
), ),
); );
} else { } else {
final MaterialSlice slice = _children[i]; final MaterialSlice slice = _children[i] as MaterialSlice;
Widget child = slice.child; Widget child = slice.child;
if (widget.hasDividers) { if (widget.hasDividers) {
...@@ -631,10 +632,8 @@ class _MergeableMaterialSliceKey extends GlobalKey { ...@@ -631,10 +632,8 @@ class _MergeableMaterialSliceKey extends GlobalKey {
@override @override
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (other is! _MergeableMaterialSliceKey) return other is _MergeableMaterialSliceKey
return false; && other.value == value;
final _MergeableMaterialSliceKey typedOther = other;
return value == typedOther.value;
} }
@override @override
...@@ -671,7 +670,7 @@ class _MergeableMaterialListBody extends ListBody { ...@@ -671,7 +670,7 @@ class _MergeableMaterialListBody extends ListBody {
@override @override
void updateRenderObject(BuildContext context, RenderListBody renderObject) { void updateRenderObject(BuildContext context, RenderListBody renderObject) {
final _RenderMergeableMaterialListBody materialRenderListBody = renderObject; final _RenderMergeableMaterialListBody materialRenderListBody = renderObject as _RenderMergeableMaterialListBody;
materialRenderListBody materialRenderListBody
..axisDirection = _getDirection(context) ..axisDirection = _getDirection(context)
..boxShadows = boxShadows; ..boxShadows = boxShadows;
...@@ -705,7 +704,7 @@ class _RenderMergeableMaterialListBody extends RenderListBody { ...@@ -705,7 +704,7 @@ class _RenderMergeableMaterialListBody extends RenderListBody {
int i = 0; int i = 0;
while (child != null) { while (child != null) {
final ListBodyParentData childParentData = child.parentData; final ListBodyParentData childParentData = child.parentData as ListBodyParentData;
final Rect rect = (childParentData.offset + offset) & child.size; final Rect rect = (childParentData.offset + offset) & child.size;
if (i % 2 == 0) if (i % 2 == 0)
_paintShadows(context.canvas, rect); _paintShadows(context.canvas, rect);
......
...@@ -557,8 +557,9 @@ class _OutlineBorder extends ShapeBorder implements MaterialStateProperty<ShapeB ...@@ -557,8 +557,9 @@ class _OutlineBorder extends ShapeBorder implements MaterialStateProperty<ShapeB
return true; return true;
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final _OutlineBorder typedOther = other; return other is _OutlineBorder
return side == typedOther.side && shape == typedOther.shape; && other.side == side
&& other.shape == shape;
} }
@override @override
......
...@@ -534,10 +534,10 @@ class PageTransitionsTheme extends Diagnosticable { ...@@ -534,10 +534,10 @@ class PageTransitionsTheme extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final PageTransitionsTheme typedOther = other;
if (identical(builders, other.builders)) if (identical(builders, other.builders))
return true; return true;
return listEquals<PageTransitionsBuilder>(_all(builders), _all(typedOther.builders)); return other is PageTransitionsTheme
&& listEquals<PageTransitionsBuilder>(_all(other.builders), _all(builders));
} }
@override @override
......
...@@ -226,7 +226,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -226,7 +226,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_firstRowIndex = PageStorage.of(context)?.readState(context) ?? widget.initialFirstRowIndex ?? 0; _firstRowIndex = PageStorage.of(context)?.readState(context) as int ?? widget.initialFirstRowIndex ?? 0;
widget.source.addListener(_handleDataSourceChanged); widget.source.addListener(_handleDataSourceChanged);
_handleDataSourceChanged(); _handleDataSourceChanged();
} }
...@@ -382,7 +382,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -382,7 +382,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
alignment: AlignmentDirectional.centerEnd, alignment: AlignmentDirectional.centerEnd,
child: DropdownButtonHideUnderline( child: DropdownButtonHideUnderline(
child: DropdownButton<int>( child: DropdownButton<int>(
items: availableRowsPerPage, items: availableRowsPerPage.cast<DropdownMenuItem<int>>(),
value: widget.rowsPerPage, value: widget.rowsPerPage,
onChanged: widget.onRowsPerPageChanged, onChanged: widget.onRowsPerPageChanged,
style: footerTextStyle, style: footerTextStyle,
......
...@@ -159,7 +159,7 @@ class _RenderMenuItem extends RenderShiftedBox { ...@@ -159,7 +159,7 @@ class _RenderMenuItem extends RenderShiftedBox {
child.layout(constraints, parentUsesSize: true); child.layout(constraints, parentUsesSize: true);
size = constraints.constrain(child.size); size = constraints.constrain(child.size);
} }
final BoxParentData childParentData = child.parentData; final BoxParentData childParentData = child.parentData as BoxParentData;
childParentData.offset = Offset.zero; childParentData.offset = Offset.zero;
onLayout(size); onLayout(size);
} }
...@@ -490,7 +490,7 @@ class _PopupMenu<T> extends StatelessWidget { ...@@ -490,7 +490,7 @@ class _PopupMenu<T> extends StatelessWidget {
for (int i = 0; i < route.items.length; i += 1) { for (int i = 0; i < route.items.length; i += 1) {
final double start = (i + 1) * unit; final double start = (i + 1) * unit;
final double end = (start + 1.5 * unit).clamp(0.0, 1.0); final double end = (start + 1.5 * unit).clamp(0.0, 1.0) as double;
final CurvedAnimation opacity = CurvedAnimation( final CurvedAnimation opacity = CurvedAnimation(
parent: route.animation, parent: route.animation,
curve: Interval(start, end), curve: Interval(start, end),
...@@ -591,7 +591,9 @@ class _PopupMenuRouteLayout extends SingleChildLayoutDelegate { ...@@ -591,7 +591,9 @@ class _PopupMenuRouteLayout extends SingleChildLayoutDelegate {
BoxConstraints getConstraintsForChild(BoxConstraints constraints) { BoxConstraints getConstraintsForChild(BoxConstraints constraints) {
// The menu can be at most the size of the overlay minus 8.0 pixels in each // The menu can be at most the size of the overlay minus 8.0 pixels in each
// direction. // direction.
return BoxConstraints.loose(constraints.biggest - const Offset(_kMenuScreenPadding * 2.0, _kMenuScreenPadding * 2.0)); return BoxConstraints.loose(
constraints.biggest - const Offset(_kMenuScreenPadding * 2.0, _kMenuScreenPadding * 2.0) as Size,
);
} }
@override @override
...@@ -677,7 +679,7 @@ class _PopupMenuRoute<T> extends PopupRoute<T> { ...@@ -677,7 +679,7 @@ class _PopupMenuRoute<T> extends PopupRoute<T> {
final RelativeRect position; final RelativeRect position;
final List<PopupMenuEntry<T>> items; final List<PopupMenuEntry<T>> items;
final List<Size> itemSizes; final List<Size> itemSizes;
final dynamic initialValue; final T initialValue;
final double elevation; final double elevation;
final ThemeData theme; final ThemeData theme;
final String semanticLabel; final String semanticLabel;
...@@ -1041,8 +1043,8 @@ class PopupMenuButton<T> extends StatefulWidget { ...@@ -1041,8 +1043,8 @@ class PopupMenuButton<T> extends StatefulWidget {
class _PopupMenuButtonState<T> extends State<PopupMenuButton<T>> { class _PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
void showButtonMenu() { void showButtonMenu() {
final PopupMenuThemeData popupMenuTheme = PopupMenuTheme.of(context); final PopupMenuThemeData popupMenuTheme = PopupMenuTheme.of(context);
final RenderBox button = context.findRenderObject(); final RenderBox button = context.findRenderObject() as RenderBox;
final RenderBox overlay = Overlay.of(context).context.findRenderObject(); final RenderBox overlay = Overlay.of(context).context.findRenderObject() as RenderBox;
final RelativeRect position = RelativeRect.fromRect( final RelativeRect position = RelativeRect.fromRect(
Rect.fromPoints( Rect.fromPoints(
button.localToGlobal(widget.offset, ancestor: overlay), button.localToGlobal(widget.offset, ancestor: overlay),
......
...@@ -99,11 +99,11 @@ class PopupMenuThemeData extends Diagnosticable { ...@@ -99,11 +99,11 @@ class PopupMenuThemeData extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final PopupMenuThemeData typedOther = other; return other is PopupMenuThemeData
return typedOther.elevation == elevation && other.elevation == elevation
&& typedOther.color == color && other.color == color
&& typedOther.shape == shape && other.shape == shape
&& typedOther.textStyle == textStyle; && other.textStyle == textStyle;
} }
@override @override
......
...@@ -181,7 +181,7 @@ class _LinearProgressIndicatorPainter extends CustomPainter { ...@@ -181,7 +181,7 @@ class _LinearProgressIndicatorPainter extends CustomPainter {
} }
if (value != null) { if (value != null) {
drawBar(0.0, value.clamp(0.0, 1.0) * size.width); drawBar(0.0, value.clamp(0.0, 1.0) * size.width as double);
} else { } else {
final double x1 = size.width * line1Tail.transform(animationValue); final double x1 = size.width * line1Tail.transform(animationValue);
final double width1 = size.width * line1Head.transform(animationValue) - x1; final double width1 = size.width * line1Head.transform(animationValue) - x1;
...@@ -331,7 +331,7 @@ class _CircularProgressIndicatorPainter extends CustomPainter { ...@@ -331,7 +331,7 @@ class _CircularProgressIndicatorPainter extends CustomPainter {
? _startAngle ? _startAngle
: _startAngle + tailValue * 3 / 2 * math.pi + rotationValue * math.pi * 1.7 - stepValue * 0.8 * math.pi, : _startAngle + tailValue * 3 / 2 * math.pi + rotationValue * math.pi * 1.7 - stepValue * 0.8 * math.pi,
arcSweep = value != null arcSweep = value != null
? value.clamp(0.0, 1.0) * _sweep ? (value.clamp(0.0, 1.0) as double) * _sweep
: math.max(headValue * 3 / 2 * math.pi - tailValue * 3 / 2 * math.pi, _epsilon); : math.max(headValue * 3 / 2 * math.pi - tailValue * 3 / 2 * math.pi, _epsilon);
final Color backgroundColor; final Color backgroundColor;
...@@ -646,7 +646,7 @@ class _RefreshProgressIndicatorState extends _CircularProgressIndicatorState { ...@@ -646,7 +646,7 @@ class _RefreshProgressIndicatorState extends _CircularProgressIndicatorState {
@override @override
Widget _buildIndicator(BuildContext context, double headValue, double tailValue, int stepValue, double rotationValue) { Widget _buildIndicator(BuildContext context, double headValue, double tailValue, int stepValue, double rotationValue) {
final double arrowheadScale = widget.value == null ? 0.0 : (widget.value * 2.0).clamp(0.0, 1.0); final double arrowheadScale = widget.value == null ? 0.0 : ((widget.value * 2.0).clamp(0.0, 1.0) as double);
return widget._buildSemanticsWrapper( return widget._buildSemanticsWrapper(
context: context, context: context,
child: Container( child: Container(
......
...@@ -993,7 +993,7 @@ class _RenderRangeSlider extends RenderBox with RelayoutWhenSystemFontsChangeMix ...@@ -993,7 +993,7 @@ class _RenderRangeSlider extends RenderBox with RelayoutWhenSystemFontsChangeMix
} }
double _discretize(double value) { double _discretize(double value) {
double result = value.clamp(0.0, 1.0); double result = value.clamp(0.0, 1.0) as double;
if (isDiscrete) { if (isDiscrete) {
result = (result * divisions).round() / divisions; result = (result * divisions).round() / divisions;
} }
...@@ -1005,7 +1005,7 @@ class _RenderRangeSlider extends RenderBox with RelayoutWhenSystemFontsChangeMix ...@@ -1005,7 +1005,7 @@ class _RenderRangeSlider extends RenderBox with RelayoutWhenSystemFontsChangeMix
} }
void _startInteraction(Offset globalPosition) { void _startInteraction(Offset globalPosition) {
final double tapValue = _getValueFromGlobalPosition(globalPosition).clamp(0.0, 1.0); final double tapValue = _getValueFromGlobalPosition(globalPosition).clamp(0.0, 1.0) as double;
_lastThumbSelection = sliderTheme.thumbSelector(textDirection, values, tapValue, _thumbSize, size, 0); _lastThumbSelection = sliderTheme.thumbSelector(textDirection, values, tapValue, _thumbSize, size, 0);
if (_lastThumbSelection != null) { if (_lastThumbSelection != null) {
...@@ -1408,10 +1408,10 @@ class _RenderRangeSlider extends RenderBox with RelayoutWhenSystemFontsChangeMix ...@@ -1408,10 +1408,10 @@ class _RenderRangeSlider extends RenderBox with RelayoutWhenSystemFontsChangeMix
} }
double _increaseValue(double value) { double _increaseValue(double value) {
return (value + _semanticActionUnit).clamp(0.0, 1.0); return (value + _semanticActionUnit).clamp(0.0, 1.0) as double;
} }
double _decreaseValue(double value) { double _decreaseValue(double value) {
return (value - _semanticActionUnit).clamp(0.0, 1.0); return (value - _semanticActionUnit).clamp(0.0, 1.0) as double;
} }
} }
...@@ -304,7 +304,7 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS ...@@ -304,7 +304,7 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS
double newValue = _dragOffset / (containerExtent * _kDragContainerExtentPercentage); double newValue = _dragOffset / (containerExtent * _kDragContainerExtentPercentage);
if (_mode == _RefreshIndicatorMode.armed) if (_mode == _RefreshIndicatorMode.armed)
newValue = math.max(newValue, 1.0 / _kDragSizeFactorLimit); newValue = math.max(newValue, 1.0 / _kDragSizeFactorLimit);
_positionController.value = newValue.clamp(0.0, 1.0); // this triggers various rebuilds _positionController.value = newValue.clamp(0.0, 1.0) as double; // this triggers various rebuilds
if (_mode == _RefreshIndicatorMode.drag && _valueColor.value.alpha == 0xFF) if (_mode == _RefreshIndicatorMode.drag && _valueColor.value.alpha == 0xFF)
_mode = _RefreshIndicatorMode.armed; _mode = _RefreshIndicatorMode.armed;
} }
......
...@@ -317,9 +317,9 @@ class _BodyBoxConstraints extends BoxConstraints { ...@@ -317,9 +317,9 @@ class _BodyBoxConstraints extends BoxConstraints {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (super != other) if (super != other)
return false; return false;
final _BodyBoxConstraints typedOther = other; return other is _BodyBoxConstraints
return bottomWidgetsHeight == typedOther.bottomWidgetsHeight && other.bottomWidgetsHeight == bottomWidgetsHeight
&& appBarHeight == typedOther.appBarHeight; && other.appBarHeight == appBarHeight;
} }
@override @override
...@@ -356,7 +356,7 @@ class _BodyBuilder extends StatelessWidget { ...@@ -356,7 +356,7 @@ class _BodyBuilder extends StatelessWidget {
return LayoutBuilder( return LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) { builder: (BuildContext context, BoxConstraints constraints) {
final _BodyBoxConstraints bodyConstraints = constraints; final _BodyBoxConstraints bodyConstraints = constraints as _BodyBoxConstraints;
final MediaQueryData metrics = MediaQuery.of(context); final MediaQueryData metrics = MediaQuery.of(context);
final double bottom = extendBody final double bottom = extendBody
...@@ -741,10 +741,8 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr ...@@ -741,10 +741,8 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
} }
bool _isExtendedFloatingActionButton(Widget widget) { bool _isExtendedFloatingActionButton(Widget widget) {
if (widget is! FloatingActionButton) return widget is FloatingActionButton
return false; && widget.isExtended;
final FloatingActionButton fab = widget;
return fab.isExtended;
} }
@override @override
...@@ -1897,7 +1895,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin { ...@@ -1897,7 +1895,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
clipBehavior: clipBehavior, clipBehavior: clipBehavior,
); );
}); });
return _currentBottomSheet; return _currentBottomSheet as PersistentBottomSheetController<T>;
} }
// Floating Action Button API // Floating Action Button API
...@@ -1919,7 +1917,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin { ...@@ -1919,7 +1917,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
_floatingActionButtonVisibilityController.value = newValue.clamp( _floatingActionButtonVisibilityController.value = newValue.clamp(
_floatingActionButtonVisibilityController.lowerBound, _floatingActionButtonVisibilityController.lowerBound,
_floatingActionButtonVisibilityController.upperBound, _floatingActionButtonVisibilityController.upperBound,
); ) as double;
} }
/// Shows the [Scaffold.floatingActionButton]. /// Shows the [Scaffold.floatingActionButton].
......
...@@ -962,7 +962,7 @@ class _RenderSlider extends RenderBox with RelayoutWhenSystemFontsChangeMixin { ...@@ -962,7 +962,7 @@ class _RenderSlider extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
} }
double _discretize(double value) { double _discretize(double value) {
double result = value.clamp(0.0, 1.0); double result = value.clamp(0.0, 1.0) as double;
if (isDiscrete) { if (isDiscrete) {
result = (result * divisions).round() / divisions; result = (result * divisions).round() / divisions;
} }
...@@ -1191,8 +1191,8 @@ class _RenderSlider extends RenderBox with RelayoutWhenSystemFontsChangeMixin { ...@@ -1191,8 +1191,8 @@ class _RenderSlider extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
config.onDecrease = _decreaseAction; config.onDecrease = _decreaseAction;
if (semanticFormatterCallback != null) { if (semanticFormatterCallback != null) {
config.value = semanticFormatterCallback(_state._lerp(value)); config.value = semanticFormatterCallback(_state._lerp(value));
config.increasedValue = semanticFormatterCallback(_state._lerp((value + _semanticActionUnit).clamp(0.0, 1.0))); config.increasedValue = semanticFormatterCallback(_state._lerp((value + _semanticActionUnit).clamp(0.0, 1.0) as double));
config.decreasedValue = semanticFormatterCallback(_state._lerp((value - _semanticActionUnit).clamp(0.0, 1.0))); config.decreasedValue = semanticFormatterCallback(_state._lerp((value - _semanticActionUnit).clamp(0.0, 1.0) as double));
} else { } else {
config.value = '${(value * 100).round()}%'; config.value = '${(value * 100).round()}%';
config.increasedValue = '${((value + _semanticActionUnit).clamp(0.0, 1.0) * 100).round()}%'; config.increasedValue = '${((value + _semanticActionUnit).clamp(0.0, 1.0) * 100).round()}%';
...@@ -1205,13 +1205,13 @@ class _RenderSlider extends RenderBox with RelayoutWhenSystemFontsChangeMixin { ...@@ -1205,13 +1205,13 @@ class _RenderSlider extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
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);
} }
} }
} }
...@@ -780,34 +780,34 @@ class SliderThemeData extends Diagnosticable { ...@@ -780,34 +780,34 @@ class SliderThemeData extends Diagnosticable {
if (other.runtimeType != runtimeType) { if (other.runtimeType != runtimeType) {
return false; return false;
} }
final SliderThemeData otherData = other; return other is SliderThemeData
return otherData.trackHeight == trackHeight && other.trackHeight == trackHeight
&& otherData.activeTrackColor == activeTrackColor && other.activeTrackColor == activeTrackColor
&& otherData.inactiveTrackColor == inactiveTrackColor && other.inactiveTrackColor == inactiveTrackColor
&& otherData.disabledActiveTrackColor == disabledActiveTrackColor && other.disabledActiveTrackColor == disabledActiveTrackColor
&& otherData.disabledInactiveTrackColor == disabledInactiveTrackColor && other.disabledInactiveTrackColor == disabledInactiveTrackColor
&& otherData.activeTickMarkColor == activeTickMarkColor && other.activeTickMarkColor == activeTickMarkColor
&& otherData.inactiveTickMarkColor == inactiveTickMarkColor && other.inactiveTickMarkColor == inactiveTickMarkColor
&& otherData.disabledActiveTickMarkColor == disabledActiveTickMarkColor && other.disabledActiveTickMarkColor == disabledActiveTickMarkColor
&& otherData.disabledInactiveTickMarkColor == disabledInactiveTickMarkColor && other.disabledInactiveTickMarkColor == disabledInactiveTickMarkColor
&& otherData.thumbColor == thumbColor && other.thumbColor == thumbColor
&& otherData.overlappingShapeStrokeColor == overlappingShapeStrokeColor && other.overlappingShapeStrokeColor == overlappingShapeStrokeColor
&& otherData.disabledThumbColor == disabledThumbColor && other.disabledThumbColor == disabledThumbColor
&& otherData.overlayColor == overlayColor && other.overlayColor == overlayColor
&& otherData.valueIndicatorColor == valueIndicatorColor && other.valueIndicatorColor == valueIndicatorColor
&& otherData.overlayShape == overlayShape && other.overlayShape == overlayShape
&& otherData.tickMarkShape == tickMarkShape && other.tickMarkShape == tickMarkShape
&& otherData.thumbShape == thumbShape && other.thumbShape == thumbShape
&& otherData.trackShape == trackShape && other.trackShape == trackShape
&& otherData.valueIndicatorShape == valueIndicatorShape && other.valueIndicatorShape == valueIndicatorShape
&& otherData.rangeTickMarkShape == rangeTickMarkShape && other.rangeTickMarkShape == rangeTickMarkShape
&& otherData.rangeThumbShape == rangeThumbShape && other.rangeThumbShape == rangeThumbShape
&& otherData.rangeTrackShape == rangeTrackShape && other.rangeTrackShape == rangeTrackShape
&& otherData.rangeValueIndicatorShape == rangeValueIndicatorShape && other.rangeValueIndicatorShape == rangeValueIndicatorShape
&& otherData.showValueIndicator == showValueIndicator && other.showValueIndicator == showValueIndicator
&& otherData.valueIndicatorTextStyle == valueIndicatorTextStyle && other.valueIndicatorTextStyle == valueIndicatorTextStyle
&& otherData.minThumbSeparation == minThumbSeparation && other.minThumbSeparation == minThumbSeparation
&& otherData.thumbSelector == thumbSelector; && other.thumbSelector == thumbSelector;
} }
@override @override
...@@ -2768,8 +2768,8 @@ class _PaddleSliderTrackShapePathPainter { ...@@ -2768,8 +2768,8 @@ class _PaddleSliderTrackShapePathPainter {
// the top neck arc. We use this to shrink/expand it based on the scale // the top neck arc. We use this to shrink/expand it based on the scale
// factor of the value indicator. // factor of the value indicator.
final double neckStretchBaseline = math.max(0.0, rightBottomNeckCenterY - math.max(leftTopNeckCenter.dy, neckRightCenter.dy)); final double neckStretchBaseline = math.max(0.0, rightBottomNeckCenterY - math.max(leftTopNeckCenter.dy, neckRightCenter.dy));
final double t = math.pow(inverseTextScale, 3.0); final double t = math.pow(inverseTextScale, 3.0) as double;
final double stretch = (neckStretchBaseline * t).clamp(0.0, 10.0 * neckStretchBaseline); final double stretch = (neckStretchBaseline * t).clamp(0.0, 10.0 * neckStretchBaseline) as double;
final Offset neckStretch = Offset(0.0, neckStretchBaseline - stretch); final Offset neckStretch = Offset(0.0, neckStretchBaseline - stretch);
assert(!_debuggingLabelLocation || () { assert(!_debuggingLabelLocation || () {
...@@ -2886,9 +2886,9 @@ class RangeValues { ...@@ -2886,9 +2886,9 @@ class RangeValues {
bool operator ==(Object other) { bool operator ==(Object other) {
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final RangeValues typedOther = other; return other is RangeValues
return typedOther.start == start && other.start == start
&& typedOther.end == end; && other.end == end;
} }
@override @override
...@@ -2925,9 +2925,9 @@ class RangeLabels { ...@@ -2925,9 +2925,9 @@ class RangeLabels {
bool operator ==(Object other) { bool operator ==(Object other) {
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final RangeLabels typedOther = other; return other is RangeLabels
return typedOther.start == start && other.start == start
&& typedOther.end == end; && other.end == end;
} }
@override @override
......
...@@ -161,14 +161,14 @@ class SnackBarThemeData extends Diagnosticable { ...@@ -161,14 +161,14 @@ class SnackBarThemeData extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final SnackBarThemeData typedOther = other; return other is SnackBarThemeData
return typedOther.backgroundColor == backgroundColor && other.backgroundColor == backgroundColor
&& typedOther.actionTextColor == actionTextColor && other.actionTextColor == actionTextColor
&& typedOther.disabledActionTextColor == disabledActionTextColor && other.disabledActionTextColor == disabledActionTextColor
&& typedOther.contentTextStyle == contentTextStyle && other.contentTextStyle == contentTextStyle
&& typedOther.elevation == elevation && other.elevation == elevation
&& typedOther.shape == shape && other.shape == shape
&& typedOther.behavior == behavior; && other.behavior == behavior;
} }
@override @override
......
...@@ -96,7 +96,7 @@ class TabBarTheme extends Diagnosticable { ...@@ -96,7 +96,7 @@ class TabBarTheme extends Diagnosticable {
indicator: Decoration.lerp(a.indicator, b.indicator, t), indicator: Decoration.lerp(a.indicator, b.indicator, t),
indicatorSize: t < 0.5 ? a.indicatorSize : b.indicatorSize, indicatorSize: t < 0.5 ? a.indicatorSize : b.indicatorSize,
labelColor: Color.lerp(a.labelColor, b.labelColor, t), labelColor: Color.lerp(a.labelColor, b.labelColor, t),
labelPadding: EdgeInsets.lerp(a.labelPadding, b.labelPadding, t), labelPadding: EdgeInsetsGeometry.lerp(a.labelPadding, b.labelPadding, t),
labelStyle: TextStyle.lerp(a.labelStyle, b.labelStyle, t), labelStyle: TextStyle.lerp(a.labelStyle, b.labelStyle, t),
unselectedLabelColor: Color.lerp(a.unselectedLabelColor, b.unselectedLabelColor, t), unselectedLabelColor: Color.lerp(a.unselectedLabelColor, b.unselectedLabelColor, t),
unselectedLabelStyle: TextStyle.lerp(a.unselectedLabelStyle, b.unselectedLabelStyle, t), unselectedLabelStyle: TextStyle.lerp(a.unselectedLabelStyle, b.unselectedLabelStyle, t),
...@@ -122,13 +122,13 @@ class TabBarTheme extends Diagnosticable { ...@@ -122,13 +122,13 @@ class TabBarTheme extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final TabBarTheme typedOther = other; return other is TabBarTheme
return typedOther.indicator == indicator && other.indicator == indicator
&& typedOther.indicatorSize == indicatorSize && other.indicatorSize == indicatorSize
&& typedOther.labelColor == labelColor && other.labelColor == labelColor
&& typedOther.labelPadding == labelPadding && other.labelPadding == labelPadding
&& typedOther.labelStyle == labelStyle && other.labelStyle == labelStyle
&& typedOther.unselectedLabelColor == unselectedLabelColor && other.unselectedLabelColor == unselectedLabelColor
&& typedOther.unselectedLabelStyle == unselectedLabelStyle; && other.unselectedLabelStyle == unselectedLabelStyle;
} }
} }
...@@ -156,7 +156,7 @@ class _TabStyle extends AnimatedWidget { ...@@ -156,7 +156,7 @@ class _TabStyle extends AnimatedWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final ThemeData themeData = Theme.of(context); final ThemeData themeData = Theme.of(context);
final TabBarTheme tabBarTheme = TabBarTheme.of(context); final TabBarTheme tabBarTheme = TabBarTheme.of(context);
final Animation<double> animation = listenable; final Animation<double> animation = listenable as Animation<double>;
// To enable TextStyle.lerp(style1, style2, value), both styles must have // To enable TextStyle.lerp(style1, style2, value), both styles must have
// the same value of inherit. Force that to be inherit=true here. // the same value of inherit. Force that to be inherit=true here.
...@@ -232,7 +232,7 @@ class _TabLabelBarRenderer extends RenderFlex { ...@@ -232,7 +232,7 @@ class _TabLabelBarRenderer extends RenderFlex {
RenderBox child = firstChild; RenderBox child = firstChild;
final List<double> xOffsets = <double>[]; final List<double> xOffsets = <double>[];
while (child != null) { while (child != null) {
final FlexParentData childParentData = child.parentData; final FlexParentData childParentData = child.parentData as FlexParentData;
xOffsets.add(childParentData.offset.dx); xOffsets.add(childParentData.offset.dx);
assert(child.parentData == childParentData); assert(child.parentData == childParentData);
child = childParentData.nextSibling; child = childParentData.nextSibling;
...@@ -298,7 +298,7 @@ double _indexChangeProgress(TabController controller) { ...@@ -298,7 +298,7 @@ double _indexChangeProgress(TabController controller) {
// The controller's offset is changing because the user is dragging the // The controller's offset is changing because the user is dragging the
// TabBarView's PageView to the left or right. // TabBarView's PageView to the left or right.
if (!controller.indexIsChanging) if (!controller.indexIsChanging)
return (currentIndex - controllerValue).abs().clamp(0.0, 1.0); return (currentIndex - controllerValue).abs().clamp(0.0, 1.0) as double;
// The TabController animation's value is changing from previousIndex to currentIndex. // The TabController animation's value is changing from previousIndex to currentIndex.
return (controllerValue - currentIndex).abs() / (currentIndex - previousIndex).abs(); return (controllerValue - currentIndex).abs() / (currentIndex - previousIndex).abs();
...@@ -489,7 +489,7 @@ class _DragAnimation extends Animation<double> with AnimationWithParentMixin<dou ...@@ -489,7 +489,7 @@ class _DragAnimation extends Animation<double> with AnimationWithParentMixin<dou
@override @override
double get value { double get value {
assert(!controller.indexIsChanging); assert(!controller.indexIsChanging);
return (controller.animation.value - index.toDouble()).abs().clamp(0.0, 1.0); return (controller.animation.value - index.toDouble()).abs().clamp(0.0, 1.0) as double;
} }
} }
...@@ -900,7 +900,7 @@ class _TabBarState extends State<TabBar> { ...@@ -900,7 +900,7 @@ class _TabBarState extends State<TabBar> {
case TextDirection.ltr: case TextDirection.ltr:
break; break;
} }
return (tabCenter - viewportWidth / 2.0).clamp(minExtent, maxExtent); return (tabCenter - viewportWidth / 2.0).clamp(minExtent, maxExtent) as double;
} }
double _tabCenteredScrollOffset(int index) { double _tabCenteredScrollOffset(int index) {
...@@ -1302,7 +1302,7 @@ class _TabBarViewState extends State<TabBarView> { ...@@ -1302,7 +1302,7 @@ class _TabBarViewState extends State<TabBarView> {
_controller.index = _pageController.page.floor(); _controller.index = _pageController.page.floor();
_currentIndex =_controller.index; _currentIndex =_controller.index;
} }
_controller.offset = (_pageController.page - _controller.index).clamp(-1.0, 1.0); _controller.offset = (_pageController.page - _controller.index).clamp(-1.0, 1.0) as double;
} else if (notification is ScrollEndNotification) { } else if (notification is ScrollEndNotification) {
_controller.index = _pageController.page.round(); _controller.index = _pageController.page.round();
_currentIndex = _controller.index; _currentIndex = _controller.index;
......
...@@ -782,7 +782,7 @@ class _TextFieldState extends State<TextField> implements TextSelectionGestureDe ...@@ -782,7 +782,7 @@ class _TextFieldState extends State<TextField> implements TextSelectionGestureDe
if (widget.maxLength > 0) { if (widget.maxLength > 0) {
// Show the maxLength in the counter // Show the maxLength in the counter
counterText += '/${widget.maxLength}'; counterText += '/${widget.maxLength}';
final int remaining = (widget.maxLength - currentLength).clamp(0, widget.maxLength); final int remaining = (widget.maxLength - currentLength).clamp(0, widget.maxLength) as int;
semanticCounterText = localizations.remainingTextFieldCharacterCount(remaining); semanticCounterText = localizations.remainingTextFieldCharacterCount(remaining);
// Handle length exceeds maxLength // Handle length exceeds maxLength
......
...@@ -152,7 +152,7 @@ class TextFormField extends FormField<String> { ...@@ -152,7 +152,7 @@ class TextFormField extends FormField<String> {
autovalidate: autovalidate, autovalidate: autovalidate,
enabled: enabled, enabled: enabled,
builder: (FormFieldState<String> field) { builder: (FormFieldState<String> field) {
final _TextFormFieldState state = field; final _TextFormFieldState state = field as _TextFormFieldState;
final InputDecoration effectiveDecoration = (decoration ?? const InputDecoration()) final InputDecoration effectiveDecoration = (decoration ?? const InputDecoration())
.applyDefaults(Theme.of(field.context).inputDecorationTheme); .applyDefaults(Theme.of(field.context).inputDecorationTheme);
void onChangedHandler(String value) { void onChangedHandler(String value) {
...@@ -218,7 +218,7 @@ class _TextFormFieldState extends FormFieldState<String> { ...@@ -218,7 +218,7 @@ class _TextFormFieldState extends FormFieldState<String> {
TextEditingController get _effectiveController => widget.controller ?? _controller; TextEditingController get _effectiveController => widget.controller ?? _controller;
@override @override
TextFormField get widget => super.widget; TextFormField get widget => super.widget as TextFormField;
@override @override
void initState() { void initState() {
......
...@@ -481,20 +481,20 @@ class TextTheme extends Diagnosticable { ...@@ -481,20 +481,20 @@ class TextTheme extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final TextTheme typedOther = other; return other is TextTheme
return display4 == typedOther.display4 && other.display4 == display4
&& display3 == typedOther.display3 && other.display3 == display3
&& display2 == typedOther.display2 && other.display2 == display2
&& display1 == typedOther.display1 && other.display1 == display1
&& headline == typedOther.headline && other.headline == headline
&& title == typedOther.title && other.title == title
&& subhead == typedOther.subhead && other.subhead == subhead
&& body2 == typedOther.body2 && other.body2 == body2
&& body1 == typedOther.body1 && other.body1 == body1
&& caption == typedOther.caption && other.caption == caption
&& button == typedOther.button && other.button == button
&& subtitle == typedOther.subtitle && other.subtitle == subtitle
&& overline == typedOther.overline; && other.overline == overline;
} }
@override @override
......
...@@ -254,7 +254,7 @@ class _AnimatedThemeState extends AnimatedWidgetBaseState<AnimatedTheme> { ...@@ -254,7 +254,7 @@ class _AnimatedThemeState extends AnimatedWidgetBaseState<AnimatedTheme> {
@override @override
void forEachTween(TweenVisitor<dynamic> visitor) { void forEachTween(TweenVisitor<dynamic> visitor) {
// TODO(ianh): Use constructor tear-offs when it becomes possible // TODO(ianh): Use constructor tear-offs when it becomes possible
_data = visitor(_data, widget.data, (dynamic value) => ThemeDataTween(begin: value)); _data = visitor(_data, widget.data, (dynamic value) => ThemeDataTween(begin: value as ThemeData)) as ThemeDataTween;
assert(_data != null); assert(_data != null);
} }
......
...@@ -1297,71 +1297,71 @@ class ThemeData extends Diagnosticable { ...@@ -1297,71 +1297,71 @@ class ThemeData extends Diagnosticable {
bool operator ==(Object other) { bool operator ==(Object other) {
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final ThemeData otherData = other;
// Warning: make sure these properties are in the exact same order as in // Warning: make sure these properties are in the exact same order as in
// hashValues() and in the raw constructor and in the order of fields in // hashValues() and in the raw constructor and in the order of fields in
// the class and in the lerp() method. // the class and in the lerp() method.
return (otherData.brightness == brightness) && return other is ThemeData
(otherData.visualDensity == visualDensity) && && other.brightness == brightness
(otherData.primaryColor == primaryColor) && && other.visualDensity == visualDensity
(otherData.primaryColorBrightness == primaryColorBrightness) && && other.primaryColor == primaryColor
(otherData.primaryColorLight == primaryColorLight) && && other.primaryColorBrightness == primaryColorBrightness
(otherData.primaryColorDark == primaryColorDark) && && other.primaryColorLight == primaryColorLight
(otherData.accentColor == accentColor) && && other.primaryColorDark == primaryColorDark
(otherData.accentColorBrightness == accentColorBrightness) && && other.accentColor == accentColor
(otherData.canvasColor == canvasColor) && && other.accentColorBrightness == accentColorBrightness
(otherData.scaffoldBackgroundColor == scaffoldBackgroundColor) && && other.canvasColor == canvasColor
(otherData.bottomAppBarColor == bottomAppBarColor) && && other.scaffoldBackgroundColor == scaffoldBackgroundColor
(otherData.cardColor == cardColor) && && other.bottomAppBarColor == bottomAppBarColor
(otherData.dividerColor == dividerColor) && && other.cardColor == cardColor
(otherData.highlightColor == highlightColor) && && other.dividerColor == dividerColor
(otherData.splashColor == splashColor) && && other.highlightColor == highlightColor
(otherData.splashFactory == splashFactory) && && other.splashColor == splashColor
(otherData.selectedRowColor == selectedRowColor) && && other.splashFactory == splashFactory
(otherData.unselectedWidgetColor == unselectedWidgetColor) && && other.selectedRowColor == selectedRowColor
(otherData.disabledColor == disabledColor) && && other.unselectedWidgetColor == unselectedWidgetColor
(otherData.buttonTheme == buttonTheme) && && other.disabledColor == disabledColor
(otherData.buttonColor == buttonColor) && && other.buttonTheme == buttonTheme
(otherData.toggleButtonsTheme == toggleButtonsTheme) && && other.buttonColor == buttonColor
(otherData.secondaryHeaderColor == secondaryHeaderColor) && && other.toggleButtonsTheme == toggleButtonsTheme
(otherData.textSelectionColor == textSelectionColor) && && other.secondaryHeaderColor == secondaryHeaderColor
(otherData.cursorColor == cursorColor) && && other.textSelectionColor == textSelectionColor
(otherData.textSelectionHandleColor == textSelectionHandleColor) && && other.cursorColor == cursorColor
(otherData.backgroundColor == backgroundColor) && && other.textSelectionHandleColor == textSelectionHandleColor
(otherData.dialogBackgroundColor == dialogBackgroundColor) && && other.backgroundColor == backgroundColor
(otherData.indicatorColor == indicatorColor) && && other.dialogBackgroundColor == dialogBackgroundColor
(otherData.hintColor == hintColor) && && other.indicatorColor == indicatorColor
(otherData.errorColor == errorColor) && && other.hintColor == hintColor
(otherData.toggleableActiveColor == toggleableActiveColor) && && other.errorColor == errorColor
(otherData.textTheme == textTheme) && && other.toggleableActiveColor == toggleableActiveColor
(otherData.primaryTextTheme == primaryTextTheme) && && other.textTheme == textTheme
(otherData.accentTextTheme == accentTextTheme) && && other.primaryTextTheme == primaryTextTheme
(otherData.inputDecorationTheme == inputDecorationTheme) && && other.accentTextTheme == accentTextTheme
(otherData.iconTheme == iconTheme) && && other.inputDecorationTheme == inputDecorationTheme
(otherData.primaryIconTheme == primaryIconTheme) && && other.iconTheme == iconTheme
(otherData.accentIconTheme == accentIconTheme) && && other.primaryIconTheme == primaryIconTheme
(otherData.sliderTheme == sliderTheme) && && other.accentIconTheme == accentIconTheme
(otherData.tabBarTheme == tabBarTheme) && && other.sliderTheme == sliderTheme
(otherData.tooltipTheme == tooltipTheme) && && other.tabBarTheme == tabBarTheme
(otherData.cardTheme == cardTheme) && && other.tooltipTheme == tooltipTheme
(otherData.chipTheme == chipTheme) && && other.cardTheme == cardTheme
(otherData.platform == platform) && && other.chipTheme == chipTheme
(otherData.materialTapTargetSize == materialTapTargetSize) && && other.platform == platform
(otherData.applyElevationOverlayColor == applyElevationOverlayColor) && && other.materialTapTargetSize == materialTapTargetSize
(otherData.pageTransitionsTheme == pageTransitionsTheme) && && other.applyElevationOverlayColor == applyElevationOverlayColor
(otherData.appBarTheme == appBarTheme) && && other.pageTransitionsTheme == pageTransitionsTheme
(otherData.bottomAppBarTheme == bottomAppBarTheme) && && other.appBarTheme == appBarTheme
(otherData.colorScheme == colorScheme) && && other.bottomAppBarTheme == bottomAppBarTheme
(otherData.dialogTheme == dialogTheme) && && other.colorScheme == colorScheme
(otherData.floatingActionButtonTheme == floatingActionButtonTheme) && && other.dialogTheme == dialogTheme
(otherData.typography == typography) && && other.floatingActionButtonTheme == floatingActionButtonTheme
(otherData.cupertinoOverrideTheme == cupertinoOverrideTheme) && && other.typography == typography
(otherData.snackBarTheme == snackBarTheme) && && other.cupertinoOverrideTheme == cupertinoOverrideTheme
(otherData.bottomSheetTheme == bottomSheetTheme) && && other.snackBarTheme == snackBarTheme
(otherData.popupMenuTheme == popupMenuTheme) && && other.bottomSheetTheme == bottomSheetTheme
(otherData.bannerTheme == bannerTheme) && && other.popupMenuTheme == popupMenuTheme
(otherData.dividerTheme == dividerTheme) && && other.bannerTheme == bannerTheme
(otherData.buttonBarTheme == buttonBarTheme); && other.dividerTheme == dividerTheme
&& other.buttonBarTheme == buttonBarTheme;
} }
@override @override
...@@ -1636,8 +1636,9 @@ class _IdentityThemeDataCacheKey { ...@@ -1636,8 +1636,9 @@ class _IdentityThemeDataCacheKey {
bool operator ==(Object other) { bool operator ==(Object other) {
// We are explicitly ignoring the possibility that the types might not // We are explicitly ignoring the possibility that the types might not
// match in the interests of speed. // match in the interests of speed.
final _IdentityThemeDataCacheKey otherKey = other; return other is _IdentityThemeDataCacheKey
return identical(baseTheme, otherKey.baseTheme) && identical(localTextGeometry, otherKey.localTextGeometry); && identical(other.baseTheme, baseTheme)
&& identical(other.localTextGeometry, localTextGeometry);
} }
} }
...@@ -1819,9 +1820,9 @@ class VisualDensity extends Diagnosticable { ...@@ -1819,9 +1820,9 @@ class VisualDensity extends Diagnosticable {
if (other.runtimeType != runtimeType) { if (other.runtimeType != runtimeType) {
return false; return false;
} }
final VisualDensity typedOther = other; return other is VisualDensity
return horizontal == typedOther.horizontal && other.horizontal == horizontal
&& vertical == typedOther.vertical; && other.vertical == vertical;
} }
@override @override
......
...@@ -113,11 +113,9 @@ class TimeOfDay { ...@@ -113,11 +113,9 @@ class TimeOfDay {
@override @override
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (other is! TimeOfDay) return other is TimeOfDay
return false; && other.hour == hour
final TimeOfDay typedOther = other; && other.minute == minute;
return typedOther.hour == hour
&& typedOther.minute == minute;
} }
@override @override
......
...@@ -1004,7 +1004,7 @@ class _DialPainter extends CustomPainter { ...@@ -1004,7 +1004,7 @@ class _DialPainter extends CustomPainter {
final double width = labelPainter.width * _semanticNodeSizeScale; final double width = labelPainter.width * _semanticNodeSizeScale;
final double height = labelPainter.height * _semanticNodeSizeScale; final double height = labelPainter.height * _semanticNodeSizeScale;
final Offset nodeOffset = getOffsetForTheta(labelTheta, ring) + Offset(-width / 2.0, -height / 2.0); final Offset nodeOffset = getOffsetForTheta(labelTheta, ring) + Offset(-width / 2.0, -height / 2.0);
final TextSpan textSpan = labelPainter.text; final TextSpan textSpan = labelPainter.text as TextSpan;
final CustomPainterSemantics node = CustomPainterSemantics( final CustomPainterSemantics node = CustomPainterSemantics(
rect: Rect.fromLTRB( rect: Rect.fromLTRB(
nodeOffset.dx - 24.0 + width / 2, nodeOffset.dx - 24.0 + width / 2,
...@@ -1190,7 +1190,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin { ...@@ -1190,7 +1190,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
_thetaTween _thetaTween
..begin = angle ..begin = angle
..end = angle; // The controller doesn't animate during the pan gesture. ..end = angle; // The controller doesn't animate during the pan gesture.
final RenderBox box = context.findRenderObject(); final RenderBox box = context.findRenderObject() as RenderBox;
final double radius = box.size.shortestSide / 2.0; final double radius = box.size.shortestSide / 2.0;
if (widget.mode == _TimePickerMode.hour && widget.use24HourDials) { if (widget.mode == _TimePickerMode.hour && widget.use24HourDials) {
if (offset.distance * 1.5 < radius) if (offset.distance * 1.5 < radius)
...@@ -1208,7 +1208,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin { ...@@ -1208,7 +1208,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
void _handlePanStart(DragStartDetails details) { void _handlePanStart(DragStartDetails details) {
assert(!_dragging); assert(!_dragging);
_dragging = true; _dragging = true;
final RenderBox box = context.findRenderObject(); final RenderBox box = context.findRenderObject() as RenderBox;
_position = box.globalToLocal(details.globalPosition); _position = box.globalToLocal(details.globalPosition);
_center = box.size.center(Offset.zero); _center = box.size.center(Offset.zero);
_updateThetaForPan(); _updateThetaForPan();
...@@ -1235,7 +1235,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin { ...@@ -1235,7 +1235,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
} }
void _handleTapUp(TapUpDetails details) { void _handleTapUp(TapUpDetails details) {
final RenderBox box = context.findRenderObject(); final RenderBox box = context.findRenderObject() as RenderBox;
_position = box.globalToLocal(details.globalPosition); _position = box.globalToLocal(details.globalPosition);
_center = box.size.center(Offset.zero); _center = box.size.center(Offset.zero);
_updateThetaForPan(); _updateThetaForPan();
......
...@@ -1061,7 +1061,7 @@ class _SelectToggleButtonRenderObject extends RenderShiftedBox { ...@@ -1061,7 +1061,7 @@ class _SelectToggleButtonRenderObject extends RenderShiftedBox {
); );
child.layout(innerConstraints, parentUsesSize: true); child.layout(innerConstraints, parentUsesSize: true);
final BoxParentData childParentData = child.parentData; final BoxParentData childParentData = child.parentData as BoxParentData;
childParentData.offset = Offset(leadingBorderSide.width, leadingBorderSide.width); childParentData.offset = Offset(leadingBorderSide.width, leadingBorderSide.width);
size = constraints.constrain(Size( size = constraints.constrain(Size(
...@@ -1083,7 +1083,7 @@ class _SelectToggleButtonRenderObject extends RenderShiftedBox { ...@@ -1083,7 +1083,7 @@ class _SelectToggleButtonRenderObject extends RenderShiftedBox {
); );
child.layout(innerConstraints, parentUsesSize: true); child.layout(innerConstraints, parentUsesSize: true);
final BoxParentData childParentData = child.parentData; final BoxParentData childParentData = child.parentData as BoxParentData;
if (isLastButton) { if (isLastButton) {
childParentData.offset = Offset(trailingBorderOffset, trailingBorderOffset); childParentData.offset = Offset(trailingBorderOffset, trailingBorderOffset);
......
...@@ -195,22 +195,22 @@ class ToggleButtonsThemeData extends Diagnosticable { ...@@ -195,22 +195,22 @@ class ToggleButtonsThemeData extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final ToggleButtonsThemeData typedOther = other; return other is ToggleButtonsThemeData
return typedOther.textStyle == textStyle && other.textStyle == textStyle
&& typedOther.constraints == constraints && other.constraints == constraints
&& typedOther.color == color && other.color == color
&& typedOther.selectedColor == selectedColor && other.selectedColor == selectedColor
&& typedOther.disabledColor == disabledColor && other.disabledColor == disabledColor
&& typedOther.fillColor == fillColor && other.fillColor == fillColor
&& typedOther.focusColor == focusColor && other.focusColor == focusColor
&& typedOther.highlightColor == highlightColor && other.highlightColor == highlightColor
&& typedOther.hoverColor == hoverColor && other.hoverColor == hoverColor
&& typedOther.splashColor == splashColor && other.splashColor == splashColor
&& typedOther.borderColor == borderColor && other.borderColor == borderColor
&& typedOther.selectedBorderColor == selectedBorderColor && other.selectedBorderColor == selectedBorderColor
&& typedOther.disabledBorderColor == disabledBorderColor && other.disabledBorderColor == disabledBorderColor
&& typedOther.borderRadius == borderRadius && other.borderRadius == borderRadius
&& typedOther.borderWidth == borderWidth; && other.borderWidth == borderWidth;
} }
@override @override
......
...@@ -280,7 +280,7 @@ class _TooltipState extends State<Tooltip> with SingleTickerProviderStateMixin { ...@@ -280,7 +280,7 @@ class _TooltipState extends State<Tooltip> with SingleTickerProviderStateMixin {
} }
void _createNewEntry() { void _createNewEntry() {
final RenderBox box = context.findRenderObject(); final RenderBox box = context.findRenderObject() as RenderBox;
final Offset target = box.localToGlobal(box.size.center(Offset.zero)); final Offset target = box.localToGlobal(box.size.center(Offset.zero));
// We create this widget outside of the overlay entry's builder to prevent // We create this widget outside of the overlay entry's builder to prevent
......
...@@ -122,8 +122,8 @@ class TooltipThemeData extends Diagnosticable { ...@@ -122,8 +122,8 @@ class TooltipThemeData extends Diagnosticable {
assert(t != null); assert(t != null);
return TooltipThemeData( return TooltipThemeData(
height: lerpDouble(a?.height, b?.height, t), height: lerpDouble(a?.height, b?.height, t),
padding: EdgeInsets.lerp(a?.padding, b?.padding, t), padding: EdgeInsetsGeometry.lerp(a?.padding, b?.padding, t),
margin: EdgeInsets.lerp(a?.margin, b?.margin, t), margin: EdgeInsetsGeometry.lerp(a?.margin, b?.margin, t),
verticalOffset: lerpDouble(a?.verticalOffset, b?.verticalOffset, t), verticalOffset: lerpDouble(a?.verticalOffset, b?.verticalOffset, t),
preferBelow: t < 0.5 ? a.preferBelow: b.preferBelow, preferBelow: t < 0.5 ? a.preferBelow: b.preferBelow,
excludeFromSemantics: t < 0.5 ? a.excludeFromSemantics : b.excludeFromSemantics, excludeFromSemantics: t < 0.5 ? a.excludeFromSemantics : b.excludeFromSemantics,
...@@ -154,17 +154,17 @@ class TooltipThemeData extends Diagnosticable { ...@@ -154,17 +154,17 @@ class TooltipThemeData extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final TooltipThemeData typedOther = other; return other is TooltipThemeData
return typedOther.height == height && other.height == height
&& typedOther.padding == padding && other.padding == padding
&& typedOther.margin == margin && other.margin == margin
&& typedOther.verticalOffset == verticalOffset && other.verticalOffset == verticalOffset
&& typedOther.preferBelow == preferBelow && other.preferBelow == preferBelow
&& typedOther.excludeFromSemantics == excludeFromSemantics && other.excludeFromSemantics == excludeFromSemantics
&& typedOther.decoration == decoration && other.decoration == decoration
&& typedOther.textStyle == textStyle && other.textStyle == textStyle
&& typedOther.waitDuration == waitDuration && other.waitDuration == waitDuration
&& typedOther.showDuration == showDuration; && other.showDuration == showDuration;
} }
@override @override
......
...@@ -234,12 +234,12 @@ class Typography extends Diagnosticable { ...@@ -234,12 +234,12 @@ class Typography extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final Typography otherTypography = other; return other is Typography
return otherTypography.black == black && other.black == black
&& otherTypography.white == white && other.white == white
&& otherTypography.englishLike == englishLike && other.englishLike == englishLike
&& otherTypography.dense == dense && other.dense == dense
&& otherTypography.tall == tall; && other.tall == tall;
} }
@override @override
......
...@@ -232,7 +232,7 @@ class _AccountDetailsLayout extends MultiChildLayoutDelegate { ...@@ -232,7 +232,7 @@ class _AccountDetailsLayout extends MultiChildLayoutDelegate {
final String bottomLine = hasChild(accountEmail) ? accountEmail : (hasChild(accountName) ? accountName : null); final String bottomLine = hasChild(accountEmail) ? accountEmail : (hasChild(accountName) ? accountName : null);
if (bottomLine != null) { if (bottomLine != null) {
final Size constraintSize = iconSize == null ? size : size - Offset(iconSize.width, 0.0); final Size constraintSize = iconSize == null ? size : Size(size.width - iconSize.width, size.height);
iconSize ??= const Size(_kAccountDetailsHeight, _kAccountDetailsHeight); iconSize ??= const Size(_kAccountDetailsHeight, _kAccountDetailsHeight);
// place bottom line center at same height as icon center // place bottom line center at same height as icon center
......
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