Unverified Commit 649e1885 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

implicit-casts:false in flutter/lib/src/painting (#45621)

parent d01de941
...@@ -44,7 +44,7 @@ class NetworkImage extends image_provider.ImageProvider<image_provider.NetworkIm ...@@ -44,7 +44,7 @@ class NetworkImage extends image_provider.ImageProvider<image_provider.NetworkIm
final StreamController<ImageChunkEvent> chunkEvents = StreamController<ImageChunkEvent>(); final StreamController<ImageChunkEvent> chunkEvents = StreamController<ImageChunkEvent>();
return MultiFrameImageStreamCompleter( return MultiFrameImageStreamCompleter(
codec: _loadAsync(key, chunkEvents, decode), codec: _loadAsync(key as NetworkImage, chunkEvents, decode),
chunkEvents: chunkEvents.stream, chunkEvents: chunkEvents.stream,
scale: key.scale, scale: key.scale,
informationCollector: () { informationCollector: () {
...@@ -111,9 +111,9 @@ class NetworkImage extends image_provider.ImageProvider<image_provider.NetworkIm ...@@ -111,9 +111,9 @@ class NetworkImage extends image_provider.ImageProvider<image_provider.NetworkIm
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final NetworkImage typedOther = other; return other is NetworkImage
return url == typedOther.url && other.url == url
&& scale == typedOther.scale; && other.scale == scale;
} }
@override @override
......
...@@ -38,12 +38,12 @@ class NetworkImage extends image_provider.ImageProvider<image_provider.NetworkIm ...@@ -38,12 +38,12 @@ class NetworkImage extends image_provider.ImageProvider<image_provider.NetworkIm
@override @override
ImageStreamCompleter load(image_provider.NetworkImage key, image_provider.DecoderCallback decode) { ImageStreamCompleter load(image_provider.NetworkImage key, image_provider.DecoderCallback decode) {
return MultiFrameImageStreamCompleter( return MultiFrameImageStreamCompleter(
codec: _loadAsync(key, decode), codec: _loadAsync(key as NetworkImage, decode),
scale: key.scale, scale: key.scale,
informationCollector: () { informationCollector: () {
return <DiagnosticsNode>[ return <DiagnosticsNode>[
DiagnosticsProperty<image_provider.ImageProvider>('Image provider', this), DiagnosticsProperty<image_provider.ImageProvider>('Image provider', this),
DiagnosticsProperty<NetworkImage>('Image key', key), DiagnosticsProperty<NetworkImage>('Image key', key as NetworkImage),
]; ];
}, },
); );
...@@ -55,13 +55,13 @@ class NetworkImage extends image_provider.ImageProvider<image_provider.NetworkIm ...@@ -55,13 +55,13 @@ class NetworkImage extends image_provider.ImageProvider<image_provider.NetworkIm
// Web does not support decoding network images to a specified size. The decode parameter // Web does not support decoding network images to a specified size. The decode parameter
// here is ignored and the web-only `ui.webOnlyInstantiateImageCodecFromUrl` will be used // here is ignored and the web-only `ui.webOnlyInstantiateImageCodecFromUrl` will be used
// directly in place of the typical `instantiateImageCodec` method. // directly in place of the typical `instantiateImageCodec` method.
Future<ui.Codec> _loadAsync(NetworkImage key, image_provider.DecoderCallback decode) async { Future<ui.Codec> _loadAsync(NetworkImage key, image_provider.DecoderCallback decode) {
assert(key == this); assert(key == this);
final Uri resolved = Uri.base.resolve(key.url); final Uri resolved = Uri.base.resolve(key.url);
// This API only exists in the web engine implementation and is not // This API only exists in the web engine implementation and is not
// contained in the analyzer summary for Flutter. // contained in the analyzer summary for Flutter.
return ui.webOnlyInstantiateImageCodecFromUrl(resolved); // ignore: undefined_function return ui.webOnlyInstantiateImageCodecFromUrl(resolved) as Future<ui.Codec>; // ignore: undefined_function
} }
@override @override
...@@ -69,8 +69,9 @@ class NetworkImage extends image_provider.ImageProvider<image_provider.NetworkIm ...@@ -69,8 +69,9 @@ class NetworkImage extends image_provider.ImageProvider<image_provider.NetworkIm
if (other.runtimeType != runtimeType) { if (other.runtimeType != runtimeType) {
return false; return false;
} }
final NetworkImage typedOther = other; return other is NetworkImage
return url == typedOther.url && scale == typedOther.scale; && other.url == url
&& other.scale == scale;
} }
@override @override
......
...@@ -127,12 +127,10 @@ abstract class AlignmentGeometry { ...@@ -127,12 +127,10 @@ abstract class AlignmentGeometry {
@override @override
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (other is! AlignmentGeometry) return other is AlignmentGeometry
return false; && other._x == _x
final AlignmentGeometry typedOther = other; && other._start == _start
return _x == typedOther._x && && other._y == _y;
_start == typedOther._start &&
_y == typedOther._y;
} }
@override @override
......
...@@ -136,9 +136,9 @@ class BeveledRectangleBorder extends ShapeBorder { ...@@ -136,9 +136,9 @@ class BeveledRectangleBorder extends ShapeBorder {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final BeveledRectangleBorder typedOther = other; return other is BeveledRectangleBorder
return side == typedOther.side && other.side == side
&& borderRadius == typedOther.borderRadius; && other.borderRadius == borderRadius;
} }
@override @override
......
...@@ -113,8 +113,8 @@ mixin PaintingBinding on BindingBase, ServicesBinding { ...@@ -113,8 +113,8 @@ mixin PaintingBinding on BindingBase, ServicesBinding {
@override @override
Future<void> handleSystemMessage(Object systemMessage) async { Future<void> handleSystemMessage(Object systemMessage) async {
await super.handleSystemMessage(systemMessage); await super.handleSystemMessage(systemMessage);
final Map<String, dynamic> message = systemMessage; final Map<String, dynamic> message = systemMessage as Map<String, dynamic>;
final String type = message['type']; final String type = message['type'] as String;
switch (type) { switch (type) {
case 'fontsChange': case 'fontsChange':
_systemFonts.notifyListeners(); _systemFonts.notifyListeners();
......
...@@ -244,15 +244,15 @@ abstract class BorderRadiusGeometry { ...@@ -244,15 +244,15 @@ abstract class BorderRadiusGeometry {
return true; return true;
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final BorderRadiusGeometry typedOther = other; return other is BorderRadiusGeometry
return _topLeft == typedOther._topLeft && other._topLeft == _topLeft
&& _topRight == typedOther._topRight && other._topRight == _topRight
&& _bottomLeft == typedOther._bottomLeft && other._bottomLeft == _bottomLeft
&& _bottomRight == typedOther._bottomRight && other._bottomRight == _bottomRight
&& _topStart == typedOther._topStart && other._topStart == _topStart
&& _topEnd == typedOther._topEnd && other._topEnd == _topEnd
&& _bottomStart == typedOther._bottomStart && other._bottomStart == _bottomStart
&& _bottomEnd == typedOther._bottomEnd; && other._bottomEnd == _bottomEnd;
} }
@override @override
......
...@@ -257,10 +257,10 @@ class BorderSide { ...@@ -257,10 +257,10 @@ class BorderSide {
return true; return true;
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final BorderSide typedOther = other; return other is BorderSide
return color == typedOther.color && && other.color == color
width == typedOther.width && && other.width == width
style == typedOther.style; && other.style == style;
} }
@override @override
...@@ -615,16 +615,8 @@ class _CompoundBorder extends ShapeBorder { ...@@ -615,16 +615,8 @@ class _CompoundBorder extends ShapeBorder {
return true; return true;
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final _CompoundBorder typedOther = other; return other is _CompoundBorder
if (borders == typedOther.borders) && listEquals<ShapeBorder>(other.borders, borders);
return true;
if (borders.length != typedOther.borders.length)
return false;
for (int index = 0; index < borders.length; index += 1) {
if (borders[index] != typedOther.borders[index])
return false;
}
return true;
} }
@override @override
......
...@@ -105,9 +105,9 @@ abstract class BoxBorder extends ShapeBorder { ...@@ -105,9 +105,9 @@ abstract class BoxBorder extends ShapeBorder {
static BoxBorder lerp(BoxBorder a, BoxBorder b, double t) { static BoxBorder lerp(BoxBorder a, BoxBorder b, double t) {
assert(t != null); assert(t != null);
if ((a is Border || a == null) && (b is Border || b == null)) if ((a is Border || a == null) && (b is Border || b == null))
return Border.lerp(a, b, t); return Border.lerp(a as Border, b as Border, t);
if ((a is BorderDirectional || a == null) && (b is BorderDirectional || b == null)) if ((a is BorderDirectional || a == null) && (b is BorderDirectional || b == null))
return BorderDirectional.lerp(a, b, t); return BorderDirectional.lerp(a as BorderDirectional, b as BorderDirectional, t);
if (b is Border && a is BorderDirectional) { if (b is Border && a is BorderDirectional) {
final BoxBorder c = b; final BoxBorder c = b;
b = a; b = a;
...@@ -402,14 +402,12 @@ class Border extends BoxBorder { ...@@ -402,14 +402,12 @@ class Border extends BoxBorder {
@override @override
Border add(ShapeBorder other, { bool reversed = false }) { Border add(ShapeBorder other, { bool reversed = false }) {
if (other is! Border) if (other is Border &&
return null; BorderSide.canMerge(top, other.top) &&
final Border typedOther = other; BorderSide.canMerge(right, other.right) &&
if (BorderSide.canMerge(top, typedOther.top) && BorderSide.canMerge(bottom, other.bottom) &&
BorderSide.canMerge(right, typedOther.right) && BorderSide.canMerge(left, other.left)) {
BorderSide.canMerge(bottom, typedOther.bottom) && return Border.merge(this, other);
BorderSide.canMerge(left, typedOther.left)) {
return Border.merge(this, typedOther);
} }
return null; return null;
} }
...@@ -521,11 +519,11 @@ class Border extends BoxBorder { ...@@ -521,11 +519,11 @@ class Border extends BoxBorder {
return true; return true;
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final Border typedOther = other; return other is Border
return top == typedOther.top && && other.top == top
right == typedOther.right && && other.right == right
bottom == typedOther.bottom && && other.bottom == bottom
left == typedOther.left; && other.left == left;
} }
@override @override
...@@ -825,11 +823,11 @@ class BorderDirectional extends BoxBorder { ...@@ -825,11 +823,11 @@ class BorderDirectional extends BoxBorder {
return true; return true;
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final BorderDirectional typedOther = other; return other is BorderDirectional
return top == typedOther.top && && other.top == top
start == typedOther.start && && other.start == start
end == typedOther.end && && other.end == end
bottom == typedOther.bottom; && other.bottom == bottom;
} }
@override @override
......
...@@ -250,7 +250,7 @@ class BoxDecoration extends Decoration { ...@@ -250,7 +250,7 @@ class BoxDecoration extends Decoration {
return scale(t); return scale(t);
if (a is BoxDecoration) if (a is BoxDecoration)
return BoxDecoration.lerp(a, this, t); return BoxDecoration.lerp(a, this, t);
return super.lerpFrom(a, t); return super.lerpFrom(a, t) as BoxDecoration;
} }
@override @override
...@@ -259,7 +259,7 @@ class BoxDecoration extends Decoration { ...@@ -259,7 +259,7 @@ class BoxDecoration extends Decoration {
return scale(1.0 - t); return scale(1.0 - t);
if (b is BoxDecoration) if (b is BoxDecoration)
return BoxDecoration.lerp(this, b, t); return BoxDecoration.lerp(this, b, t);
return super.lerpTo(b, t); return super.lerpTo(b, t) as BoxDecoration;
} }
/// Linearly interpolate between two box decorations. /// Linearly interpolate between two box decorations.
...@@ -314,14 +314,14 @@ class BoxDecoration extends Decoration { ...@@ -314,14 +314,14 @@ class BoxDecoration extends Decoration {
return true; return true;
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final BoxDecoration typedOther = other; return other is BoxDecoration
return color == typedOther.color && && other.color == color
image == typedOther.image && && other.image == image
border == typedOther.border && && other.border == border
borderRadius == typedOther.borderRadius && && other.borderRadius == borderRadius
boxShadow == typedOther.boxShadow && && other.boxShadow == boxShadow
gradient == typedOther.gradient && && other.gradient == gradient
shape == typedOther.shape; && other.shape == shape;
} }
@override @override
...@@ -483,7 +483,7 @@ class _BoxDecorationPainter extends BoxPainter { ...@@ -483,7 +483,7 @@ class _BoxDecorationPainter extends BoxPainter {
canvas, canvas,
rect, rect,
shape: _decoration.shape, shape: _decoration.shape,
borderRadius: _decoration.borderRadius, borderRadius: _decoration.borderRadius as BorderRadius,
textDirection: configuration.textDirection, textDirection: configuration.textDirection,
); );
} }
......
...@@ -118,11 +118,11 @@ class BoxShadow extends ui.Shadow { ...@@ -118,11 +118,11 @@ class BoxShadow extends ui.Shadow {
return true; return true;
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final BoxShadow typedOther = other; return other is BoxShadow
return color == typedOther.color && && other.color == color
offset == typedOther.offset && && other.offset == offset
blurRadius == typedOther.blurRadius && && other.blurRadius == blurRadius
spreadRadius == typedOther.spreadRadius; && other.spreadRadius == spreadRadius;
} }
@override @override
......
...@@ -84,8 +84,8 @@ class CircleBorder extends ShapeBorder { ...@@ -84,8 +84,8 @@ class CircleBorder extends ShapeBorder {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final CircleBorder typedOther = other; return other is CircleBorder
return side == typedOther.side; && other.side == side;
} }
@override @override
......
...@@ -206,10 +206,10 @@ class HSVColor { ...@@ -206,10 +206,10 @@ class HSVColor {
if (b == null) if (b == null)
return a._scaleAlpha(1.0 - t); return a._scaleAlpha(1.0 - t);
return HSVColor.fromAHSV( return HSVColor.fromAHSV(
lerpDouble(a.alpha, b.alpha, t).clamp(0.0, 1.0), lerpDouble(a.alpha, b.alpha, t).clamp(0.0, 1.0) as double,
lerpDouble(a.hue, b.hue, t) % 360.0, lerpDouble(a.hue, b.hue, t) % 360.0,
lerpDouble(a.saturation, b.saturation, t).clamp(0.0, 1.0), lerpDouble(a.saturation, b.saturation, t).clamp(0.0, 1.0) as double,
lerpDouble(a.value, b.value, t).clamp(0.0, 1.0), lerpDouble(a.value, b.value, t).clamp(0.0, 1.0) as double,
); );
} }
...@@ -217,13 +217,11 @@ class HSVColor { ...@@ -217,13 +217,11 @@ class HSVColor {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (identical(this, other)) if (identical(this, other))
return true; return true;
if (other is! HSVColor) return other is HSVColor
return false; && other.alpha == alpha
final HSVColor typedOther = other; && other.hue == hue
return typedOther.alpha == alpha && other.saturation == saturation
&& typedOther.hue == hue && other.value == value;
&& typedOther.saturation == saturation
&& typedOther.value == value;
} }
@override @override
...@@ -292,7 +290,7 @@ class HSLColor { ...@@ -292,7 +290,7 @@ class HSLColor {
// Saturation can exceed 1.0 with rounding errors, so clamp it. // Saturation can exceed 1.0 with rounding errors, so clamp it.
final double saturation = lightness == 1.0 final double saturation = lightness == 1.0
? 0.0 ? 0.0
: (delta / (1.0 - (2.0 * lightness - 1.0).abs())).clamp(0.0, 1.0); : ((delta / (1.0 - (2.0 * lightness - 1.0).abs())).clamp(0.0, 1.0) as double);
return HSLColor.fromAHSL(alpha, hue, saturation, lightness); return HSLColor.fromAHSL(alpha, hue, saturation, lightness);
} }
...@@ -392,10 +390,10 @@ class HSLColor { ...@@ -392,10 +390,10 @@ class HSLColor {
if (b == null) if (b == null)
return a._scaleAlpha(1.0 - t); return a._scaleAlpha(1.0 - t);
return HSLColor.fromAHSL( return HSLColor.fromAHSL(
lerpDouble(a.alpha, b.alpha, t).clamp(0.0, 1.0), lerpDouble(a.alpha, b.alpha, t).clamp(0.0, 1.0) as double,
lerpDouble(a.hue, b.hue, t) % 360.0, lerpDouble(a.hue, b.hue, t) % 360.0,
lerpDouble(a.saturation, b.saturation, t).clamp(0.0, 1.0), lerpDouble(a.saturation, b.saturation, t).clamp(0.0, 1.0) as double,
lerpDouble(a.lightness, b.lightness, t).clamp(0.0, 1.0), lerpDouble(a.lightness, b.lightness, t).clamp(0.0, 1.0) as double,
); );
} }
...@@ -403,13 +401,11 @@ class HSLColor { ...@@ -403,13 +401,11 @@ class HSLColor {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (identical(this, other)) if (identical(this, other))
return true; return true;
if (other is! HSLColor) return other is HSLColor
return false; && other.alpha == alpha
final HSLColor typedOther = other; && other.hue == hue
return typedOther.alpha == alpha && other.saturation == saturation
&& typedOther.hue == hue && other.lightness == lightness;
&& typedOther.saturation == saturation
&& typedOther.lightness == lightness;
} }
@override @override
...@@ -450,8 +446,9 @@ class ColorSwatch<T> extends Color { ...@@ -450,8 +446,9 @@ class ColorSwatch<T> extends Color {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final ColorSwatch<T> typedOther = other; return super == other
return super == other && _swatch == typedOther._swatch; && other is ColorSwatch<T>
&& other._swatch == _swatch;
} }
@override @override
......
...@@ -151,9 +151,9 @@ class ContinuousRectangleBorder extends ShapeBorder { ...@@ -151,9 +151,9 @@ class ContinuousRectangleBorder extends ShapeBorder {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final ContinuousRectangleBorder typedOther = other; return other is ContinuousRectangleBorder
return side == typedOther.side && other.side == side
&& borderRadius == typedOther.borderRadius; && other.borderRadius == borderRadius;
} }
@override @override
......
...@@ -141,14 +141,14 @@ class DecorationImage { ...@@ -141,14 +141,14 @@ class DecorationImage {
return true; return true;
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final DecorationImage typedOther = other; return other is DecorationImage
return image == typedOther.image && other.image == image
&& colorFilter == typedOther.colorFilter && other.colorFilter == colorFilter
&& fit == typedOther.fit && other.fit == fit
&& alignment == typedOther.alignment && other.alignment == alignment
&& centerSlice == typedOther.centerSlice && other.centerSlice == centerSlice
&& repeat == typedOther.repeat && other.repeat == repeat
&& matchTextDirection == typedOther.matchTextDirection; && other.matchTextDirection == matchTextDirection;
} }
@override @override
...@@ -392,8 +392,8 @@ void paintImage({ ...@@ -392,8 +392,8 @@ void paintImage({
centerSlice.left + inputSize.width - centerSlice.right, centerSlice.left + inputSize.width - centerSlice.right,
centerSlice.top + inputSize.height - centerSlice.bottom, centerSlice.top + inputSize.height - centerSlice.bottom,
); );
outputSize -= sliceBorder; outputSize = outputSize - sliceBorder as Size;
inputSize -= sliceBorder; inputSize = inputSize - sliceBorder as Size;
} }
fit ??= centerSlice == null ? BoxFit.scaleDown : BoxFit.fill; fit ??= centerSlice == null ? BoxFit.scaleDown : BoxFit.fill;
assert(centerSlice == null || (fit != BoxFit.none && fit != BoxFit.cover)); assert(centerSlice == null || (fit != BoxFit.none && fit != BoxFit.cover));
......
...@@ -280,15 +280,13 @@ abstract class EdgeInsetsGeometry { ...@@ -280,15 +280,13 @@ abstract class EdgeInsetsGeometry {
@override @override
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (other is! EdgeInsetsGeometry) return other is EdgeInsetsGeometry
return false; && other._left == _left
final EdgeInsetsGeometry typedOther = other; && other._right == _right
return _left == typedOther._left && other._start == _start
&& _right == typedOther._right && other._end == _end
&& _start == typedOther._start && other._top == _top
&& _end == typedOther._end && other._bottom == _bottom;
&& _top == typedOther._top
&& _bottom == typedOther._bottom;
} }
@override @override
......
...@@ -171,7 +171,7 @@ class FlutterLogoDecoration extends Decoration { ...@@ -171,7 +171,7 @@ class FlutterLogoDecoration extends Decoration {
t < 0.5 ? a.style : b.style, t < 0.5 ? a.style : b.style,
EdgeInsets.lerp(a.margin, b.margin, t), EdgeInsets.lerp(a.margin, b.margin, t),
a._position + (b._position - a._position) * t, a._position + (b._position - a._position) * t,
(a._opacity + (b._opacity - a._opacity) * t).clamp(0.0, 1.0), (a._opacity + (b._opacity - a._opacity) * t).clamp(0.0, 1.0) as double,
); );
} }
...@@ -180,9 +180,9 @@ class FlutterLogoDecoration extends Decoration { ...@@ -180,9 +180,9 @@ class FlutterLogoDecoration extends Decoration {
assert(debugAssertIsValid()); assert(debugAssertIsValid());
if (a == null || a is FlutterLogoDecoration) { if (a == null || a is FlutterLogoDecoration) {
assert(a == null || a.debugAssertIsValid()); assert(a == null || a.debugAssertIsValid());
return FlutterLogoDecoration.lerp(a, this, t); return FlutterLogoDecoration.lerp(a as FlutterLogoDecoration, this, t);
} }
return super.lerpFrom(a, t); return super.lerpFrom(a, t) as FlutterLogoDecoration;
} }
@override @override
...@@ -190,9 +190,9 @@ class FlutterLogoDecoration extends Decoration { ...@@ -190,9 +190,9 @@ class FlutterLogoDecoration extends Decoration {
assert(debugAssertIsValid()); assert(debugAssertIsValid());
if (b == null || b is FlutterLogoDecoration) { if (b == null || b is FlutterLogoDecoration) {
assert(b == null || b.debugAssertIsValid()); assert(b == null || b.debugAssertIsValid());
return FlutterLogoDecoration.lerp(this, b, t); return FlutterLogoDecoration.lerp(this, b as FlutterLogoDecoration, t);
} }
return super.lerpTo(b, t); return super.lerpTo(b, t) as FlutterLogoDecoration;
} }
@override @override
...@@ -210,14 +210,12 @@ class FlutterLogoDecoration extends Decoration { ...@@ -210,14 +210,12 @@ class FlutterLogoDecoration extends Decoration {
assert(debugAssertIsValid()); assert(debugAssertIsValid());
if (identical(this, other)) if (identical(this, other))
return true; return true;
if (other is! FlutterLogoDecoration) return other is FlutterLogoDecoration
return false; && other.lightColor == lightColor
final FlutterLogoDecoration typedOther = other; && other.darkColor == darkColor
return lightColor == typedOther.lightColor && other.textColor == textColor
&& darkColor == typedOther.darkColor && other._position == _position
&& textColor == typedOther.textColor && other._opacity == _opacity;
&& _position == typedOther._position
&& _opacity == typedOther._opacity;
} }
@override @override
......
...@@ -137,7 +137,7 @@ class FractionalOffset extends Alignment { ...@@ -137,7 +137,7 @@ class FractionalOffset extends Alignment {
Alignment operator -(Alignment other) { Alignment operator -(Alignment other) {
if (other is! FractionalOffset) if (other is! FractionalOffset)
return super - other; return super - other;
final FractionalOffset typedOther = other; final FractionalOffset typedOther = other as FractionalOffset;
return FractionalOffset(dx - typedOther.dx, dy - typedOther.dy); return FractionalOffset(dx - typedOther.dx, dy - typedOther.dy);
} }
...@@ -145,7 +145,7 @@ class FractionalOffset extends Alignment { ...@@ -145,7 +145,7 @@ class FractionalOffset extends Alignment {
Alignment operator +(Alignment other) { Alignment operator +(Alignment other) {
if (other is! FractionalOffset) if (other is! FractionalOffset)
return super + other; return super + other;
final FractionalOffset typedOther = other; final FractionalOffset typedOther = other as FractionalOffset;
return FractionalOffset(dx + typedOther.dx, dy + typedOther.dy); return FractionalOffset(dx + typedOther.dx, dy + typedOther.dy);
} }
......
...@@ -66,7 +66,7 @@ Offset positionDependentBox({ ...@@ -66,7 +66,7 @@ Offset positionDependentBox({
if (size.width - margin * 2.0 < childSize.width) { if (size.width - margin * 2.0 < childSize.width) {
x = (size.width - childSize.width) / 2.0; x = (size.width - childSize.width) / 2.0;
} else { } else {
final double normalizedTargetX = target.dx.clamp(margin, size.width - margin); final double normalizedTargetX = target.dx.clamp(margin, size.width - margin) as double;
final double edge = margin + childSize.width / 2.0; final double edge = margin + childSize.width / 2.0;
if (normalizedTargetX < edge) { if (normalizedTargetX < edge) {
x = margin; x = margin;
......
...@@ -438,14 +438,14 @@ class LinearGradient extends Gradient { ...@@ -438,14 +438,14 @@ class LinearGradient extends Gradient {
@override @override
Gradient lerpFrom(Gradient a, double t) { Gradient lerpFrom(Gradient a, double t) {
if (a == null || (a is LinearGradient)) if (a == null || (a is LinearGradient))
return LinearGradient.lerp(a, this, t); return LinearGradient.lerp(a as LinearGradient, this, t);
return super.lerpFrom(a, t); return super.lerpFrom(a, t);
} }
@override @override
Gradient lerpTo(Gradient b, double t) { Gradient lerpTo(Gradient b, double t) {
if (b == null || (b is LinearGradient)) if (b == null || (b is LinearGradient))
return LinearGradient.lerp(this, b, t); return LinearGradient.lerp(this, b as LinearGradient, t);
return super.lerpTo(b, t); return super.lerpTo(b, t);
} }
...@@ -498,30 +498,12 @@ class LinearGradient extends Gradient { ...@@ -498,30 +498,12 @@ class LinearGradient extends Gradient {
return true; return true;
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final LinearGradient typedOther = other; return other is LinearGradient
if (begin != typedOther.begin || && other.begin == begin
end != typedOther.end || && other.end == end
tileMode != typedOther.tileMode || && other.tileMode == tileMode
colors?.length != typedOther.colors?.length || && listEquals<Color>(other.colors, colors)
stops?.length != typedOther.stops?.length) && listEquals<double>(other.stops, stops);
return false;
if (colors != null) {
assert(typedOther.colors != null);
assert(colors.length == typedOther.colors.length);
for (int i = 0; i < colors.length; i += 1) {
if (colors[i] != typedOther.colors[i])
return false;
}
}
if (stops != null) {
assert(typedOther.stops != null);
assert(stops.length == typedOther.stops.length);
for (int i = 0; i < stops.length; i += 1) {
if (stops[i] != typedOther.stops[i])
return false;
}
}
return true;
} }
@override @override
...@@ -714,14 +696,14 @@ class RadialGradient extends Gradient { ...@@ -714,14 +696,14 @@ class RadialGradient extends Gradient {
@override @override
Gradient lerpFrom(Gradient a, double t) { Gradient lerpFrom(Gradient a, double t) {
if (a == null || (a is RadialGradient)) if (a == null || (a is RadialGradient))
return RadialGradient.lerp(a, this, t); return RadialGradient.lerp(a as RadialGradient, this, t);
return super.lerpFrom(a, t); return super.lerpFrom(a, t);
} }
@override @override
Gradient lerpTo(Gradient b, double t) { Gradient lerpTo(Gradient b, double t) {
if (b == null || (b is RadialGradient)) if (b == null || (b is RadialGradient))
return RadialGradient.lerp(this, b, t); return RadialGradient.lerp(this, b as RadialGradient, t);
return super.lerpTo(b, t); return super.lerpTo(b, t);
} }
...@@ -776,32 +758,14 @@ class RadialGradient extends Gradient { ...@@ -776,32 +758,14 @@ class RadialGradient extends Gradient {
return true; return true;
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final RadialGradient typedOther = other; return other is RadialGradient
if (center != typedOther.center || && other.center == center
radius != typedOther.radius || && other.radius == radius
tileMode != typedOther.tileMode || && other.tileMode == tileMode
colors?.length != typedOther.colors?.length || && listEquals<Color>(other.colors, colors)
stops?.length != typedOther.stops?.length || && listEquals<double>(other.stops, stops)
focal != typedOther.focal || && other.focal == focal
focalRadius != typedOther.focalRadius) && other.focalRadius == focalRadius;
return false;
if (colors != null) {
assert(typedOther.colors != null);
assert(colors.length == typedOther.colors.length);
for (int i = 0; i < colors.length; i += 1) {
if (colors[i] != typedOther.colors[i])
return false;
}
}
if (stops != null) {
assert(typedOther.stops != null);
assert(stops.length == typedOther.stops.length);
for (int i = 0; i < stops.length; i += 1) {
if (stops[i] != typedOther.stops[i])
return false;
}
}
return true;
} }
@override @override
...@@ -980,14 +944,14 @@ class SweepGradient extends Gradient { ...@@ -980,14 +944,14 @@ class SweepGradient extends Gradient {
@override @override
Gradient lerpFrom(Gradient a, double t) { Gradient lerpFrom(Gradient a, double t) {
if (a == null || (a is SweepGradient)) if (a == null || (a is SweepGradient))
return SweepGradient.lerp(a, this, t); return SweepGradient.lerp(a as SweepGradient, this, t);
return super.lerpFrom(a, t); return super.lerpFrom(a, t);
} }
@override @override
Gradient lerpTo(Gradient b, double t) { Gradient lerpTo(Gradient b, double t) {
if (b == null || (b is SweepGradient)) if (b == null || (b is SweepGradient))
return SweepGradient.lerp(this, b, t); return SweepGradient.lerp(this, b as SweepGradient, t);
return super.lerpTo(b, t); return super.lerpTo(b, t);
} }
...@@ -1040,31 +1004,13 @@ class SweepGradient extends Gradient { ...@@ -1040,31 +1004,13 @@ class SweepGradient extends Gradient {
return true; return true;
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final SweepGradient typedOther = other; return other is SweepGradient
if (center != typedOther.center || && other.center == center
startAngle != typedOther.startAngle || && other.startAngle == startAngle
endAngle != typedOther.endAngle || && other.endAngle == endAngle
tileMode != typedOther.tileMode || && other.tileMode == tileMode
colors?.length != typedOther.colors?.length || && listEquals<Color>(other.colors, colors)
stops?.length != typedOther.stops?.length) && listEquals<double>(other.stops, stops);
return false;
if (colors != null) {
assert(typedOther.colors != null);
assert(colors.length == typedOther.colors.length);
for (int i = 0; i < colors.length; i += 1) {
if (colors[i] != typedOther.colors[i])
return false;
}
}
if (stops != null) {
assert(typedOther.stops != null);
assert(stops.length == typedOther.stops.length);
for (int i = 0; i < stops.length; i += 1) {
if (stops[i] != typedOther.stops[i])
return false;
}
}
return true;
} }
@override @override
......
...@@ -51,7 +51,7 @@ class ImageConfiguration { ...@@ -51,7 +51,7 @@ class ImageConfiguration {
Locale locale, Locale locale,
TextDirection textDirection, TextDirection textDirection,
Size size, Size size,
String platform, TargetPlatform platform,
}) { }) {
return ImageConfiguration( return ImageConfiguration(
bundle: bundle ?? this.bundle, bundle: bundle ?? this.bundle,
...@@ -94,13 +94,13 @@ class ImageConfiguration { ...@@ -94,13 +94,13 @@ class ImageConfiguration {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final ImageConfiguration typedOther = other; return other is ImageConfiguration
return typedOther.bundle == bundle && other.bundle == bundle
&& typedOther.devicePixelRatio == devicePixelRatio && other.devicePixelRatio == devicePixelRatio
&& typedOther.locale == locale && other.locale == locale
&& typedOther.textDirection == textDirection && other.textDirection == textDirection
&& typedOther.size == size && other.size == size
&& typedOther.platform == platform; && other.platform == platform;
} }
@override @override
...@@ -439,10 +439,10 @@ class AssetBundleImageKey { ...@@ -439,10 +439,10 @@ class AssetBundleImageKey {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final AssetBundleImageKey typedOther = other; return other is AssetBundleImageKey
return bundle == typedOther.bundle && other.bundle == bundle
&& name == typedOther.name && other.name == name
&& scale == typedOther.scale; && other.scale == scale;
} }
@override @override
...@@ -501,10 +501,10 @@ class _SizeAwareCacheKey { ...@@ -501,10 +501,10 @@ class _SizeAwareCacheKey {
bool operator ==(Object other) { bool operator ==(Object other) {
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final _SizeAwareCacheKey typedOther = other; return other is _SizeAwareCacheKey
return providerCacheKey == typedOther.providerCacheKey && other.providerCacheKey == providerCacheKey
&& width == typedOther.width && other.width == width
&& height == typedOther.height; && other.height == height;
} }
@override @override
...@@ -657,9 +657,9 @@ class FileImage extends ImageProvider<FileImage> { ...@@ -657,9 +657,9 @@ class FileImage extends ImageProvider<FileImage> {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final FileImage typedOther = other; return other is FileImage
return file?.path == typedOther.file?.path && other.file?.path == file?.path
&& scale == typedOther.scale; && other.scale == scale;
} }
@override @override
...@@ -718,9 +718,9 @@ class MemoryImage extends ImageProvider<MemoryImage> { ...@@ -718,9 +718,9 @@ class MemoryImage extends ImageProvider<MemoryImage> {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final MemoryImage typedOther = other; return other is MemoryImage
return bytes == typedOther.bytes && other.bytes == bytes
&& scale == typedOther.scale; && other.scale == scale;
} }
@override @override
...@@ -855,10 +855,10 @@ class ExactAssetImage extends AssetBundleImageProvider { ...@@ -855,10 +855,10 @@ class ExactAssetImage extends AssetBundleImageProvider {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final ExactAssetImage typedOther = other; return other is ExactAssetImage
return keyName == typedOther.keyName && other.keyName == keyName
&& scale == typedOther.scale && other.scale == scale
&& bundle == typedOther.bundle; && other.bundle == bundle;
} }
@override @override
......
...@@ -219,11 +219,11 @@ class AssetImage extends AssetBundleImageProvider { ...@@ -219,11 +219,11 @@ class AssetImage extends AssetBundleImageProvider {
if (jsonData == null) if (jsonData == null)
return SynchronousFuture<Map<String, List<String>>>(null); return SynchronousFuture<Map<String, List<String>>>(null);
// TODO(ianh): JSON decoding really shouldn't be on the main thread. // TODO(ianh): JSON decoding really shouldn't be on the main thread.
final Map<String, dynamic> parsedJson = json.decode(jsonData); final Map<String, dynamic> parsedJson = json.decode(jsonData) as Map<String, dynamic>;
final Iterable<String> keys = parsedJson.keys; final Iterable<String> keys = parsedJson.keys;
final Map<String, List<String>> parsedManifest = final Map<String, List<String>> parsedManifest =
Map<String, List<String>>.fromIterables(keys, Map<String, List<String>>.fromIterables(keys,
keys.map<List<String>>((String key) => List<String>.from(parsedJson[key]))); keys.map<List<String>>((String key) => List<String>.from(parsedJson[key] as List<dynamic>)));
// TODO(ianh): convert that data structure to the right types. // TODO(ianh): convert that data structure to the right types.
return SynchronousFuture<Map<String, List<String>>>(parsedManifest); return SynchronousFuture<Map<String, List<String>>>(parsedManifest);
} }
...@@ -280,9 +280,9 @@ class AssetImage extends AssetBundleImageProvider { ...@@ -280,9 +280,9 @@ class AssetImage extends AssetBundleImageProvider {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final AssetImage typedOther = other; return other is AssetImage
return keyName == typedOther.keyName && other.keyName == keyName
&& bundle == typedOther.bundle; && other.bundle == bundle;
} }
@override @override
......
...@@ -50,9 +50,9 @@ class ImageInfo { ...@@ -50,9 +50,9 @@ class ImageInfo {
bool operator ==(Object other) { bool operator ==(Object other) {
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final ImageInfo typedOther = other; return other is ImageInfo
return typedOther.image == image && other.image == image
&& typedOther.scale == scale; && other.scale == scale;
} }
} }
...@@ -119,10 +119,10 @@ class ImageStreamListener { ...@@ -119,10 +119,10 @@ class ImageStreamListener {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final ImageStreamListener typedOther = other; return other is ImageStreamListener
return onImage == typedOther.onImage && other.onImage == onImage
&& onChunk == typedOther.onChunk && other.onChunk == onChunk
&& onError == typedOther.onError; && other.onError == onError;
} }
} }
......
...@@ -358,8 +358,8 @@ abstract class InlineSpan extends DiagnosticableTree { ...@@ -358,8 +358,8 @@ abstract class InlineSpan extends DiagnosticableTree {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final InlineSpan typedOther = other; return other is InlineSpan
return typedOther.style == style; && other.style == style;
} }
@override @override
......
...@@ -507,11 +507,11 @@ class MatrixUtils { ...@@ -507,11 +507,11 @@ class MatrixUtils {
// Model matrix by first translating the object from the origin of the world // Model matrix by first translating the object from the origin of the world
// by radius in the z axis and then rotating against the world. // by radius in the z axis and then rotating against the world.
result *= ( result = result * ((
orientation == Axis.horizontal orientation == Axis.horizontal
? Matrix4.rotationY(angle) ? Matrix4.rotationY(angle)
: Matrix4.rotationX(angle) : Matrix4.rotationX(angle)
) * Matrix4.translationValues(0.0, 0.0, radius); ) * Matrix4.translationValues(0.0, 0.0, radius)) as Matrix4;
// Essentially perspective * view * model. // Essentially perspective * view * model.
return result; return result;
......
...@@ -126,9 +126,9 @@ class RoundedRectangleBorder extends ShapeBorder { ...@@ -126,9 +126,9 @@ class RoundedRectangleBorder extends ShapeBorder {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final RoundedRectangleBorder typedOther = other; return other is RoundedRectangleBorder
return side == typedOther.side && other.side == side
&& borderRadius == typedOther.borderRadius; && other.borderRadius == borderRadius;
} }
@override @override
...@@ -286,10 +286,10 @@ class _RoundedRectangleToCircleBorder extends ShapeBorder { ...@@ -286,10 +286,10 @@ class _RoundedRectangleToCircleBorder extends ShapeBorder {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final _RoundedRectangleToCircleBorder typedOther = other; return other is _RoundedRectangleToCircleBorder
return side == typedOther.side && other.side == side
&& borderRadius == typedOther.borderRadius && other.borderRadius == borderRadius
&& circleness == typedOther.circleness; && other.circleness == circleness;
} }
@override @override
......
...@@ -193,9 +193,9 @@ class ShapeDecoration extends Decoration { ...@@ -193,9 +193,9 @@ class ShapeDecoration extends Decoration {
if (a is BoxDecoration) { if (a is BoxDecoration) {
return ShapeDecoration.lerp(ShapeDecoration.fromBoxDecoration(a), this, t); return ShapeDecoration.lerp(ShapeDecoration.fromBoxDecoration(a), this, t);
} else if (a == null || a is ShapeDecoration) { } else if (a == null || a is ShapeDecoration) {
return ShapeDecoration.lerp(a, this, t); return ShapeDecoration.lerp(a as ShapeDecoration, this, t);
} }
return super.lerpFrom(a, t); return super.lerpFrom(a, t) as ShapeDecoration;
} }
@override @override
...@@ -203,9 +203,9 @@ class ShapeDecoration extends Decoration { ...@@ -203,9 +203,9 @@ class ShapeDecoration extends Decoration {
if (b is BoxDecoration) { if (b is BoxDecoration) {
return ShapeDecoration.lerp(this, ShapeDecoration.fromBoxDecoration(b), t); return ShapeDecoration.lerp(this, ShapeDecoration.fromBoxDecoration(b), t);
} else if (b == null || b is ShapeDecoration) { } else if (b == null || b is ShapeDecoration) {
return ShapeDecoration.lerp(this, b, t); return ShapeDecoration.lerp(this, b as ShapeDecoration, t);
} }
return super.lerpTo(b, t); return super.lerpTo(b, t) as ShapeDecoration;
} }
/// Linearly interpolate between two shapes. /// Linearly interpolate between two shapes.
...@@ -251,12 +251,12 @@ class ShapeDecoration extends Decoration { ...@@ -251,12 +251,12 @@ class ShapeDecoration extends Decoration {
return true; return true;
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final ShapeDecoration typedOther = other; return other is ShapeDecoration
return color == typedOther.color && other.color == color
&& gradient == typedOther.gradient && other.gradient == gradient
&& image == typedOther.image && other.image == image
&& shadows == typedOther.shadows && other.shadows == shadows
&& shape == typedOther.shape; && other.shape == shape;
} }
@override @override
......
...@@ -53,7 +53,7 @@ class StadiumBorder extends ShapeBorder { ...@@ -53,7 +53,7 @@ class StadiumBorder extends ShapeBorder {
if (a is RoundedRectangleBorder) { if (a is RoundedRectangleBorder) {
return _StadiumToRoundedRectangleBorder( return _StadiumToRoundedRectangleBorder(
side: BorderSide.lerp(a.side, side, t), side: BorderSide.lerp(a.side, side, t),
borderRadius: a.borderRadius, borderRadius: a.borderRadius as BorderRadius,
rectness: 1.0 - t, rectness: 1.0 - t,
); );
} }
...@@ -74,7 +74,7 @@ class StadiumBorder extends ShapeBorder { ...@@ -74,7 +74,7 @@ class StadiumBorder extends ShapeBorder {
if (b is RoundedRectangleBorder) { if (b is RoundedRectangleBorder) {
return _StadiumToRoundedRectangleBorder( return _StadiumToRoundedRectangleBorder(
side: BorderSide.lerp(side, b.side, t), side: BorderSide.lerp(side, b.side, t),
borderRadius: b.borderRadius, borderRadius: b.borderRadius as BorderRadius,
rectness: t, rectness: t,
); );
} }
...@@ -113,8 +113,8 @@ class StadiumBorder extends ShapeBorder { ...@@ -113,8 +113,8 @@ class StadiumBorder extends ShapeBorder {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final StadiumBorder typedOther = other; return other is StadiumBorder
return side == typedOther.side; && other.side == side;
} }
@override @override
...@@ -260,9 +260,9 @@ class _StadiumToCircleBorder extends ShapeBorder { ...@@ -260,9 +260,9 @@ class _StadiumToCircleBorder extends ShapeBorder {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final _StadiumToCircleBorder typedOther = other; return other is _StadiumToCircleBorder
return side == typedOther.side && other.side == side
&& circleness == typedOther.circleness; && other.circleness == circleness;
} }
@override @override
...@@ -402,10 +402,10 @@ class _StadiumToRoundedRectangleBorder extends ShapeBorder { ...@@ -402,10 +402,10 @@ class _StadiumToRoundedRectangleBorder extends ShapeBorder {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
return false; return false;
final _StadiumToRoundedRectangleBorder typedOther = other; return other is _StadiumToRoundedRectangleBorder
return side == typedOther.side && other.side == side
&& borderRadius == typedOther.borderRadius && other.borderRadius == borderRadius
&& rectness == typedOther.rectness; && other.rectness == rectness;
} }
@override @override
......
...@@ -546,14 +546,14 @@ class StrutStyle extends Diagnosticable { ...@@ -546,14 +546,14 @@ class StrutStyle extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final StrutStyle typedOther = other; return other is StrutStyle
return fontFamily == typedOther.fontFamily && && other.fontFamily == fontFamily
fontSize == typedOther.fontSize && && other.fontSize == fontSize
fontWeight == typedOther.fontWeight && && other.fontWeight == fontWeight
fontStyle == typedOther.fontStyle && && other.fontStyle == fontStyle
height == typedOther.height && && other.height == height
leading == typedOther.leading && && other.leading == leading
forceStrutHeight == typedOther.forceStrutHeight; && other.forceStrutHeight == forceStrutHeight;
} }
@override @override
......
...@@ -549,7 +549,7 @@ class TextPainter { ...@@ -549,7 +549,7 @@ class TextPainter {
_lastMaxWidth = maxWidth; _lastMaxWidth = maxWidth;
_paragraph.layout(ui.ParagraphConstraints(width: maxWidth)); _paragraph.layout(ui.ParagraphConstraints(width: maxWidth));
if (minWidth != maxWidth) { if (minWidth != maxWidth) {
final double newWidth = maxIntrinsicWidth.clamp(minWidth, maxWidth); final double newWidth = maxIntrinsicWidth.clamp(minWidth, maxWidth) as double;
if (newWidth != width) { if (newWidth != width) {
_paragraph.layout(ui.ParagraphConstraints(width: newWidth)); _paragraph.layout(ui.ParagraphConstraints(width: newWidth));
} }
......
...@@ -261,7 +261,7 @@ class TextSpan extends InlineSpan { ...@@ -261,7 +261,7 @@ class TextSpan extends InlineSpan {
child is TextSpan, child is TextSpan,
'visitTextSpan is deprecated. Use visitChildren to support InlineSpans', 'visitTextSpan is deprecated. Use visitChildren to support InlineSpans',
); );
final TextSpan textSpanChild = child; final TextSpan textSpanChild = child as TextSpan;
if (!textSpanChild.visitTextSpan(visitor)) if (!textSpanChild.visitTextSpan(visitor))
return false; return false;
} }
...@@ -388,7 +388,7 @@ class TextSpan extends InlineSpan { ...@@ -388,7 +388,7 @@ class TextSpan extends InlineSpan {
return RenderComparison.identical; return RenderComparison.identical;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return RenderComparison.layout; return RenderComparison.layout;
final TextSpan textSpan = other; final TextSpan textSpan = other as TextSpan;
if (textSpan.text != text || if (textSpan.text != text ||
children?.length != textSpan.children?.length || children?.length != textSpan.children?.length ||
(style == null) != (textSpan.style == null)) (style == null) != (textSpan.style == null))
...@@ -423,11 +423,11 @@ class TextSpan extends InlineSpan { ...@@ -423,11 +423,11 @@ class TextSpan extends InlineSpan {
return false; return false;
if (super != other) if (super != other)
return false; return false;
final TextSpan typedOther = other; return other is TextSpan
return typedOther.text == text && other.text == text
&& typedOther.recognizer == recognizer && other.recognizer == recognizer
&& typedOther.semanticsLabel == semanticsLabel && other.semanticsLabel == semanticsLabel
&& listEquals<InlineSpan>(typedOther.children, children); && listEquals<InlineSpan>(other.children, children);
} }
@override @override
......
...@@ -833,7 +833,7 @@ class TextStyle extends Diagnosticable { ...@@ -833,7 +833,7 @@ class TextStyle extends Diagnosticable {
fontFamily: fontFamily ?? this.fontFamily, fontFamily: fontFamily ?? this.fontFamily,
fontFamilyFallback: fontFamilyFallback ?? this.fontFamilyFallback, fontFamilyFallback: fontFamilyFallback ?? this.fontFamilyFallback,
fontSize: fontSize == null ? null : fontSize * fontSizeFactor + fontSizeDelta, fontSize: fontSize == null ? null : fontSize * fontSizeFactor + fontSizeDelta,
fontWeight: fontWeight == null ? null : FontWeight.values[(fontWeight.index + fontWeightDelta).clamp(0, FontWeight.values.length - 1)], fontWeight: fontWeight == null ? null : FontWeight.values[(fontWeight.index + fontWeightDelta).clamp(0, FontWeight.values.length - 1) as int],
fontStyle: fontStyle, fontStyle: fontStyle,
letterSpacing: letterSpacing == null ? null : letterSpacing * letterSpacingFactor + letterSpacingDelta, letterSpacing: letterSpacing == null ? null : letterSpacing * letterSpacingFactor + letterSpacingDelta,
wordSpacing: wordSpacing == null ? null : wordSpacing * wordSpacingFactor + wordSpacingDelta, wordSpacing: wordSpacing == null ? null : wordSpacing * wordSpacingFactor + wordSpacingDelta,
...@@ -1144,28 +1144,28 @@ class TextStyle extends Diagnosticable { ...@@ -1144,28 +1144,28 @@ class TextStyle extends Diagnosticable {
return true; return true;
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final TextStyle typedOther = other; return other is TextStyle
return inherit == typedOther.inherit && && other.inherit == inherit
color == typedOther.color && && other.color == color
backgroundColor == typedOther.backgroundColor && && other.backgroundColor == backgroundColor
fontFamily == typedOther.fontFamily && && other.fontFamily == fontFamily
fontSize == typedOther.fontSize && && other.fontSize == fontSize
fontWeight == typedOther.fontWeight && && other.fontWeight == fontWeight
fontStyle == typedOther.fontStyle && && other.fontStyle == fontStyle
letterSpacing == typedOther.letterSpacing && && other.letterSpacing == letterSpacing
wordSpacing == typedOther.wordSpacing && && other.wordSpacing == wordSpacing
textBaseline == typedOther.textBaseline && && other.textBaseline == textBaseline
height == typedOther.height && && other.height == height
locale == typedOther.locale && && other.locale == locale
foreground == typedOther.foreground && && other.foreground == foreground
background == typedOther.background && && other.background == background
decoration == typedOther.decoration && && other.decoration == decoration
decorationColor == typedOther.decorationColor && && other.decorationColor == decorationColor
decorationStyle == typedOther.decorationStyle && && other.decorationStyle == decorationStyle
decorationThickness == typedOther.decorationThickness && && other.decorationThickness == decorationThickness
listEquals(shadows, typedOther.shadows) && && listEquals(other.shadows, shadows)
listEquals(fontFeatures, typedOther.fontFeatures) && && listEquals(other.fontFeatures, fontFeatures)
listEquals(fontFamilyFallback, typedOther.fontFamilyFallback); && listEquals(other.fontFamilyFallback, fontFamilyFallback);
} }
@override @override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment