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

implicit-casts:false in flutter/lib/src/animation (#45501)

parent 4055e196
......@@ -167,7 +167,7 @@ abstract class Animation<T> extends Listenable implements ValueListenable<T> {
@optionalTypeArgs
Animation<U> drive<U>(Animatable<U> child) {
assert(this is Animation<double>);
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<double>);
}
@override
......
......@@ -392,7 +392,7 @@ class AnimationController extends Animation<double>
}
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<double>
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<double>
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<double>
_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)
......
......@@ -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
......
......@@ -236,7 +236,7 @@ class Tween<T extends dynamic> extends Animatable<T> {
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.
......
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