diff --git a/packages/flutter/lib/src/material/animated_icons/animated_icons.dart b/packages/flutter/lib/src/material/animated_icons/animated_icons.dart index 3cff0a9ffb..4c7d9b1d26 100644 --- a/packages/flutter/lib/src/material/animated_icons/animated_icons.dart +++ b/packages/flutter/lib/src/material/animated_icons/animated_icons.dart @@ -104,7 +104,7 @@ class AnimatedIcon extends StatelessWidget { @override Widget build(BuildContext context) { - final _AnimatedIconData iconData = icon; + final _AnimatedIconData iconData = icon as _AnimatedIconData; final IconThemeData iconTheme = IconTheme.of(context); final double iconSize = size ?? iconTheme.size; final TextDirection textDirection = this.textDirection ?? Directionality.of(context); @@ -161,7 +161,7 @@ class _AnimatedIconPainter extends CustomPainter { 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) path.paint(canvas, color, uiPathFactory, clampedProgress); } diff --git a/packages/flutter/lib/src/material/app_bar.dart b/packages/flutter/lib/src/material/app_bar.dart index 51e4967262..72b8f259fc 100644 --- a/packages/flutter/lib/src/material/app_bar.dart +++ b/packages/flutter/lib/src/material/app_bar.dart @@ -750,7 +750,7 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate { // 1 | 1 | 0 || 1.0 // 1 | 1 | 1 || fade 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; final Widget appBar = FlexibleSpaceBar.createSettings( @@ -778,7 +778,7 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate { titleSpacing: titleSpacing, shape: shape, 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; diff --git a/packages/flutter/lib/src/material/app_bar_theme.dart b/packages/flutter/lib/src/material/app_bar_theme.dart index e1e5ff5cb8..e9cb2b71cc 100644 --- a/packages/flutter/lib/src/material/app_bar_theme.dart +++ b/packages/flutter/lib/src/material/app_bar_theme.dart @@ -128,13 +128,13 @@ class AppBarTheme extends Diagnosticable { return true; if (other.runtimeType != runtimeType) return false; - final AppBarTheme typedOther = other; - return typedOther.brightness == brightness - && typedOther.color == color - && typedOther.elevation == elevation - && typedOther.iconTheme == iconTheme - && typedOther.actionsIconTheme == actionsIconTheme - && typedOther.textTheme == textTheme; + return other is AppBarTheme + && other.brightness == brightness + && other.color == color + && other.elevation == elevation + && other.iconTheme == iconTheme + && other.actionsIconTheme == actionsIconTheme + && other.textTheme == textTheme; } @override diff --git a/packages/flutter/lib/src/material/arc.dart b/packages/flutter/lib/src/material/arc.dart index 307955630c..b6bf4ab7d4 100644 --- a/packages/flutter/lib/src/material/arc.dart +++ b/packages/flutter/lib/src/material/arc.dart @@ -193,14 +193,14 @@ const List<_Diagonal> _allDiagonals = <_Diagonal>[ _Diagonal(_CornerId.bottomLeft, _CornerId.topRight), ]; -typedef _KeyFunc = dynamic Function(T input); +typedef _KeyFunc = double Function(T input); // Select the element for which the key function returns the maximum value. T _maxBy(Iterable input, _KeyFunc keyFunc) { T maxValue; - dynamic maxKey; + double maxKey; for (T value in input) { - final dynamic key = keyFunc(value); + final double key = keyFunc(value); if (maxKey == null || key > maxKey) { maxValue = value; maxKey = key; diff --git a/packages/flutter/lib/src/material/banner_theme.dart b/packages/flutter/lib/src/material/banner_theme.dart index 1e2e4b4433..9fea036c05 100644 --- a/packages/flutter/lib/src/material/banner_theme.dart +++ b/packages/flutter/lib/src/material/banner_theme.dart @@ -73,8 +73,8 @@ class MaterialBannerThemeData extends Diagnosticable { return MaterialBannerThemeData( backgroundColor: Color.lerp(a?.backgroundColor, b?.backgroundColor, t), contentTextStyle: TextStyle.lerp(a?.contentTextStyle, b?.contentTextStyle, t), - padding: EdgeInsets.lerp(a?.padding, b?.padding, t), - leadingPadding: EdgeInsets.lerp(a?.leadingPadding, b?.leadingPadding, t), + padding: EdgeInsetsGeometry.lerp(a?.padding, b?.padding, t), + leadingPadding: EdgeInsetsGeometry.lerp(a?.leadingPadding, b?.leadingPadding, t), ); } @@ -94,11 +94,11 @@ class MaterialBannerThemeData extends Diagnosticable { return true; if (other.runtimeType != runtimeType) return false; - final MaterialBannerThemeData typedOther = other; - return typedOther.backgroundColor == backgroundColor - && typedOther.contentTextStyle == contentTextStyle - && typedOther.padding == padding - && typedOther.leadingPadding == leadingPadding; + return other is MaterialBannerThemeData + && other.backgroundColor == backgroundColor + && other.contentTextStyle == contentTextStyle + && other.padding == padding + && other.leadingPadding == leadingPadding; } @override diff --git a/packages/flutter/lib/src/material/bottom_app_bar_theme.dart b/packages/flutter/lib/src/material/bottom_app_bar_theme.dart index 2444bd5bd3..c8bc83f718 100644 --- a/packages/flutter/lib/src/material/bottom_app_bar_theme.dart +++ b/packages/flutter/lib/src/material/bottom_app_bar_theme.dart @@ -92,10 +92,10 @@ class BottomAppBarTheme extends Diagnosticable { return true; if (other.runtimeType != runtimeType) return false; - final BottomAppBarTheme typedOther = other; - return typedOther.color == color - && typedOther.elevation == elevation - && typedOther.shape == shape; + return other is BottomAppBarTheme + && other.color == color + && other.elevation == elevation + && other.shape == shape; } @override diff --git a/packages/flutter/lib/src/material/bottom_sheet.dart b/packages/flutter/lib/src/material/bottom_sheet.dart index a461b25de3..9178dd1ffe 100644 --- a/packages/flutter/lib/src/material/bottom_sheet.dart +++ b/packages/flutter/lib/src/material/bottom_sheet.dart @@ -152,7 +152,7 @@ class _BottomSheetState extends State { final GlobalKey _childKey = GlobalKey(debugLabel: 'BottomSheet child'); double get _childHeight { - final RenderBox renderBox = _childKey.currentContext.findRenderObject(); + final RenderBox renderBox = _childKey.currentContext.findRenderObject() as RenderBox; return renderBox.size.height; } diff --git a/packages/flutter/lib/src/material/bottom_sheet_theme.dart b/packages/flutter/lib/src/material/bottom_sheet_theme.dart index ba38084408..2324b3f456 100644 --- a/packages/flutter/lib/src/material/bottom_sheet_theme.dart +++ b/packages/flutter/lib/src/material/bottom_sheet_theme.dart @@ -123,13 +123,13 @@ class BottomSheetThemeData extends Diagnosticable { return true; if (other.runtimeType != runtimeType) return false; - final BottomSheetThemeData typedOther = other; - return typedOther.backgroundColor == backgroundColor - && typedOther.elevation == elevation - && typedOther.modalBackgroundColor == modalBackgroundColor - && typedOther.modalElevation == modalElevation - && typedOther.shape == shape - && typedOther.clipBehavior == clipBehavior; + return other is BottomSheetThemeData + && other.backgroundColor == backgroundColor + && other.elevation == elevation + && other.modalBackgroundColor == modalBackgroundColor + && other.modalElevation == modalElevation + && other.shape == shape + && other.clipBehavior == clipBehavior; } @override diff --git a/packages/flutter/lib/src/material/button.dart b/packages/flutter/lib/src/material/button.dart index efc2545a12..8862793c61 100644 --- a/packages/flutter/lib/src/material/button.dart +++ b/packages/flutter/lib/src/material/button.dart @@ -367,8 +367,8 @@ class _RawMaterialButtonState extends State { final ShapeBorder effectiveShape = MaterialStateProperty.resolveAs(widget.shape, _states); final Offset densityAdjustment = widget.visualDensity.baseSizeAdjustment; final BoxConstraints effectiveConstraints = widget.constraints.copyWith( - minWidth: widget.constraints.minWidth != null ? (widget.constraints.minWidth + densityAdjustment.dx).clamp(0.0, double.infinity) : null, - minHeight: widget.constraints.minWidth != null ? (widget.constraints.minHeight + densityAdjustment.dy).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) as double : null, ); final EdgeInsetsGeometry padding = widget.padding.add( EdgeInsets.only( @@ -517,8 +517,8 @@ class _RenderInputPadding extends RenderShiftedBox { final double height = math.max(child.size.width, minSize.width); final double width = math.max(child.size.height, minSize.height); size = constraints.constrain(Size(height, width)); - final BoxParentData childParentData = child.parentData; - childParentData.offset = Alignment.center.alongOffset(size - child.size); + final BoxParentData childParentData = child.parentData as BoxParentData; + childParentData.offset = Alignment.center.alongOffset(size - child.size as Offset); } else { size = Size.zero; } diff --git a/packages/flutter/lib/src/material/button_bar.dart b/packages/flutter/lib/src/material/button_bar.dart index 03e5075de1..471d150aef 100644 --- a/packages/flutter/lib/src/material/button_bar.dart +++ b/packages/flutter/lib/src/material/button_bar.dart @@ -316,7 +316,7 @@ class _RenderButtonBarRow extends RenderFlex { double currentHeight = 0.0; 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 // with minimum width set to zero. diff --git a/packages/flutter/lib/src/material/button_bar_theme.dart b/packages/flutter/lib/src/material/button_bar_theme.dart index e8752ffc71..bbcacc1bf5 100644 --- a/packages/flutter/lib/src/material/button_bar_theme.dart +++ b/packages/flutter/lib/src/material/button_bar_theme.dart @@ -136,7 +136,7 @@ class ButtonBarThemeData extends Diagnosticable { buttonTextTheme: t < 0.5 ? a.buttonTextTheme : b.buttonTextTheme, buttonMinWidth: lerpDouble(a?.buttonMinWidth, b?.buttonMinWidth, 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, layoutBehavior: t < 0.5 ? a.layoutBehavior : b.layoutBehavior, ); @@ -162,15 +162,15 @@ class ButtonBarThemeData extends Diagnosticable { return true; if (other.runtimeType != runtimeType) return false; - final ButtonBarThemeData typedOther = other; - return typedOther.alignment == alignment - && typedOther.mainAxisSize == mainAxisSize - && typedOther.buttonTextTheme == buttonTextTheme - && typedOther.buttonMinWidth == buttonMinWidth - && typedOther.buttonHeight == buttonHeight - && typedOther.buttonPadding == buttonPadding - && typedOther.buttonAlignedDropdown == buttonAlignedDropdown - && typedOther.layoutBehavior == layoutBehavior; + return other is ButtonBarThemeData + && other.alignment == alignment + && other.mainAxisSize == mainAxisSize + && other.buttonTextTheme == buttonTextTheme + && other.buttonMinWidth == buttonMinWidth + && other.buttonHeight == buttonHeight + && other.buttonPadding == buttonPadding + && other.buttonAlignedDropdown == buttonAlignedDropdown + && other.layoutBehavior == layoutBehavior; } @override diff --git a/packages/flutter/lib/src/material/button_theme.dart b/packages/flutter/lib/src/material/button_theme.dart index fc39d4543d..fbe6d47969 100644 --- a/packages/flutter/lib/src/material/button_theme.dart +++ b/packages/flutter/lib/src/material/button_theme.dart @@ -907,21 +907,21 @@ class ButtonThemeData extends Diagnosticable { bool operator ==(dynamic other) { if (other.runtimeType != runtimeType) return false; - final ButtonThemeData typedOther = other; - return textTheme == typedOther.textTheme - && minWidth == typedOther.minWidth - && height == typedOther.height - && padding == typedOther.padding - && shape == typedOther.shape - && alignedDropdown == typedOther.alignedDropdown - && _buttonColor == typedOther._buttonColor - && _disabledColor == typedOther._disabledColor - && _focusColor == typedOther._focusColor - && _hoverColor == typedOther._hoverColor - && _highlightColor == typedOther._highlightColor - && _splashColor == typedOther._splashColor - && colorScheme == typedOther.colorScheme - && _materialTapTargetSize == typedOther._materialTapTargetSize; + return other is ButtonThemeData + && other.textTheme == textTheme + && other.minWidth == minWidth + && other.height == height + && other.padding == padding + && other.shape == shape + && other.alignedDropdown == alignedDropdown + && other._buttonColor == _buttonColor + && other._disabledColor == _disabledColor + && other._focusColor == _focusColor + && other._hoverColor == _hoverColor + && other._highlightColor == _highlightColor + && other._splashColor == _splashColor + && other.colorScheme == colorScheme + && other._materialTapTargetSize == _materialTapTargetSize; } @override diff --git a/packages/flutter/lib/src/material/card_theme.dart b/packages/flutter/lib/src/material/card_theme.dart index 57041e30c5..37b2609826 100644 --- a/packages/flutter/lib/src/material/card_theme.dart +++ b/packages/flutter/lib/src/material/card_theme.dart @@ -122,12 +122,12 @@ class CardTheme extends Diagnosticable { return true; if (other.runtimeType != runtimeType) return false; - final CardTheme typedOther = other; - return typedOther.clipBehavior == clipBehavior - && typedOther.color == color - && typedOther.elevation == elevation - && typedOther.margin == margin - && typedOther.shape == shape; + return other is CardTheme + && other.clipBehavior == clipBehavior + && other.color == color + && other.elevation == elevation + && other.margin == margin + && other.shape == shape; } @override diff --git a/packages/flutter/lib/src/material/checkbox.dart b/packages/flutter/lib/src/material/checkbox.dart index c3fee88601..ba61e67276 100644 --- a/packages/flutter/lib/src/material/checkbox.dart +++ b/packages/flutter/lib/src/material/checkbox.dart @@ -458,7 +458,7 @@ class _RenderCheckbox extends RenderToggleable { paintRadialReaction(canvas, offset, size.center(Offset.zero)); 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 double tNormalized = status == AnimationStatus.forward || status == AnimationStatus.completed ? position.value diff --git a/packages/flutter/lib/src/material/chip.dart b/packages/flutter/lib/src/material/chip.dart index 3e7c93b84b..85b0e35561 100644 --- a/packages/flutter/lib/src/material/chip.dart +++ b/packages/flutter/lib/src/material/chip.dart @@ -1532,7 +1532,7 @@ class RawChip extends StatefulWidget @override final Color checkmarkColor; @override - final CircleBorder avatarBorder; + final ShapeBorder avatarBorder; /// If set, this indicates that the chip should be disabled if all of the /// tap callbacks ([onSelected], [onPressed]) are null. @@ -2045,10 +2045,10 @@ class _RenderChipElement extends RenderObjectElement { final Map childToSlot = {}; @override - _ChipRenderWidget get widget => super.widget; + _ChipRenderWidget get widget => super.widget as _ChipRenderWidget; @override - _RenderChip get renderObject => super.renderObject; + _RenderChip get renderObject => super.renderObject as _RenderChip; @override void visitChildren(ElementVisitor visitor) { @@ -2110,13 +2110,13 @@ class _RenderChipElement extends RenderObjectElement { void _updateRenderObject(RenderObject child, _ChipSlot slot) { switch (slot) { case _ChipSlot.avatar: - renderObject.avatar = child; + renderObject.avatar = child as RenderBox; break; case _ChipSlot.label: - renderObject.label = child; + renderObject.label = child as RenderBox; break; case _ChipSlot.deleteIcon: - renderObject.deleteIcon = child; + renderObject.deleteIcon = child as RenderBox; break; } } @@ -2125,7 +2125,7 @@ class _RenderChipElement extends RenderObjectElement { void insertChildRenderObject(RenderObject child, dynamic slotValue) { assert(child is RenderBox); assert(slotValue is _ChipSlot); - final _ChipSlot slot = slotValue; + final _ChipSlot slot = slotValue as _ChipSlot; _updateRenderObject(child, slot); assert(renderObject.childToSlot.keys.contains(child)); assert(renderObject.slotToChild.keys.contains(slot)); @@ -2181,17 +2181,17 @@ class _ChipRenderTheme { if (other.runtimeType != runtimeType) { return false; } - final _ChipRenderTheme typedOther = other; - return typedOther.avatar == avatar - && typedOther.label == label - && typedOther.deleteIcon == deleteIcon - && typedOther.brightness == brightness - && typedOther.padding == padding - && typedOther.labelPadding == labelPadding - && typedOther.showAvatar == showAvatar - && typedOther.showCheckmark == showCheckmark - && typedOther.checkmarkColor == checkmarkColor - && typedOther.canTapBody == canTapBody; + return other is _ChipRenderTheme + && other.avatar == avatar + && other.label == label + && other.deleteIcon == deleteIcon + && other.brightness == brightness + && other.padding == padding + && other.labelPadding == labelPadding + && other.showAvatar == showAvatar + && other.showCheckmark == showCheckmark + && other.checkmarkColor == checkmarkColor + && other.canTapBody == canTapBody; } @override @@ -2373,7 +2373,7 @@ class _RenderChip extends RenderBox { static Rect _boxRect(RenderBox box) => box == null ? Rect.zero : _boxParentData(box).offset & box.size; - static BoxParentData _boxParentData(RenderBox box) => box.parentData; + static BoxParentData _boxParentData(RenderBox box) => box.parentData as BoxParentData; @override double computeMinIntrinsicWidth(double height) { @@ -2895,7 +2895,7 @@ class _LocationAwareInkRippleFactory extends InteractiveInkFeatureFactory { if (tapIsOnDeleteIcon) { final RenderBox currentBox = referenceBox; - referenceBox = deleteIconKey.currentContext.findRenderObject(); + referenceBox = deleteIconKey.currentContext.findRenderObject() as RenderBox; position = referenceBox.globalToLocal(currentBox.localToGlobal(position)); containedInkWell = false; } diff --git a/packages/flutter/lib/src/material/chip_theme.dart b/packages/flutter/lib/src/material/chip_theme.dart index 2a49299cf8..27ece6b7ba 100644 --- a/packages/flutter/lib/src/material/chip_theme.dart +++ b/packages/flutter/lib/src/material/chip_theme.dart @@ -484,23 +484,23 @@ class ChipThemeData extends Diagnosticable { if (other.runtimeType != runtimeType) { return false; } - final ChipThemeData otherData = other; - return otherData.backgroundColor == backgroundColor - && otherData.deleteIconColor == deleteIconColor - && otherData.disabledColor == disabledColor - && otherData.selectedColor == selectedColor - && otherData.secondarySelectedColor == secondarySelectedColor - && otherData.shadowColor == shadowColor - && otherData.selectedShadowColor == selectedShadowColor - && otherData.checkmarkColor == checkmarkColor - && otherData.labelPadding == labelPadding - && otherData.padding == padding - && otherData.shape == shape - && otherData.labelStyle == labelStyle - && otherData.secondaryLabelStyle == secondaryLabelStyle - && otherData.brightness == brightness - && otherData.elevation == elevation - && otherData.pressElevation == pressElevation; + return other is ChipThemeData + && other.backgroundColor == backgroundColor + && other.deleteIconColor == deleteIconColor + && other.disabledColor == disabledColor + && other.selectedColor == selectedColor + && other.secondarySelectedColor == secondarySelectedColor + && other.shadowColor == shadowColor + && other.selectedShadowColor == selectedShadowColor + && other.checkmarkColor == checkmarkColor + && other.labelPadding == labelPadding + && other.padding == padding + && other.shape == shape + && other.labelStyle == labelStyle + && other.secondaryLabelStyle == secondaryLabelStyle + && other.brightness == brightness + && other.elevation == elevation + && other.pressElevation == pressElevation; } @override diff --git a/packages/flutter/lib/src/material/color_scheme.dart b/packages/flutter/lib/src/material/color_scheme.dart index 3f5f062f59..74414d8408 100644 --- a/packages/flutter/lib/src/material/color_scheme.dart +++ b/packages/flutter/lib/src/material/color_scheme.dart @@ -268,20 +268,20 @@ class ColorScheme extends Diagnosticable { return true; if (other.runtimeType != runtimeType) return false; - final ColorScheme otherScheme = other; - return otherScheme.primary == primary - && otherScheme.primaryVariant == primaryVariant - && otherScheme.secondary == secondary - && otherScheme.secondaryVariant == secondaryVariant - && otherScheme.surface == surface - && otherScheme.background == background - && otherScheme.error == error - && otherScheme.onPrimary == onPrimary - && otherScheme.onSecondary == onSecondary - && otherScheme.onSurface == onSurface - && otherScheme.onBackground == onBackground - && otherScheme.onError == onError - && otherScheme.brightness == brightness; + return other is ColorScheme + && other.primary == primary + && other.primaryVariant == primaryVariant + && other.secondary == secondary + && other.secondaryVariant == secondaryVariant + && other.surface == surface + && other.background == background + && other.error == error + && other.onPrimary == onPrimary + && other.onSecondary == onSecondary + && other.onSurface == onSurface + && other.onBackground == onBackground + && other.onError == onError + && other.brightness == brightness; } @override diff --git a/packages/flutter/lib/src/material/data_table.dart b/packages/flutter/lib/src/material/data_table.dart index 37b83912e6..4d9c29f06c 100644 --- a/packages/flutter/lib/src/material/data_table.dart +++ b/packages/flutter/lib/src/material/data_table.dart @@ -750,14 +750,14 @@ class TableRowInkWell extends InkResponse { AbstractNode table = cell.parent; final Matrix4 transform = Matrix4.identity(); while (table is RenderObject && table is! RenderTable) { - final RenderTable parentBox = table; + final RenderObject parentBox = table as RenderObject; parentBox.applyPaintTransform(cell, transform); assert(table == cell.parent); - cell = table; + cell = parentBox; table = table.parent; } if (table is RenderTable) { - final TableCellParentData cellParentData = cell.parentData; + final TableCellParentData cellParentData = cell.parentData as TableCellParentData; assert(cellParentData.y != null); final Rect rect = table.getRowBox(cellParentData.y); // The rect is in the table's coordinate space. We need to change it to the diff --git a/packages/flutter/lib/src/material/dialog_theme.dart b/packages/flutter/lib/src/material/dialog_theme.dart index f67b21362c..68fb204a63 100644 --- a/packages/flutter/lib/src/material/dialog_theme.dart +++ b/packages/flutter/lib/src/material/dialog_theme.dart @@ -109,12 +109,12 @@ class DialogTheme extends Diagnosticable { return true; if (other.runtimeType != runtimeType) return false; - final DialogTheme typedOther = other; - return typedOther.backgroundColor == backgroundColor - && typedOther.elevation == elevation - && typedOther.shape == shape - && typedOther.titleTextStyle == titleTextStyle - && typedOther.contentTextStyle == contentTextStyle; + return other is DialogTheme + && other.backgroundColor == backgroundColor + && other.elevation == elevation + && other.shape == shape + && other.titleTextStyle == titleTextStyle + && other.contentTextStyle == contentTextStyle; } @override diff --git a/packages/flutter/lib/src/material/divider_theme.dart b/packages/flutter/lib/src/material/divider_theme.dart index 44b7d44c29..4aa01350cc 100644 --- a/packages/flutter/lib/src/material/divider_theme.dart +++ b/packages/flutter/lib/src/material/divider_theme.dart @@ -110,12 +110,12 @@ class DividerThemeData extends Diagnosticable { return true; if (other.runtimeType != runtimeType) return false; - final DividerThemeData typedOther = other; - return typedOther.color == color - && typedOther.space == space - && typedOther.thickness == thickness - && typedOther.indent == indent - && typedOther.endIndent == endIndent; + return other is DividerThemeData + && other.color == color + && other.space == space + && other.thickness == thickness + && other.indent == indent + && other.endIndent == endIndent; } @override diff --git a/packages/flutter/lib/src/material/drawer.dart b/packages/flutter/lib/src/material/drawer.dart index 141f51850d..ff292d8a9a 100644 --- a/packages/flutter/lib/src/material/drawer.dart +++ b/packages/flutter/lib/src/material/drawer.dart @@ -381,7 +381,7 @@ class DrawerControllerState extends State with SingleTickerPro final GlobalKey _drawerKey = GlobalKey(); double get _width { - final RenderBox box = _drawerKey.currentContext?.findRenderObject(); + final RenderBox box = _drawerKey.currentContext?.findRenderObject() as RenderBox; if (box != null) return box.size.width; return _kWidth; // drawer not being shown currently diff --git a/packages/flutter/lib/src/material/dropdown.dart b/packages/flutter/lib/src/material/dropdown.dart index 00665e060f..4edeffbd33 100644 --- a/packages/flutter/lib/src/material/dropdown.dart +++ b/packages/flutter/lib/src/material/dropdown.dart @@ -62,12 +62,12 @@ class _DropdownMenuPainter extends CustomPainter { void paint(Canvas canvas, Size size) { final double selectedItemOffset = getSelectedItemOffset(); final Tween top = Tween( - begin: selectedItemOffset.clamp(0.0, size.height - _kMenuItemHeight), + begin: selectedItemOffset.clamp(0.0, size.height - _kMenuItemHeight) as double, end: 0.0, ); final Tween bottom = Tween( - begin: (top.begin + _kMenuItemHeight).clamp(_kMenuItemHeight, size.height), + begin: (top.begin + _kMenuItemHeight).clamp(_kMenuItemHeight, size.height) as double, end: size.height, ); @@ -162,8 +162,8 @@ class _DropdownMenuItemButtonState extends State<_DropdownMenuItemButton> if (widget.itemIndex == widget.route.selectedIndex) { opacity = CurvedAnimation(parent: widget.route.animation, curve: const Threshold(0.0)); } else { - final double start = (0.5 + (widget.itemIndex + 1) * unit).clamp(0.0, 1.0); - final double end = (start + 1.5 * 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) as double; opacity = CurvedAnimation(parent: widget.route.animation, curve: Interval(start, end)); } Widget child = FadeTransition( @@ -341,10 +341,10 @@ class _DropdownMenuRouteLayout extends SingleChildLayoutDelegate { double left; switch (textDirection) { 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; 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; } @@ -367,10 +367,8 @@ class _DropdownRouteResult { @override bool operator ==(dynamic other) { - if (other is! _DropdownRouteResult) - return false; - final _DropdownRouteResult typedOther = other; - return result == typedOther.result; + return other is _DropdownRouteResult + && other.result == result; } @override @@ -1133,7 +1131,7 @@ class _DropdownButtonState extends State> with WidgetsBindi TextStyle get _textStyle => widget.style ?? Theme.of(context).textTheme.subhead; void _handleTap() { - final RenderBox itemBox = context.findRenderObject(); + final RenderBox itemBox = context.findRenderObject() as RenderBox; final Rect itemRect = itemBox.localToGlobal(Offset.zero) & itemBox.size; final TextDirection textDirection = Directionality.of(context); final EdgeInsetsGeometry menuMargin = ButtonTheme.of(context).alignedDropdown @@ -1476,7 +1474,7 @@ class DropdownButtonFormField extends FormField { class _DropdownButtonFormFieldState extends FormFieldState { @override - DropdownButtonFormField get widget => super.widget; + DropdownButtonFormField get widget => super.widget as DropdownButtonFormField; @override void didChange(T value) { diff --git a/packages/flutter/lib/src/material/expansion_panel.dart b/packages/flutter/lib/src/material/expansion_panel.dart index 161d8e2fc7..6a8df6b1e3 100644 --- a/packages/flutter/lib/src/material/expansion_panel.dart +++ b/packages/flutter/lib/src/material/expansion_panel.dart @@ -25,9 +25,9 @@ class _SaltedKey extends LocalKey { bool operator ==(dynamic other) { if (other.runtimeType != runtimeType) return false; - final _SaltedKey typedOther = other; - return salt == typedOther.salt - && value == typedOther.value; + return other is _SaltedKey + && other.salt == salt + && other.value == value; } @override @@ -364,7 +364,8 @@ class _ExpansionPanelListState extends State { if (widget._allowOnlyOnePanelOpen) { assert(_allIdentifiersUnique(), 'All ExpansionPanelRadio identifier values must be unique.'); if (widget.initialOpenPanelValue != null) { - _currentOpenPanel = searchPanelByValue(widget.children, widget.initialOpenPanelValue); + _currentOpenPanel = + searchPanelByValue(widget.children.cast(), widget.initialOpenPanelValue); } } } @@ -378,7 +379,8 @@ class _ExpansionPanelListState extends State { // If the previous widget was non-radio ExpansionPanelList, initialize the // open panel to widget.initialOpenPanelValue if (!oldWidget._allowOnlyOnePanelOpen) { - _currentOpenPanel = searchPanelByValue(widget.children, widget.initialOpenPanelValue); + _currentOpenPanel = + searchPanelByValue(widget.children.cast(), widget.initialOpenPanelValue); } } else { _currentOpenPanel = null; @@ -387,7 +389,7 @@ class _ExpansionPanelListState extends State { bool _allIdentifiersUnique() { final Map identifierMap = {}; - for (ExpansionPanelRadio child in widget.children) { + for (ExpansionPanelRadio child in widget.children.cast()) { identifierMap[child.value] = true; } return identifierMap.length == widget.children.length; @@ -395,7 +397,7 @@ class _ExpansionPanelListState extends State { bool _isChildExpanded(int index) { if (widget._allowOnlyOnePanelOpen) { - final ExpansionPanelRadio radioWidget = widget.children[index]; + final ExpansionPanelRadio radioWidget = widget.children[index] as ExpansionPanelRadio; return _currentOpenPanel?.value == radioWidget.value; } return widget.children[index].isExpanded; @@ -406,12 +408,12 @@ class _ExpansionPanelListState extends State { widget.expansionCallback(index, isExpanded); 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 // expansionCallback (if any) to false, because it's closing. 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 && childIndex != index && child.value == _currentOpenPanel?.value) diff --git a/packages/flutter/lib/src/material/expansion_tile.dart b/packages/flutter/lib/src/material/expansion_tile.dart index a87791c498..0121e75fc1 100644 --- a/packages/flutter/lib/src/material/expansion_tile.dart +++ b/packages/flutter/lib/src/material/expansion_tile.dart @@ -115,7 +115,7 @@ class _ExpansionTileState extends State with SingleTickerProvider _iconColor = _controller.drive(_iconColorTween.chain(_easeInTween)); _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) _controller.value = 1.0; } diff --git a/packages/flutter/lib/src/material/flexible_space_bar.dart b/packages/flutter/lib/src/material/flexible_space_bar.dart index 12b8237d3f..9ac1ed9977 100644 --- a/packages/flutter/lib/src/material/flexible_space_bar.dart +++ b/packages/flutter/lib/src/material/flexible_space_bar.dart @@ -288,7 +288,7 @@ class _FlexibleSpaceBarState extends State { // 0.0 -> Expanded // 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 if (widget.background != null) { @@ -358,7 +358,7 @@ class _FlexibleSpaceBarState extends State { if (widget.stretchModes.contains(StretchMode.fadeTitle) && constraints.maxHeight > settings.maxExtent) { 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( opacity: stretchOpacity, child: title, diff --git a/packages/flutter/lib/src/material/floating_action_button_theme.dart b/packages/flutter/lib/src/material/floating_action_button_theme.dart index 5973edf39b..84c22d7942 100644 --- a/packages/flutter/lib/src/material/floating_action_button_theme.dart +++ b/packages/flutter/lib/src/material/floating_action_button_theme.dart @@ -165,18 +165,18 @@ class FloatingActionButtonThemeData extends Diagnosticable { return true; if (other.runtimeType != runtimeType) return false; - final FloatingActionButtonThemeData otherData = other; - return otherData.foregroundColor == foregroundColor - && otherData.backgroundColor == backgroundColor - && otherData.focusColor == focusColor - && otherData.hoverColor == hoverColor - && otherData.splashColor == splashColor - && otherData.elevation == elevation - && otherData.focusElevation == focusElevation - && otherData.hoverElevation == hoverElevation - && otherData.disabledElevation == disabledElevation - && otherData.highlightElevation == highlightElevation - && otherData.shape == shape; + return other is FloatingActionButtonThemeData + && other.foregroundColor == foregroundColor + && other.backgroundColor == backgroundColor + && other.focusColor == focusColor + && other.hoverColor == hoverColor + && other.splashColor == splashColor + && other.elevation == elevation + && other.focusElevation == focusElevation + && other.hoverElevation == hoverElevation + && other.disabledElevation == disabledElevation + && other.highlightElevation == highlightElevation + && other.shape == shape; } @override diff --git a/packages/flutter/lib/src/material/ink_decoration.dart b/packages/flutter/lib/src/material/ink_decoration.dart index 1c6e484f37..57c58609f7 100644 --- a/packages/flutter/lib/src/material/ink_decoration.dart +++ b/packages/flutter/lib/src/material/ink_decoration.dart @@ -252,7 +252,7 @@ class _InkState extends State { decoration: widget.decoration, configuration: createLocalImageConfiguration(context), controller: Material.of(context), - referenceBox: context.findRenderObject(), + referenceBox: context.findRenderObject() as RenderBox, onRemoved: _handleRemoved, ); } else { diff --git a/packages/flutter/lib/src/material/ink_well.dart b/packages/flutter/lib/src/material/ink_well.dart index c2fc5c5e2f..647484218c 100644 --- a/packages/flutter/lib/src/material/ink_well.dart +++ b/packages/flutter/lib/src/material/ink_well.dart @@ -511,7 +511,7 @@ class _InkResponseState extends State with AutomaticKe } @override - void didUpdateWidget(InkResponse oldWidget) { + void didUpdateWidget(T oldWidget) { super.didUpdateWidget(oldWidget); if (_isWidgetEnabled(widget) != _isWidgetEnabled(oldWidget)) { _handleHoverChange(_hovering); @@ -565,7 +565,7 @@ class _InkResponseState extends State with AutomaticKe return; if (value) { if (highlight == null) { - final RenderBox referenceBox = context.findRenderObject(); + final RenderBox referenceBox = context.findRenderObject() as RenderBox; _highlights[type] = InkHighlight( controller: Material.of(context), referenceBox: referenceBox, @@ -603,7 +603,7 @@ class _InkResponseState extends State with AutomaticKe InteractiveInkFeature _createInkFeature(Offset globalPosition) { 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 Color color = widget.splashColor ?? Theme.of(context).splashColor; final RectCallback rectCallback = widget.containedInkWell ? widget.getRectCallback(referenceBox) : null; @@ -681,7 +681,7 @@ class _InkResponseState extends State with AutomaticKe Offset globalPosition; 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.'); globalPosition = referenceBox.localToGlobal(referenceBox.paintBounds.center); } else { diff --git a/packages/flutter/lib/src/material/input_border.dart b/packages/flutter/lib/src/material/input_border.dart index 08bc159923..e225bd969d 100644 --- a/packages/flutter/lib/src/material/input_border.dart +++ b/packages/flutter/lib/src/material/input_border.dart @@ -240,8 +240,8 @@ class UnderlineInputBorder extends InputBorder { return true; if (runtimeType != other.runtimeType) return false; - final InputBorder typedOther = other; - return typedOther.borderSide == borderSide; + return other is InputBorder + && other.borderSide == borderSide; } @override @@ -497,10 +497,10 @@ class OutlineInputBorder extends InputBorder { return true; if (runtimeType != other.runtimeType) return false; - final OutlineInputBorder typedOther = other; - return typedOther.borderSide == borderSide - && typedOther.borderRadius == borderRadius - && typedOther.gapPadding == gapPadding; + return other is OutlineInputBorder + && other.borderSide == borderSide + && other.borderRadius == borderRadius + && other.gapPadding == gapPadding; } @override diff --git a/packages/flutter/lib/src/material/input_decorator.dart b/packages/flutter/lib/src/material/input_decorator.dart index b85b9fc4e1..1ce7920716 100644 --- a/packages/flutter/lib/src/material/input_decorator.dart +++ b/packages/flutter/lib/src/material/input_decorator.dart @@ -44,8 +44,9 @@ class _InputBorderGap extends ChangeNotifier { return true; if (runtimeType != other.runtimeType) return false; - final _InputBorderGap typedOther = other; - return typedOther.start == start && typedOther.extent == extent; + return other is _InputBorderGap + && other.start == start + && other.extent == extent; } @override @@ -57,7 +58,7 @@ class _InputBorderTween extends Tween { _InputBorderTween({InputBorder begin, InputBorder end}) : super(begin: begin, end: end); @override - InputBorder lerp(double t) => ShapeBorder.lerp(begin, end, t); + InputBorder lerp(double t) => ShapeBorder.lerp(begin, end, t) as InputBorder; } // Passes the _InputBorderGap parameters along to an InputBorder's paint method. @@ -253,7 +254,7 @@ class _Shaker extends AnimatedWidget { final Widget child; - Animation get animation => listenable; + Animation get animation => listenable as Animation; double get translateX { const double shakeDelta = 4.0; @@ -529,24 +530,24 @@ class _Decoration { return true; if (other.runtimeType != runtimeType) return false; - final _Decoration typedOther = other; - return typedOther.contentPadding == contentPadding - && typedOther.floatingLabelHeight == floatingLabelHeight - && typedOther.floatingLabelProgress == floatingLabelProgress - && typedOther.border == border - && typedOther.borderGap == borderGap - && typedOther.icon == icon - && typedOther.input == input - && typedOther.label == label - && typedOther.hint == hint - && typedOther.prefix == prefix - && typedOther.suffix == suffix - && typedOther.prefixIcon == prefixIcon - && typedOther.suffixIcon == suffixIcon - && typedOther.helperError == helperError - && typedOther.counter == counter - && typedOther.container == container - && typedOther.alignLabelWithHint == alignLabelWithHint; + return other is _Decoration + && other.contentPadding == contentPadding + && other.floatingLabelHeight == floatingLabelHeight + && other.floatingLabelProgress == floatingLabelProgress + && other.border == border + && other.borderGap == borderGap + && other.icon == icon + && other.input == input + && other.label == label + && other.hint == hint + && other.prefix == prefix + && other.suffix == suffix + && other.prefixIcon == prefixIcon + && other.suffixIcon == suffixIcon + && other.helperError == helperError + && other.counter == counter + && other.container == container + && other.alignLabelWithHint == alignLabelWithHint; } @override @@ -897,9 +898,9 @@ class _RenderDecoration extends RenderBox { static Size _boxSize(RenderBox box) => box == null ? Size.zero : box.size; - static BoxParentData _boxParentData(RenderBox box) => box.parentData; + static BoxParentData _boxParentData(RenderBox box) => box.parentData as BoxParentData; - EdgeInsets get contentPadding => decoration.contentPadding; + EdgeInsets get contentPadding => decoration.contentPadding as EdgeInsets; // Lay out the given box if needed, and return its baseline. double _layoutLineBox(RenderBox box, BoxConstraints constraints) { @@ -1483,10 +1484,10 @@ class _RenderDecorationElement extends RenderObjectElement { final Map childToSlot = {}; @override - _Decorator get widget => super.widget; + _Decorator get widget => super.widget as _Decorator; @override - _RenderDecoration get renderObject => super.renderObject; + _RenderDecoration get renderObject => super.renderObject as _RenderDecoration; @override void visitChildren(ElementVisitor visitor) { @@ -1561,7 +1562,7 @@ class _RenderDecorationElement extends RenderObjectElement { _updateChild(widget.decoration.container, _DecorationSlot.container); } - void _updateRenderObject(RenderObject child, _DecorationSlot slot) { + void _updateRenderObject(RenderBox child, _DecorationSlot slot) { switch (slot) { case _DecorationSlot.icon: renderObject.icon = child; @@ -1603,8 +1604,8 @@ class _RenderDecorationElement extends RenderObjectElement { void insertChildRenderObject(RenderObject child, dynamic slotValue) { assert(child is RenderBox); assert(slotValue is _DecorationSlot); - final _DecorationSlot slot = slotValue; - _updateRenderObject(child, slot); + final _DecorationSlot slot = slotValue as _DecorationSlot; + _updateRenderObject(child as RenderBox, slot); assert(renderObject.childToSlot.keys.contains(child)); assert(renderObject.slotToChild.keys.contains(slot)); } @@ -3193,47 +3194,47 @@ class InputDecoration { return true; if (other.runtimeType != runtimeType) return false; - final InputDecoration typedOther = other; - return typedOther.icon == icon - && typedOther.labelText == labelText - && typedOther.labelStyle == labelStyle - && typedOther.helperText == helperText - && typedOther.helperStyle == helperStyle - && typedOther.helperMaxLines == helperMaxLines - && typedOther.hintText == hintText - && typedOther.hintStyle == hintStyle - && typedOther.hintMaxLines == hintMaxLines - && typedOther.errorText == errorText - && typedOther.errorStyle == errorStyle - && typedOther.errorMaxLines == errorMaxLines - && typedOther.hasFloatingPlaceholder == hasFloatingPlaceholder - && typedOther.isDense == isDense - && typedOther.contentPadding == contentPadding - && typedOther.isCollapsed == isCollapsed - && typedOther.prefixIcon == prefixIcon - && typedOther.prefix == prefix - && typedOther.prefixText == prefixText - && typedOther.prefixStyle == prefixStyle - && typedOther.suffixIcon == suffixIcon - && typedOther.suffix == suffix - && typedOther.suffixText == suffixText - && typedOther.suffixStyle == suffixStyle - && typedOther.counter == counter - && typedOther.counterText == counterText - && typedOther.counterStyle == counterStyle - && typedOther.filled == filled - && typedOther.fillColor == fillColor - && typedOther.focusColor == focusColor - && typedOther.hoverColor == hoverColor - && typedOther.errorBorder == errorBorder - && typedOther.focusedBorder == focusedBorder - && typedOther.focusedErrorBorder == focusedErrorBorder - && typedOther.disabledBorder == disabledBorder - && typedOther.enabledBorder == enabledBorder - && typedOther.border == border - && typedOther.enabled == enabled - && typedOther.semanticCounterText == semanticCounterText - && typedOther.alignLabelWithHint == alignLabelWithHint; + return other is InputDecoration + && other.icon == icon + && other.labelText == labelText + && other.labelStyle == labelStyle + && other.helperText == helperText + && other.helperStyle == helperStyle + && other.helperMaxLines == helperMaxLines + && other.hintText == hintText + && other.hintStyle == hintStyle + && other.hintMaxLines == hintMaxLines + && other.errorText == errorText + && other.errorStyle == errorStyle + && other.errorMaxLines == errorMaxLines + && other.hasFloatingPlaceholder == hasFloatingPlaceholder + && other.isDense == isDense + && other.contentPadding == contentPadding + && other.isCollapsed == isCollapsed + && other.prefixIcon == prefixIcon + && other.prefix == prefix + && other.prefixText == prefixText + && other.prefixStyle == prefixStyle + && other.suffixIcon == suffixIcon + && other.suffix == suffix + && other.suffixText == suffixText + && other.suffixStyle == suffixStyle + && other.counter == counter + && other.counterText == counterText + && other.counterStyle == counterStyle + && other.filled == filled + && other.fillColor == fillColor + && other.focusColor == focusColor + && other.hoverColor == hoverColor + && other.errorBorder == errorBorder + && other.focusedBorder == focusedBorder + && other.focusedErrorBorder == focusedErrorBorder + && other.disabledBorder == disabledBorder + && other.enabledBorder == enabledBorder + && other.border == border + && other.enabled == enabled + && other.semanticCounterText == semanticCounterText + && other.alignLabelWithHint == alignLabelWithHint; } @override @@ -3770,31 +3771,31 @@ class InputDecorationTheme extends Diagnosticable { return true; if (other.runtimeType != runtimeType) return false; - final InputDecorationTheme typedOther = other; - return typedOther.labelStyle == labelStyle - && typedOther.helperStyle == helperStyle - && typedOther.helperMaxLines == helperMaxLines - && typedOther.hintStyle == hintStyle - && typedOther.errorStyle == errorStyle - && typedOther.errorMaxLines == errorMaxLines - && typedOther.isDense == isDense - && typedOther.contentPadding == contentPadding - && typedOther.isCollapsed == isCollapsed - && typedOther.prefixStyle == prefixStyle - && typedOther.suffixStyle == suffixStyle - && typedOther.counterStyle == counterStyle - && typedOther.filled == filled - && typedOther.fillColor == fillColor - && typedOther.focusColor == focusColor - && typedOther.hoverColor == hoverColor - && typedOther.errorBorder == errorBorder - && typedOther.focusedBorder == focusedBorder - && typedOther.focusedErrorBorder == focusedErrorBorder - && typedOther.disabledBorder == disabledBorder - && typedOther.enabledBorder == enabledBorder - && typedOther.border == border - && typedOther.alignLabelWithHint == alignLabelWithHint - && typedOther.disabledBorder == disabledBorder; + return other is InputDecorationTheme + && other.labelStyle == labelStyle + && other.helperStyle == helperStyle + && other.helperMaxLines == helperMaxLines + && other.hintStyle == hintStyle + && other.errorStyle == errorStyle + && other.errorMaxLines == errorMaxLines + && other.isDense == isDense + && other.contentPadding == contentPadding + && other.isCollapsed == isCollapsed + && other.prefixStyle == prefixStyle + && other.suffixStyle == suffixStyle + && other.counterStyle == counterStyle + && other.filled == filled + && other.fillColor == fillColor + && other.focusColor == focusColor + && other.hoverColor == hoverColor + && other.errorBorder == errorBorder + && other.focusedBorder == focusedBorder + && other.focusedErrorBorder == focusedErrorBorder + && other.disabledBorder == disabledBorder + && other.enabledBorder == enabledBorder + && other.border == border + && other.alignLabelWithHint == alignLabelWithHint + && other.disabledBorder == disabledBorder; } @override diff --git a/packages/flutter/lib/src/material/list_tile.dart b/packages/flutter/lib/src/material/list_tile.dart index 24894f4ccc..93836a277b 100644 --- a/packages/flutter/lib/src/material/list_tile.dart +++ b/packages/flutter/lib/src/material/list_tile.dart @@ -975,10 +975,10 @@ class _ListTileElement extends RenderObjectElement { final Map childToSlot = {}; @override - _ListTile get widget => super.widget; + _ListTile get widget => super.widget as _ListTile; @override - _RenderListTile get renderObject => super.renderObject; + _RenderListTile get renderObject => super.renderObject as _RenderListTile; @override void visitChildren(ElementVisitor visitor) { @@ -1039,7 +1039,7 @@ class _ListTileElement extends RenderObjectElement { _updateChild(widget.trailing, _ListTileSlot.trailing); } - void _updateRenderObject(RenderObject child, _ListTileSlot slot) { + void _updateRenderObject(RenderBox child, _ListTileSlot slot) { switch (slot) { case _ListTileSlot.leading: renderObject.leading = child; @@ -1060,8 +1060,8 @@ class _ListTileElement extends RenderObjectElement { void insertChildRenderObject(RenderObject child, dynamic slotValue) { assert(child is RenderBox); assert(slotValue is _ListTileSlot); - final _ListTileSlot slot = slotValue; - _updateRenderObject(child, slot); + final _ListTileSlot slot = slotValue as _ListTileSlot; + _updateRenderObject(child as RenderBox, slot); assert(renderObject.childToSlot.keys.contains(child)); assert(renderObject.slotToChild.keys.contains(slot)); } @@ -1303,7 +1303,7 @@ class _RenderListTile extends RenderBox { @override double computeDistanceToActualBaseline(TextBaseline baseline) { assert(title != null); - final BoxParentData parentData = title.parentData; + final BoxParentData parentData = title.parentData as BoxParentData; return parentData.offset.dy + title.getDistanceToActualBaseline(baseline); } @@ -1319,7 +1319,7 @@ class _RenderListTile extends RenderBox { } static void _positionBox(RenderBox box, Offset offset) { - final BoxParentData parentData = box.parentData; + final BoxParentData parentData = box.parentData as BoxParentData; parentData.offset = offset; } @@ -1463,7 +1463,7 @@ class _RenderListTile extends RenderBox { void paint(PaintingContext context, Offset offset) { void doPaint(RenderBox child) { if (child != null) { - final BoxParentData parentData = child.parentData; + final BoxParentData parentData = child.parentData as BoxParentData; context.paintChild(child, parentData.offset + offset); } } @@ -1480,7 +1480,7 @@ class _RenderListTile extends RenderBox { bool hitTestChildren(BoxHitTestResult result, { @required Offset position }) { assert(position != null); for (RenderBox child in _children) { - final BoxParentData parentData = child.parentData; + final BoxParentData parentData = child.parentData as BoxParentData; final bool isHit = result.addWithPaintOffset( offset: parentData.offset, position: position, diff --git a/packages/flutter/lib/src/material/material.dart b/packages/flutter/lib/src/material/material.dart index 1a87eec523..679542476b 100644 --- a/packages/flutter/lib/src/material/material.dart +++ b/packages/flutter/lib/src/material/material.dart @@ -358,7 +358,7 @@ class _MaterialState extends State with TickerProviderStateMixin { } contents = NotificationListener( onNotification: (LayoutChangedNotification notification) { - final _RenderInkFeatures renderer = _inkFeatureRenderer.currentContext.findRenderObject(); + final _RenderInkFeatures renderer = _inkFeatureRenderer.currentContext.findRenderObject() as _RenderInkFeatures; renderer._didChangeLayout(); return false; }, @@ -575,7 +575,7 @@ abstract class InkFeature { this.onRemoved, }) : assert(controller != null), assert(referenceBox != null), - _controller = controller; + _controller = controller as _RenderInkFeatures; /// The [MaterialInkController] associated with this [InkFeature]. /// @@ -612,7 +612,7 @@ abstract class InkFeature { final List descendants = [referenceBox]; RenderObject node = referenceBox; while (node != _controller) { - node = node.parent; + node = node.parent as RenderObject; assert(node != null); descendants.add(node); } @@ -734,9 +734,21 @@ class _MaterialInteriorState extends AnimatedWidgetBaseState<_MaterialInterior> @override void forEachTween(TweenVisitor visitor) { - _elevation = visitor(_elevation, widget.elevation, (dynamic value) => Tween(begin: value)); - _shadowColor = visitor(_shadowColor, widget.shadowColor, (dynamic value) => ColorTween(begin: value)); - _border = visitor(_border, widget.shape, (dynamic value) => ShapeBorderTween(begin: value)); + _elevation = visitor( + _elevation, + widget.elevation, + (dynamic value) => Tween(begin: value as double), + ) as Tween; + _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 diff --git a/packages/flutter/lib/src/material/mergeable_material.dart b/packages/flutter/lib/src/material/mergeable_material.dart index 021122c36f..b87251f193 100644 --- a/packages/flutter/lib/src/material/mergeable_material.dart +++ b/packages/flutter/lib/src/material/mergeable_material.dart @@ -164,9 +164,10 @@ class _MergeableMaterialState extends State with TickerProvid _children = List.from(widget.children); for (int i = 0; i < _children.length; i += 1) { - if (_children[i] is MaterialGap) { - _initGap(_children[i]); - _animationTuples[_children[i].key].controller.value = 1.0; // Gaps are initially full-sized. + final MergeableMaterialItem child = _children[i]; + if (child is MaterialGap) { + _initGap(child); + _animationTuples[child.key].controller.value = 1.0; // Gaps are initially full-sized. } } assert(_debugGapsAreValid(_children)); @@ -323,8 +324,9 @@ class _MergeableMaterialState extends State with TickerProvid double gapSizeSum = 0.0; while (startOld < j) { - if (_children[startOld] is MaterialGap) { - final MaterialGap gap = _children[startOld]; + final MergeableMaterialItem child = _children[startOld]; + if (child is MaterialGap) { + final MaterialGap gap = child; gapSizeSum += gap.size; } @@ -364,21 +366,19 @@ class _MergeableMaterialState extends State with TickerProvid double gapSizeSum = 0.0; for (int k = startNew; k < i; k += 1) { - if (newChildren[k] is MaterialGap) { - final MaterialGap gap = newChildren[k]; - gapSizeSum += gap.size; + final MergeableMaterialItem newChild = newChildren[k]; + if (newChild is MaterialGap) { + gapSizeSum += newChild.size; } } // All gaps get proportional sizes of the original gap and they will // animate to their actual size. for (int k = startNew; k < i; k += 1) { - if (newChildren[k] is MaterialGap) { - final MaterialGap gap = newChildren[k]; - - _animationTuples[gap.key].gapStart = gapSize * gap.size / - gapSizeSum; - _animationTuples[gap.key].controller + final MergeableMaterialItem newChild = newChildren[k]; + if (newChild is MaterialGap) { + _animationTuples[newChild.key].gapStart = gapSize * newChild.size / gapSizeSum; + _animationTuples[newChild.key].controller ..value = 0.0 ..forward(); } @@ -387,11 +387,12 @@ class _MergeableMaterialState extends State with TickerProvid } else { // Grow gaps. for (int k = 0; k < newLength; k += 1) { - _insertChild(startOld + k, newChildren[startNew + k]); + final MergeableMaterialItem newChild = newChildren[startNew + k]; - if (newChildren[startNew + k] is MaterialGap) { - final MaterialGap gap = newChildren[startNew + k]; - _animationTuples[gap.key].controller.forward(); + _insertChild(startOld + k, newChild); + + if (newChild is MaterialGap) { + _animationTuples[newChild.key].controller.forward(); } } @@ -404,9 +405,9 @@ class _MergeableMaterialState extends State with TickerProvid double gapSizeSum = 0.0; while (startOld < j) { - if (_children[startOld] is MaterialGap) { - final MaterialGap gap = _children[startOld]; - gapSizeSum += gap.size; + final MergeableMaterialItem child = _children[startOld]; + if (child is MaterialGap) { + gapSizeSum += child.size; } _removeChild(startOld); @@ -428,7 +429,7 @@ class _MergeableMaterialState extends State with TickerProvid } } else if (oldLength == 1) { // Shrink gap. - final MaterialGap gap = _children[startOld]; + final MaterialGap gap = _children[startOld] as MaterialGap; _animationTuples[gap.key].gapStart = 0.0; _animationTuples[gap.key].controller.reverse(); } @@ -498,7 +499,7 @@ class _MergeableMaterialState extends State with TickerProvid } double _getGapSize(int index) { - final MaterialGap gap = _children[index]; + final MaterialGap gap = _children[index] as MaterialGap; return lerpDouble( _animationTuples[gap.key].gapStart, @@ -548,7 +549,7 @@ class _MergeableMaterialState extends State with TickerProvid ), ); } else { - final MaterialSlice slice = _children[i]; + final MaterialSlice slice = _children[i] as MaterialSlice; Widget child = slice.child; if (widget.hasDividers) { @@ -631,10 +632,8 @@ class _MergeableMaterialSliceKey extends GlobalKey { @override bool operator ==(dynamic other) { - if (other is! _MergeableMaterialSliceKey) - return false; - final _MergeableMaterialSliceKey typedOther = other; - return value == typedOther.value; + return other is _MergeableMaterialSliceKey + && other.value == value; } @override @@ -671,7 +670,7 @@ class _MergeableMaterialListBody extends ListBody { @override void updateRenderObject(BuildContext context, RenderListBody renderObject) { - final _RenderMergeableMaterialListBody materialRenderListBody = renderObject; + final _RenderMergeableMaterialListBody materialRenderListBody = renderObject as _RenderMergeableMaterialListBody; materialRenderListBody ..axisDirection = _getDirection(context) ..boxShadows = boxShadows; @@ -705,7 +704,7 @@ class _RenderMergeableMaterialListBody extends RenderListBody { int i = 0; while (child != null) { - final ListBodyParentData childParentData = child.parentData; + final ListBodyParentData childParentData = child.parentData as ListBodyParentData; final Rect rect = (childParentData.offset + offset) & child.size; if (i % 2 == 0) _paintShadows(context.canvas, rect); diff --git a/packages/flutter/lib/src/material/outline_button.dart b/packages/flutter/lib/src/material/outline_button.dart index ce46e99811..0b8cd05c60 100644 --- a/packages/flutter/lib/src/material/outline_button.dart +++ b/packages/flutter/lib/src/material/outline_button.dart @@ -557,8 +557,9 @@ class _OutlineBorder extends ShapeBorder implements MaterialStateProperty(_all(builders), _all(typedOther.builders)); + return other is PageTransitionsTheme + && listEquals(_all(other.builders), _all(builders)); } @override diff --git a/packages/flutter/lib/src/material/paginated_data_table.dart b/packages/flutter/lib/src/material/paginated_data_table.dart index fc25db19f8..50147a48a0 100644 --- a/packages/flutter/lib/src/material/paginated_data_table.dart +++ b/packages/flutter/lib/src/material/paginated_data_table.dart @@ -226,7 +226,7 @@ class PaginatedDataTableState extends State { @override void 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); _handleDataSourceChanged(); } @@ -382,7 +382,7 @@ class PaginatedDataTableState extends State { alignment: AlignmentDirectional.centerEnd, child: DropdownButtonHideUnderline( child: DropdownButton( - items: availableRowsPerPage, + items: availableRowsPerPage.cast>(), value: widget.rowsPerPage, onChanged: widget.onRowsPerPageChanged, style: footerTextStyle, diff --git a/packages/flutter/lib/src/material/popup_menu.dart b/packages/flutter/lib/src/material/popup_menu.dart index d19f9cf445..a04a8ebc32 100644 --- a/packages/flutter/lib/src/material/popup_menu.dart +++ b/packages/flutter/lib/src/material/popup_menu.dart @@ -159,7 +159,7 @@ class _RenderMenuItem extends RenderShiftedBox { child.layout(constraints, parentUsesSize: true); size = constraints.constrain(child.size); } - final BoxParentData childParentData = child.parentData; + final BoxParentData childParentData = child.parentData as BoxParentData; childParentData.offset = Offset.zero; onLayout(size); } @@ -490,7 +490,7 @@ class _PopupMenu extends StatelessWidget { for (int i = 0; i < route.items.length; i += 1) { 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( parent: route.animation, curve: Interval(start, end), @@ -591,7 +591,9 @@ class _PopupMenuRouteLayout extends SingleChildLayoutDelegate { BoxConstraints getConstraintsForChild(BoxConstraints constraints) { // The menu can be at most the size of the overlay minus 8.0 pixels in each // 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 @@ -677,7 +679,7 @@ class _PopupMenuRoute extends PopupRoute { final RelativeRect position; final List> items; final List itemSizes; - final dynamic initialValue; + final T initialValue; final double elevation; final ThemeData theme; final String semanticLabel; @@ -1041,8 +1043,8 @@ class PopupMenuButton extends StatefulWidget { class _PopupMenuButtonState extends State> { void showButtonMenu() { final PopupMenuThemeData popupMenuTheme = PopupMenuTheme.of(context); - final RenderBox button = context.findRenderObject(); - final RenderBox overlay = Overlay.of(context).context.findRenderObject(); + final RenderBox button = context.findRenderObject() as RenderBox; + final RenderBox overlay = Overlay.of(context).context.findRenderObject() as RenderBox; final RelativeRect position = RelativeRect.fromRect( Rect.fromPoints( button.localToGlobal(widget.offset, ancestor: overlay), diff --git a/packages/flutter/lib/src/material/popup_menu_theme.dart b/packages/flutter/lib/src/material/popup_menu_theme.dart index e7430df901..45df40745f 100644 --- a/packages/flutter/lib/src/material/popup_menu_theme.dart +++ b/packages/flutter/lib/src/material/popup_menu_theme.dart @@ -99,11 +99,11 @@ class PopupMenuThemeData extends Diagnosticable { return true; if (other.runtimeType != runtimeType) return false; - final PopupMenuThemeData typedOther = other; - return typedOther.elevation == elevation - && typedOther.color == color - && typedOther.shape == shape - && typedOther.textStyle == textStyle; + return other is PopupMenuThemeData + && other.elevation == elevation + && other.color == color + && other.shape == shape + && other.textStyle == textStyle; } @override diff --git a/packages/flutter/lib/src/material/progress_indicator.dart b/packages/flutter/lib/src/material/progress_indicator.dart index 9b0b5b83fe..1e4b94e4a1 100644 --- a/packages/flutter/lib/src/material/progress_indicator.dart +++ b/packages/flutter/lib/src/material/progress_indicator.dart @@ -181,7 +181,7 @@ class _LinearProgressIndicatorPainter extends CustomPainter { } 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 { final double x1 = size.width * line1Tail.transform(animationValue); final double width1 = size.width * line1Head.transform(animationValue) - x1; @@ -331,7 +331,7 @@ class _CircularProgressIndicatorPainter extends CustomPainter { ? _startAngle : _startAngle + tailValue * 3 / 2 * math.pi + rotationValue * math.pi * 1.7 - stepValue * 0.8 * math.pi, 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); final Color backgroundColor; @@ -646,7 +646,7 @@ class _RefreshProgressIndicatorState extends _CircularProgressIndicatorState { @override 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( context: context, child: Container( diff --git a/packages/flutter/lib/src/material/range_slider.dart b/packages/flutter/lib/src/material/range_slider.dart index af65f33a10..cc4589e336 100644 --- a/packages/flutter/lib/src/material/range_slider.dart +++ b/packages/flutter/lib/src/material/range_slider.dart @@ -993,7 +993,7 @@ class _RenderRangeSlider extends RenderBox with RelayoutWhenSystemFontsChangeMix } double _discretize(double value) { - double result = value.clamp(0.0, 1.0); + double result = value.clamp(0.0, 1.0) as double; if (isDiscrete) { result = (result * divisions).round() / divisions; } @@ -1005,7 +1005,7 @@ class _RenderRangeSlider extends RenderBox with RelayoutWhenSystemFontsChangeMix } 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); if (_lastThumbSelection != null) { @@ -1408,10 +1408,10 @@ class _RenderRangeSlider extends RenderBox with RelayoutWhenSystemFontsChangeMix } 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) { - return (value - _semanticActionUnit).clamp(0.0, 1.0); + return (value - _semanticActionUnit).clamp(0.0, 1.0) as double; } } diff --git a/packages/flutter/lib/src/material/refresh_indicator.dart b/packages/flutter/lib/src/material/refresh_indicator.dart index 52b303b210..b1363acc75 100644 --- a/packages/flutter/lib/src/material/refresh_indicator.dart +++ b/packages/flutter/lib/src/material/refresh_indicator.dart @@ -304,7 +304,7 @@ class RefreshIndicatorState extends State with TickerProviderS double newValue = _dragOffset / (containerExtent * _kDragContainerExtentPercentage); if (_mode == _RefreshIndicatorMode.armed) 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) _mode = _RefreshIndicatorMode.armed; } diff --git a/packages/flutter/lib/src/material/scaffold.dart b/packages/flutter/lib/src/material/scaffold.dart index 9576a806c1..25dc389f8e 100644 --- a/packages/flutter/lib/src/material/scaffold.dart +++ b/packages/flutter/lib/src/material/scaffold.dart @@ -317,9 +317,9 @@ class _BodyBoxConstraints extends BoxConstraints { bool operator ==(dynamic other) { if (super != other) return false; - final _BodyBoxConstraints typedOther = other; - return bottomWidgetsHeight == typedOther.bottomWidgetsHeight - && appBarHeight == typedOther.appBarHeight; + return other is _BodyBoxConstraints + && other.bottomWidgetsHeight == bottomWidgetsHeight + && other.appBarHeight == appBarHeight; } @override @@ -356,7 +356,7 @@ class _BodyBuilder extends StatelessWidget { return LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { - final _BodyBoxConstraints bodyConstraints = constraints; + final _BodyBoxConstraints bodyConstraints = constraints as _BodyBoxConstraints; final MediaQueryData metrics = MediaQuery.of(context); final double bottom = extendBody @@ -741,10 +741,8 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr } bool _isExtendedFloatingActionButton(Widget widget) { - if (widget is! FloatingActionButton) - return false; - final FloatingActionButton fab = widget; - return fab.isExtended; + return widget is FloatingActionButton + && widget.isExtended; } @override @@ -1897,7 +1895,7 @@ class ScaffoldState extends State with TickerProviderStateMixin { clipBehavior: clipBehavior, ); }); - return _currentBottomSheet; + return _currentBottomSheet as PersistentBottomSheetController; } // Floating Action Button API @@ -1919,7 +1917,7 @@ class ScaffoldState extends State with TickerProviderStateMixin { _floatingActionButtonVisibilityController.value = newValue.clamp( _floatingActionButtonVisibilityController.lowerBound, _floatingActionButtonVisibilityController.upperBound, - ); + ) as double; } /// Shows the [Scaffold.floatingActionButton]. diff --git a/packages/flutter/lib/src/material/slider.dart b/packages/flutter/lib/src/material/slider.dart index 1a805f86b9..17ec4a85db 100644 --- a/packages/flutter/lib/src/material/slider.dart +++ b/packages/flutter/lib/src/material/slider.dart @@ -962,7 +962,7 @@ class _RenderSlider extends RenderBox with RelayoutWhenSystemFontsChangeMixin { } double _discretize(double value) { - double result = value.clamp(0.0, 1.0); + double result = value.clamp(0.0, 1.0) as double; if (isDiscrete) { result = (result * divisions).round() / divisions; } @@ -1191,8 +1191,8 @@ class _RenderSlider extends RenderBox with RelayoutWhenSystemFontsChangeMixin { config.onDecrease = _decreaseAction; if (semanticFormatterCallback != null) { config.value = semanticFormatterCallback(_state._lerp(value)); - config.increasedValue = semanticFormatterCallback(_state._lerp((value + _semanticActionUnit).clamp(0.0, 1.0))); - config.decreasedValue = 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) as double)); } else { config.value = '${(value * 100).round()}%'; config.increasedValue = '${((value + _semanticActionUnit).clamp(0.0, 1.0) * 100).round()}%'; @@ -1205,13 +1205,13 @@ class _RenderSlider extends RenderBox with RelayoutWhenSystemFontsChangeMixin { void _increaseAction() { if (isInteractive) { - onChanged((value + _semanticActionUnit).clamp(0.0, 1.0)); + onChanged((value + _semanticActionUnit).clamp(0.0, 1.0) as double); } } void _decreaseAction() { if (isInteractive) { - onChanged((value - _semanticActionUnit).clamp(0.0, 1.0)); + onChanged((value - _semanticActionUnit).clamp(0.0, 1.0) as double); } } } diff --git a/packages/flutter/lib/src/material/slider_theme.dart b/packages/flutter/lib/src/material/slider_theme.dart index 3c573aae83..a933dc4347 100644 --- a/packages/flutter/lib/src/material/slider_theme.dart +++ b/packages/flutter/lib/src/material/slider_theme.dart @@ -780,34 +780,34 @@ class SliderThemeData extends Diagnosticable { if (other.runtimeType != runtimeType) { return false; } - final SliderThemeData otherData = other; - return otherData.trackHeight == trackHeight - && otherData.activeTrackColor == activeTrackColor - && otherData.inactiveTrackColor == inactiveTrackColor - && otherData.disabledActiveTrackColor == disabledActiveTrackColor - && otherData.disabledInactiveTrackColor == disabledInactiveTrackColor - && otherData.activeTickMarkColor == activeTickMarkColor - && otherData.inactiveTickMarkColor == inactiveTickMarkColor - && otherData.disabledActiveTickMarkColor == disabledActiveTickMarkColor - && otherData.disabledInactiveTickMarkColor == disabledInactiveTickMarkColor - && otherData.thumbColor == thumbColor - && otherData.overlappingShapeStrokeColor == overlappingShapeStrokeColor - && otherData.disabledThumbColor == disabledThumbColor - && otherData.overlayColor == overlayColor - && otherData.valueIndicatorColor == valueIndicatorColor - && otherData.overlayShape == overlayShape - && otherData.tickMarkShape == tickMarkShape - && otherData.thumbShape == thumbShape - && otherData.trackShape == trackShape - && otherData.valueIndicatorShape == valueIndicatorShape - && otherData.rangeTickMarkShape == rangeTickMarkShape - && otherData.rangeThumbShape == rangeThumbShape - && otherData.rangeTrackShape == rangeTrackShape - && otherData.rangeValueIndicatorShape == rangeValueIndicatorShape - && otherData.showValueIndicator == showValueIndicator - && otherData.valueIndicatorTextStyle == valueIndicatorTextStyle - && otherData.minThumbSeparation == minThumbSeparation - && otherData.thumbSelector == thumbSelector; + return other is SliderThemeData + && other.trackHeight == trackHeight + && other.activeTrackColor == activeTrackColor + && other.inactiveTrackColor == inactiveTrackColor + && other.disabledActiveTrackColor == disabledActiveTrackColor + && other.disabledInactiveTrackColor == disabledInactiveTrackColor + && other.activeTickMarkColor == activeTickMarkColor + && other.inactiveTickMarkColor == inactiveTickMarkColor + && other.disabledActiveTickMarkColor == disabledActiveTickMarkColor + && other.disabledInactiveTickMarkColor == disabledInactiveTickMarkColor + && other.thumbColor == thumbColor + && other.overlappingShapeStrokeColor == overlappingShapeStrokeColor + && other.disabledThumbColor == disabledThumbColor + && other.overlayColor == overlayColor + && other.valueIndicatorColor == valueIndicatorColor + && other.overlayShape == overlayShape + && other.tickMarkShape == tickMarkShape + && other.thumbShape == thumbShape + && other.trackShape == trackShape + && other.valueIndicatorShape == valueIndicatorShape + && other.rangeTickMarkShape == rangeTickMarkShape + && other.rangeThumbShape == rangeThumbShape + && other.rangeTrackShape == rangeTrackShape + && other.rangeValueIndicatorShape == rangeValueIndicatorShape + && other.showValueIndicator == showValueIndicator + && other.valueIndicatorTextStyle == valueIndicatorTextStyle + && other.minThumbSeparation == minThumbSeparation + && other.thumbSelector == thumbSelector; } @override @@ -2768,8 +2768,8 @@ class _PaddleSliderTrackShapePathPainter { // the top neck arc. We use this to shrink/expand it based on the scale // factor of the value indicator. final double neckStretchBaseline = math.max(0.0, rightBottomNeckCenterY - math.max(leftTopNeckCenter.dy, neckRightCenter.dy)); - final double t = math.pow(inverseTextScale, 3.0); - final double stretch = (neckStretchBaseline * t).clamp(0.0, 10.0 * neckStretchBaseline); + final double t = math.pow(inverseTextScale, 3.0) as double; + final double stretch = (neckStretchBaseline * t).clamp(0.0, 10.0 * neckStretchBaseline) as double; final Offset neckStretch = Offset(0.0, neckStretchBaseline - stretch); assert(!_debuggingLabelLocation || () { @@ -2886,9 +2886,9 @@ class RangeValues { bool operator ==(Object other) { if (other.runtimeType != runtimeType) return false; - final RangeValues typedOther = other; - return typedOther.start == start - && typedOther.end == end; + return other is RangeValues + && other.start == start + && other.end == end; } @override @@ -2925,9 +2925,9 @@ class RangeLabels { bool operator ==(Object other) { if (other.runtimeType != runtimeType) return false; - final RangeLabels typedOther = other; - return typedOther.start == start - && typedOther.end == end; + return other is RangeLabels + && other.start == start + && other.end == end; } @override diff --git a/packages/flutter/lib/src/material/snack_bar_theme.dart b/packages/flutter/lib/src/material/snack_bar_theme.dart index e0ae74309d..a5281f037b 100644 --- a/packages/flutter/lib/src/material/snack_bar_theme.dart +++ b/packages/flutter/lib/src/material/snack_bar_theme.dart @@ -161,14 +161,14 @@ class SnackBarThemeData extends Diagnosticable { return true; if (other.runtimeType != runtimeType) return false; - final SnackBarThemeData typedOther = other; - return typedOther.backgroundColor == backgroundColor - && typedOther.actionTextColor == actionTextColor - && typedOther.disabledActionTextColor == disabledActionTextColor - && typedOther.contentTextStyle == contentTextStyle - && typedOther.elevation == elevation - && typedOther.shape == shape - && typedOther.behavior == behavior; + return other is SnackBarThemeData + && other.backgroundColor == backgroundColor + && other.actionTextColor == actionTextColor + && other.disabledActionTextColor == disabledActionTextColor + && other.contentTextStyle == contentTextStyle + && other.elevation == elevation + && other.shape == shape + && other.behavior == behavior; } @override diff --git a/packages/flutter/lib/src/material/tab_bar_theme.dart b/packages/flutter/lib/src/material/tab_bar_theme.dart index 5da835f578..69963d83cf 100644 --- a/packages/flutter/lib/src/material/tab_bar_theme.dart +++ b/packages/flutter/lib/src/material/tab_bar_theme.dart @@ -96,7 +96,7 @@ class TabBarTheme extends Diagnosticable { indicator: Decoration.lerp(a.indicator, b.indicator, t), indicatorSize: t < 0.5 ? a.indicatorSize : b.indicatorSize, 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), unselectedLabelColor: Color.lerp(a.unselectedLabelColor, b.unselectedLabelColor, t), unselectedLabelStyle: TextStyle.lerp(a.unselectedLabelStyle, b.unselectedLabelStyle, t), @@ -122,13 +122,13 @@ class TabBarTheme extends Diagnosticable { return true; if (other.runtimeType != runtimeType) return false; - final TabBarTheme typedOther = other; - return typedOther.indicator == indicator - && typedOther.indicatorSize == indicatorSize - && typedOther.labelColor == labelColor - && typedOther.labelPadding == labelPadding - && typedOther.labelStyle == labelStyle - && typedOther.unselectedLabelColor == unselectedLabelColor - && typedOther.unselectedLabelStyle == unselectedLabelStyle; + return other is TabBarTheme + && other.indicator == indicator + && other.indicatorSize == indicatorSize + && other.labelColor == labelColor + && other.labelPadding == labelPadding + && other.labelStyle == labelStyle + && other.unselectedLabelColor == unselectedLabelColor + && other.unselectedLabelStyle == unselectedLabelStyle; } } diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart index 28973bfa69..2f98945b2d 100644 --- a/packages/flutter/lib/src/material/tabs.dart +++ b/packages/flutter/lib/src/material/tabs.dart @@ -156,7 +156,7 @@ class _TabStyle extends AnimatedWidget { Widget build(BuildContext context) { final ThemeData themeData = Theme.of(context); final TabBarTheme tabBarTheme = TabBarTheme.of(context); - final Animation animation = listenable; + final Animation animation = listenable as Animation; // To enable TextStyle.lerp(style1, style2, value), both styles must have // the same value of inherit. Force that to be inherit=true here. @@ -232,7 +232,7 @@ class _TabLabelBarRenderer extends RenderFlex { RenderBox child = firstChild; final List xOffsets = []; while (child != null) { - final FlexParentData childParentData = child.parentData; + final FlexParentData childParentData = child.parentData as FlexParentData; xOffsets.add(childParentData.offset.dx); assert(child.parentData == childParentData); child = childParentData.nextSibling; @@ -298,7 +298,7 @@ double _indexChangeProgress(TabController controller) { // The controller's offset is changing because the user is dragging the // TabBarView's PageView to the left or right. 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. return (controllerValue - currentIndex).abs() / (currentIndex - previousIndex).abs(); @@ -489,7 +489,7 @@ class _DragAnimation extends Animation with AnimationWithParentMixin { case TextDirection.ltr: break; } - return (tabCenter - viewportWidth / 2.0).clamp(minExtent, maxExtent); + return (tabCenter - viewportWidth / 2.0).clamp(minExtent, maxExtent) as double; } double _tabCenteredScrollOffset(int index) { @@ -1302,7 +1302,7 @@ class _TabBarViewState extends State { _controller.index = _pageController.page.floor(); _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) { _controller.index = _pageController.page.round(); _currentIndex = _controller.index; diff --git a/packages/flutter/lib/src/material/text_field.dart b/packages/flutter/lib/src/material/text_field.dart index c7fa57ea15..6de97f7b38 100644 --- a/packages/flutter/lib/src/material/text_field.dart +++ b/packages/flutter/lib/src/material/text_field.dart @@ -782,7 +782,7 @@ class _TextFieldState extends State implements TextSelectionGestureDe if (widget.maxLength > 0) { // Show the maxLength in the counter 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); // Handle length exceeds maxLength diff --git a/packages/flutter/lib/src/material/text_form_field.dart b/packages/flutter/lib/src/material/text_form_field.dart index 21b703c55e..b4bba24e90 100644 --- a/packages/flutter/lib/src/material/text_form_field.dart +++ b/packages/flutter/lib/src/material/text_form_field.dart @@ -152,7 +152,7 @@ class TextFormField extends FormField { autovalidate: autovalidate, enabled: enabled, builder: (FormFieldState field) { - final _TextFormFieldState state = field; + final _TextFormFieldState state = field as _TextFormFieldState; final InputDecoration effectiveDecoration = (decoration ?? const InputDecoration()) .applyDefaults(Theme.of(field.context).inputDecorationTheme); void onChangedHandler(String value) { @@ -218,7 +218,7 @@ class _TextFormFieldState extends FormFieldState { TextEditingController get _effectiveController => widget.controller ?? _controller; @override - TextFormField get widget => super.widget; + TextFormField get widget => super.widget as TextFormField; @override void initState() { diff --git a/packages/flutter/lib/src/material/text_theme.dart b/packages/flutter/lib/src/material/text_theme.dart index 98b6a6ca4b..afa92bf432 100644 --- a/packages/flutter/lib/src/material/text_theme.dart +++ b/packages/flutter/lib/src/material/text_theme.dart @@ -481,20 +481,20 @@ class TextTheme extends Diagnosticable { return true; if (other.runtimeType != runtimeType) return false; - final TextTheme typedOther = other; - return display4 == typedOther.display4 - && display3 == typedOther.display3 - && display2 == typedOther.display2 - && display1 == typedOther.display1 - && headline == typedOther.headline - && title == typedOther.title - && subhead == typedOther.subhead - && body2 == typedOther.body2 - && body1 == typedOther.body1 - && caption == typedOther.caption - && button == typedOther.button - && subtitle == typedOther.subtitle - && overline == typedOther.overline; + return other is TextTheme + && other.display4 == display4 + && other.display3 == display3 + && other.display2 == display2 + && other.display1 == display1 + && other.headline == headline + && other.title == title + && other.subhead == subhead + && other.body2 == body2 + && other.body1 == body1 + && other.caption == caption + && other.button == button + && other.subtitle == subtitle + && other.overline == overline; } @override diff --git a/packages/flutter/lib/src/material/theme.dart b/packages/flutter/lib/src/material/theme.dart index 812cc2da87..9c2c9229ac 100644 --- a/packages/flutter/lib/src/material/theme.dart +++ b/packages/flutter/lib/src/material/theme.dart @@ -254,7 +254,7 @@ class _AnimatedThemeState extends AnimatedWidgetBaseState { @override void forEachTween(TweenVisitor visitor) { // 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); } diff --git a/packages/flutter/lib/src/material/theme_data.dart b/packages/flutter/lib/src/material/theme_data.dart index e642a19219..e151810bc7 100644 --- a/packages/flutter/lib/src/material/theme_data.dart +++ b/packages/flutter/lib/src/material/theme_data.dart @@ -1297,71 +1297,71 @@ class ThemeData extends Diagnosticable { bool operator ==(Object other) { if (other.runtimeType != runtimeType) return false; - final ThemeData otherData = other; // 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 // the class and in the lerp() method. - return (otherData.brightness == brightness) && - (otherData.visualDensity == visualDensity) && - (otherData.primaryColor == primaryColor) && - (otherData.primaryColorBrightness == primaryColorBrightness) && - (otherData.primaryColorLight == primaryColorLight) && - (otherData.primaryColorDark == primaryColorDark) && - (otherData.accentColor == accentColor) && - (otherData.accentColorBrightness == accentColorBrightness) && - (otherData.canvasColor == canvasColor) && - (otherData.scaffoldBackgroundColor == scaffoldBackgroundColor) && - (otherData.bottomAppBarColor == bottomAppBarColor) && - (otherData.cardColor == cardColor) && - (otherData.dividerColor == dividerColor) && - (otherData.highlightColor == highlightColor) && - (otherData.splashColor == splashColor) && - (otherData.splashFactory == splashFactory) && - (otherData.selectedRowColor == selectedRowColor) && - (otherData.unselectedWidgetColor == unselectedWidgetColor) && - (otherData.disabledColor == disabledColor) && - (otherData.buttonTheme == buttonTheme) && - (otherData.buttonColor == buttonColor) && - (otherData.toggleButtonsTheme == toggleButtonsTheme) && - (otherData.secondaryHeaderColor == secondaryHeaderColor) && - (otherData.textSelectionColor == textSelectionColor) && - (otherData.cursorColor == cursorColor) && - (otherData.textSelectionHandleColor == textSelectionHandleColor) && - (otherData.backgroundColor == backgroundColor) && - (otherData.dialogBackgroundColor == dialogBackgroundColor) && - (otherData.indicatorColor == indicatorColor) && - (otherData.hintColor == hintColor) && - (otherData.errorColor == errorColor) && - (otherData.toggleableActiveColor == toggleableActiveColor) && - (otherData.textTheme == textTheme) && - (otherData.primaryTextTheme == primaryTextTheme) && - (otherData.accentTextTheme == accentTextTheme) && - (otherData.inputDecorationTheme == inputDecorationTheme) && - (otherData.iconTheme == iconTheme) && - (otherData.primaryIconTheme == primaryIconTheme) && - (otherData.accentIconTheme == accentIconTheme) && - (otherData.sliderTheme == sliderTheme) && - (otherData.tabBarTheme == tabBarTheme) && - (otherData.tooltipTheme == tooltipTheme) && - (otherData.cardTheme == cardTheme) && - (otherData.chipTheme == chipTheme) && - (otherData.platform == platform) && - (otherData.materialTapTargetSize == materialTapTargetSize) && - (otherData.applyElevationOverlayColor == applyElevationOverlayColor) && - (otherData.pageTransitionsTheme == pageTransitionsTheme) && - (otherData.appBarTheme == appBarTheme) && - (otherData.bottomAppBarTheme == bottomAppBarTheme) && - (otherData.colorScheme == colorScheme) && - (otherData.dialogTheme == dialogTheme) && - (otherData.floatingActionButtonTheme == floatingActionButtonTheme) && - (otherData.typography == typography) && - (otherData.cupertinoOverrideTheme == cupertinoOverrideTheme) && - (otherData.snackBarTheme == snackBarTheme) && - (otherData.bottomSheetTheme == bottomSheetTheme) && - (otherData.popupMenuTheme == popupMenuTheme) && - (otherData.bannerTheme == bannerTheme) && - (otherData.dividerTheme == dividerTheme) && - (otherData.buttonBarTheme == buttonBarTheme); + return other is ThemeData + && other.brightness == brightness + && other.visualDensity == visualDensity + && other.primaryColor == primaryColor + && other.primaryColorBrightness == primaryColorBrightness + && other.primaryColorLight == primaryColorLight + && other.primaryColorDark == primaryColorDark + && other.accentColor == accentColor + && other.accentColorBrightness == accentColorBrightness + && other.canvasColor == canvasColor + && other.scaffoldBackgroundColor == scaffoldBackgroundColor + && other.bottomAppBarColor == bottomAppBarColor + && other.cardColor == cardColor + && other.dividerColor == dividerColor + && other.highlightColor == highlightColor + && other.splashColor == splashColor + && other.splashFactory == splashFactory + && other.selectedRowColor == selectedRowColor + && other.unselectedWidgetColor == unselectedWidgetColor + && other.disabledColor == disabledColor + && other.buttonTheme == buttonTheme + && other.buttonColor == buttonColor + && other.toggleButtonsTheme == toggleButtonsTheme + && other.secondaryHeaderColor == secondaryHeaderColor + && other.textSelectionColor == textSelectionColor + && other.cursorColor == cursorColor + && other.textSelectionHandleColor == textSelectionHandleColor + && other.backgroundColor == backgroundColor + && other.dialogBackgroundColor == dialogBackgroundColor + && other.indicatorColor == indicatorColor + && other.hintColor == hintColor + && other.errorColor == errorColor + && other.toggleableActiveColor == toggleableActiveColor + && other.textTheme == textTheme + && other.primaryTextTheme == primaryTextTheme + && other.accentTextTheme == accentTextTheme + && other.inputDecorationTheme == inputDecorationTheme + && other.iconTheme == iconTheme + && other.primaryIconTheme == primaryIconTheme + && other.accentIconTheme == accentIconTheme + && other.sliderTheme == sliderTheme + && other.tabBarTheme == tabBarTheme + && other.tooltipTheme == tooltipTheme + && other.cardTheme == cardTheme + && other.chipTheme == chipTheme + && other.platform == platform + && other.materialTapTargetSize == materialTapTargetSize + && other.applyElevationOverlayColor == applyElevationOverlayColor + && other.pageTransitionsTheme == pageTransitionsTheme + && other.appBarTheme == appBarTheme + && other.bottomAppBarTheme == bottomAppBarTheme + && other.colorScheme == colorScheme + && other.dialogTheme == dialogTheme + && other.floatingActionButtonTheme == floatingActionButtonTheme + && other.typography == typography + && other.cupertinoOverrideTheme == cupertinoOverrideTheme + && other.snackBarTheme == snackBarTheme + && other.bottomSheetTheme == bottomSheetTheme + && other.popupMenuTheme == popupMenuTheme + && other.bannerTheme == bannerTheme + && other.dividerTheme == dividerTheme + && other.buttonBarTheme == buttonBarTheme; } @override @@ -1636,8 +1636,9 @@ class _IdentityThemeDataCacheKey { bool operator ==(Object other) { // We are explicitly ignoring the possibility that the types might not // match in the interests of speed. - final _IdentityThemeDataCacheKey otherKey = other; - return identical(baseTheme, otherKey.baseTheme) && identical(localTextGeometry, otherKey.localTextGeometry); + return other is _IdentityThemeDataCacheKey + && identical(other.baseTheme, baseTheme) + && identical(other.localTextGeometry, localTextGeometry); } } @@ -1819,9 +1820,9 @@ class VisualDensity extends Diagnosticable { if (other.runtimeType != runtimeType) { return false; } - final VisualDensity typedOther = other; - return horizontal == typedOther.horizontal - && vertical == typedOther.vertical; + return other is VisualDensity + && other.horizontal == horizontal + && other.vertical == vertical; } @override diff --git a/packages/flutter/lib/src/material/time.dart b/packages/flutter/lib/src/material/time.dart index 5a31cc66c3..011895beb8 100644 --- a/packages/flutter/lib/src/material/time.dart +++ b/packages/flutter/lib/src/material/time.dart @@ -113,11 +113,9 @@ class TimeOfDay { @override bool operator ==(dynamic other) { - if (other is! TimeOfDay) - return false; - final TimeOfDay typedOther = other; - return typedOther.hour == hour - && typedOther.minute == minute; + return other is TimeOfDay + && other.hour == hour + && other.minute == minute; } @override diff --git a/packages/flutter/lib/src/material/time_picker.dart b/packages/flutter/lib/src/material/time_picker.dart index a802ed218e..b02f6917a1 100644 --- a/packages/flutter/lib/src/material/time_picker.dart +++ b/packages/flutter/lib/src/material/time_picker.dart @@ -1004,7 +1004,7 @@ class _DialPainter extends CustomPainter { final double width = labelPainter.width * _semanticNodeSizeScale; final double height = labelPainter.height * _semanticNodeSizeScale; 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( rect: Rect.fromLTRB( nodeOffset.dx - 24.0 + width / 2, @@ -1190,7 +1190,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin { _thetaTween ..begin = angle ..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; if (widget.mode == _TimePickerMode.hour && widget.use24HourDials) { if (offset.distance * 1.5 < radius) @@ -1208,7 +1208,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin { void _handlePanStart(DragStartDetails details) { assert(!_dragging); _dragging = true; - final RenderBox box = context.findRenderObject(); + final RenderBox box = context.findRenderObject() as RenderBox; _position = box.globalToLocal(details.globalPosition); _center = box.size.center(Offset.zero); _updateThetaForPan(); @@ -1235,7 +1235,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin { } void _handleTapUp(TapUpDetails details) { - final RenderBox box = context.findRenderObject(); + final RenderBox box = context.findRenderObject() as RenderBox; _position = box.globalToLocal(details.globalPosition); _center = box.size.center(Offset.zero); _updateThetaForPan(); diff --git a/packages/flutter/lib/src/material/toggle_buttons.dart b/packages/flutter/lib/src/material/toggle_buttons.dart index d88f2dca4d..4c1d4ee3fd 100644 --- a/packages/flutter/lib/src/material/toggle_buttons.dart +++ b/packages/flutter/lib/src/material/toggle_buttons.dart @@ -1061,7 +1061,7 @@ class _SelectToggleButtonRenderObject extends RenderShiftedBox { ); child.layout(innerConstraints, parentUsesSize: true); - final BoxParentData childParentData = child.parentData; + final BoxParentData childParentData = child.parentData as BoxParentData; childParentData.offset = Offset(leadingBorderSide.width, leadingBorderSide.width); size = constraints.constrain(Size( @@ -1083,7 +1083,7 @@ class _SelectToggleButtonRenderObject extends RenderShiftedBox { ); child.layout(innerConstraints, parentUsesSize: true); - final BoxParentData childParentData = child.parentData; + final BoxParentData childParentData = child.parentData as BoxParentData; if (isLastButton) { childParentData.offset = Offset(trailingBorderOffset, trailingBorderOffset); diff --git a/packages/flutter/lib/src/material/toggle_buttons_theme.dart b/packages/flutter/lib/src/material/toggle_buttons_theme.dart index 1f4da2a650..c4d4b3fab4 100644 --- a/packages/flutter/lib/src/material/toggle_buttons_theme.dart +++ b/packages/flutter/lib/src/material/toggle_buttons_theme.dart @@ -195,22 +195,22 @@ class ToggleButtonsThemeData extends Diagnosticable { return true; if (other.runtimeType != runtimeType) return false; - final ToggleButtonsThemeData typedOther = other; - return typedOther.textStyle == textStyle - && typedOther.constraints == constraints - && typedOther.color == color - && typedOther.selectedColor == selectedColor - && typedOther.disabledColor == disabledColor - && typedOther.fillColor == fillColor - && typedOther.focusColor == focusColor - && typedOther.highlightColor == highlightColor - && typedOther.hoverColor == hoverColor - && typedOther.splashColor == splashColor - && typedOther.borderColor == borderColor - && typedOther.selectedBorderColor == selectedBorderColor - && typedOther.disabledBorderColor == disabledBorderColor - && typedOther.borderRadius == borderRadius - && typedOther.borderWidth == borderWidth; + return other is ToggleButtonsThemeData + && other.textStyle == textStyle + && other.constraints == constraints + && other.color == color + && other.selectedColor == selectedColor + && other.disabledColor == disabledColor + && other.fillColor == fillColor + && other.focusColor == focusColor + && other.highlightColor == highlightColor + && other.hoverColor == hoverColor + && other.splashColor == splashColor + && other.borderColor == borderColor + && other.selectedBorderColor == selectedBorderColor + && other.disabledBorderColor == disabledBorderColor + && other.borderRadius == borderRadius + && other.borderWidth == borderWidth; } @override diff --git a/packages/flutter/lib/src/material/tooltip.dart b/packages/flutter/lib/src/material/tooltip.dart index 4dd4e78c37..792852d306 100644 --- a/packages/flutter/lib/src/material/tooltip.dart +++ b/packages/flutter/lib/src/material/tooltip.dart @@ -280,7 +280,7 @@ class _TooltipState extends State with SingleTickerProviderStateMixin { } void _createNewEntry() { - final RenderBox box = context.findRenderObject(); + final RenderBox box = context.findRenderObject() as RenderBox; final Offset target = box.localToGlobal(box.size.center(Offset.zero)); // We create this widget outside of the overlay entry's builder to prevent diff --git a/packages/flutter/lib/src/material/tooltip_theme.dart b/packages/flutter/lib/src/material/tooltip_theme.dart index a9e6fa563f..51ac275737 100644 --- a/packages/flutter/lib/src/material/tooltip_theme.dart +++ b/packages/flutter/lib/src/material/tooltip_theme.dart @@ -122,8 +122,8 @@ class TooltipThemeData extends Diagnosticable { assert(t != null); return TooltipThemeData( height: lerpDouble(a?.height, b?.height, t), - padding: EdgeInsets.lerp(a?.padding, b?.padding, t), - margin: EdgeInsets.lerp(a?.margin, b?.margin, t), + padding: EdgeInsetsGeometry.lerp(a?.padding, b?.padding, t), + margin: EdgeInsetsGeometry.lerp(a?.margin, b?.margin, t), verticalOffset: lerpDouble(a?.verticalOffset, b?.verticalOffset, t), preferBelow: t < 0.5 ? a.preferBelow: b.preferBelow, excludeFromSemantics: t < 0.5 ? a.excludeFromSemantics : b.excludeFromSemantics, @@ -154,17 +154,17 @@ class TooltipThemeData extends Diagnosticable { return true; if (other.runtimeType != runtimeType) return false; - final TooltipThemeData typedOther = other; - return typedOther.height == height - && typedOther.padding == padding - && typedOther.margin == margin - && typedOther.verticalOffset == verticalOffset - && typedOther.preferBelow == preferBelow - && typedOther.excludeFromSemantics == excludeFromSemantics - && typedOther.decoration == decoration - && typedOther.textStyle == textStyle - && typedOther.waitDuration == waitDuration - && typedOther.showDuration == showDuration; + return other is TooltipThemeData + && other.height == height + && other.padding == padding + && other.margin == margin + && other.verticalOffset == verticalOffset + && other.preferBelow == preferBelow + && other.excludeFromSemantics == excludeFromSemantics + && other.decoration == decoration + && other.textStyle == textStyle + && other.waitDuration == waitDuration + && other.showDuration == showDuration; } @override diff --git a/packages/flutter/lib/src/material/typography.dart b/packages/flutter/lib/src/material/typography.dart index b44ab33065..03ab55081a 100644 --- a/packages/flutter/lib/src/material/typography.dart +++ b/packages/flutter/lib/src/material/typography.dart @@ -234,12 +234,12 @@ class Typography extends Diagnosticable { return true; if (other.runtimeType != runtimeType) return false; - final Typography otherTypography = other; - return otherTypography.black == black - && otherTypography.white == white - && otherTypography.englishLike == englishLike - && otherTypography.dense == dense - && otherTypography.tall == tall; + return other is Typography + && other.black == black + && other.white == white + && other.englishLike == englishLike + && other.dense == dense + && other.tall == tall; } @override diff --git a/packages/flutter/lib/src/material/user_accounts_drawer_header.dart b/packages/flutter/lib/src/material/user_accounts_drawer_header.dart index 9108d2983e..13e61e35c5 100644 --- a/packages/flutter/lib/src/material/user_accounts_drawer_header.dart +++ b/packages/flutter/lib/src/material/user_accounts_drawer_header.dart @@ -232,7 +232,7 @@ class _AccountDetailsLayout extends MultiChildLayoutDelegate { final String bottomLine = hasChild(accountEmail) ? accountEmail : (hasChild(accountName) ? accountName : 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); // place bottom line center at same height as icon center