diff --git a/packages/flutter/lib/src/animation/animation.dart b/packages/flutter/lib/src/animation/animation.dart index 3a6bd0a340..9701142b4c 100644 --- a/packages/flutter/lib/src/animation/animation.dart +++ b/packages/flutter/lib/src/animation/animation.dart @@ -167,7 +167,7 @@ abstract class Animation extends Listenable implements ValueListenable { @optionalTypeArgs Animation drive(Animatable child) { assert(this is Animation); - return child.animate(this as dynamic); // TODO(ianh): Clean this once https://github.com/dart-lang/sdk/issues/32120 is fixed. + return child.animate(this as Animation); } @override diff --git a/packages/flutter/lib/src/animation/animation_controller.dart b/packages/flutter/lib/src/animation/animation_controller.dart index 0b47334163..a6ed02afe9 100644 --- a/packages/flutter/lib/src/animation/animation_controller.dart +++ b/packages/flutter/lib/src/animation/animation_controller.dart @@ -392,7 +392,7 @@ class AnimationController extends Animation } void _internalSetValue(double newValue) { - _value = newValue.clamp(lowerBound, upperBound); + _value = newValue.clamp(lowerBound, upperBound) as double; if (_value == lowerBound) { _status = AnimationStatus.dismissed; } else if (_value == upperBound) { @@ -576,7 +576,7 @@ class AnimationController extends Animation stop(); if (simulationDuration == Duration.zero) { if (value != target) { - _value = target.clamp(lowerBound, upperBound); + _value = target.clamp(lowerBound, upperBound) as double; notifyListeners(); } _status = (_direction == _AnimationDirection.forward) ? @@ -701,7 +701,7 @@ class AnimationController extends Animation assert(!isAnimating); _simulation = simulation; _lastElapsedDuration = Duration.zero; - _value = simulation.x(0.0).clamp(lowerBound, upperBound); + _value = simulation.x(0.0).clamp(lowerBound, upperBound) as double; final TickerFuture result = _ticker.start(); _status = (_direction == _AnimationDirection.forward) ? AnimationStatus.forward : @@ -778,7 +778,7 @@ class AnimationController extends Animation _lastElapsedDuration = elapsed; final double elapsedInSeconds = elapsed.inMicroseconds.toDouble() / Duration.microsecondsPerSecond; assert(elapsedInSeconds >= 0.0); - _value = _simulation.x(elapsedInSeconds).clamp(lowerBound, upperBound); + _value = _simulation.x(elapsedInSeconds).clamp(lowerBound, upperBound) as double; if (_simulation.isDone(elapsedInSeconds)) { _status = (_direction == _AnimationDirection.forward) ? AnimationStatus.completed : @@ -813,7 +813,7 @@ class _InterpolationSimulation extends Simulation { @override double x(double timeInSeconds) { - final double t = (timeInSeconds / _durationInSeconds).clamp(0.0, 1.0); + final double t = (timeInSeconds / _durationInSeconds).clamp(0.0, 1.0) as double; if (t == 0.0) return _begin; else if (t == 1.0) diff --git a/packages/flutter/lib/src/animation/curves.dart b/packages/flutter/lib/src/animation/curves.dart index 33e8055cbd..bdc8f44115 100644 --- a/packages/flutter/lib/src/animation/curves.dart +++ b/packages/flutter/lib/src/animation/curves.dart @@ -149,7 +149,7 @@ class Interval extends Curve { assert(end >= 0.0); assert(end <= 1.0); assert(end >= begin); - t = ((t - begin) / (end - begin)).clamp(0.0, 1.0); + t = ((t - begin) / (end - begin)).clamp(0.0, 1.0) as double; if (t == 0.0 || t == 1.0) return t; return curve.transform(t); @@ -400,7 +400,7 @@ class ElasticInCurve extends Curve { double transformInternal(double t) { final double s = period / 4.0; t = t - 1.0; - return -math.pow(2.0, 10.0 * t) * math.sin((t - s) * (math.pi * 2.0) / period); + return -math.pow(2.0, 10.0 * t) * math.sin((t - s) * (math.pi * 2.0) / period) as double; } @override @@ -427,7 +427,7 @@ class ElasticOutCurve extends Curve { @override double transformInternal(double t) { final double s = period / 4.0; - return math.pow(2.0, -10 * t) * math.sin((t - s) * (math.pi * 2.0) / period) + 1.0; + return math.pow(2.0, -10 * t) * math.sin((t - s) * (math.pi * 2.0) / period) + 1.0 as double; } @override @@ -459,7 +459,7 @@ class ElasticInOutCurve extends Curve { if (t < 0.0) return -0.5 * math.pow(2.0, 10.0 * t) * math.sin((t - s) * (math.pi * 2.0) / period); else - return math.pow(2.0, -10.0 * t) * math.sin((t - s) * (math.pi * 2.0) / period) * 0.5 + 1.0; + return math.pow(2.0, -10.0 * t) * math.sin((t - s) * (math.pi * 2.0) / period) * 0.5 + 1.0 as double; } @override diff --git a/packages/flutter/lib/src/animation/tween.dart b/packages/flutter/lib/src/animation/tween.dart index 82401c1bb2..2003cfdbdc 100644 --- a/packages/flutter/lib/src/animation/tween.dart +++ b/packages/flutter/lib/src/animation/tween.dart @@ -236,7 +236,7 @@ class Tween extends Animatable { T lerp(double t) { assert(begin != null); assert(end != null); - return begin + (end - begin) * t; + return begin + (end - begin) * t as T; } /// Returns the interpolated value for the current value of the given animation.