Unverified Commit 5ccd4f34 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

implicit-casts:false in flutter/lib/src/physics (#45622)

parent 37f9c541
...@@ -48,10 +48,10 @@ class ClampedSimulation extends Simulation { ...@@ -48,10 +48,10 @@ class ClampedSimulation extends Simulation {
final double dxMax; final double dxMax;
@override @override
double x(double time) => simulation.x(time).clamp(xMin, xMax); double x(double time) => simulation.x(time).clamp(xMin, xMax) as double;
@override @override
double dx(double time) => simulation.dx(time).clamp(dxMin, dxMax); double dx(double time) => simulation.dx(time).clamp(dxMin, dxMax) as double;
@override @override
bool isDone(double time) => simulation.isDone(time); bool isDone(double time) => simulation.isDone(time);
......
...@@ -65,7 +65,7 @@ class FrictionSimulation extends Simulation { ...@@ -65,7 +65,7 @@ class FrictionSimulation extends Simulation {
// Solving for D given x(time) is trickier. Algebra courtesy of Wolfram Alpha: // Solving for D given x(time) is trickier. Algebra courtesy of Wolfram Alpha:
// x1 = x0 + (v0 * D^((log(v1) - log(v0)) / log(D))) / log(D) - v0 / log(D), find D // x1 = x0 + (v0 * D^((log(v1) - log(v0)) / log(D))) / log(D) - v0 / log(D), find D
static double _dragFor(double startPosition, double endPosition, double startVelocity, double endVelocity) { static double _dragFor(double startPosition, double endPosition, double startVelocity, double endVelocity) {
return math.pow(math.e, (startVelocity - endVelocity) / (startPosition - endPosition)); return math.pow(math.e, (startVelocity - endVelocity) / (startPosition - endPosition)) as double;
} }
@override @override
...@@ -116,7 +116,7 @@ class BoundedFrictionSimulation extends FrictionSimulation { ...@@ -116,7 +116,7 @@ class BoundedFrictionSimulation extends FrictionSimulation {
@override @override
double x(double time) { double x(double time) {
return super.x(time).clamp(_minX, _maxX); return super.x(time).clamp(_minX, _maxX) as double;
} }
@override @override
......
...@@ -196,7 +196,7 @@ class _CriticalSolution implements _SpringSolution { ...@@ -196,7 +196,7 @@ class _CriticalSolution implements _SpringSolution {
@override @override
double dx(double time) { double dx(double time) {
final double power = math.pow(math.e, _r * time); final double power = math.pow(math.e, _r * time) as double;
return _r * (_c1 + _c2 * time) * power + _c2 * power; return _r * (_c1 + _c2 * time) * power + _c2 * power;
} }
...@@ -266,13 +266,13 @@ class _UnderdampedSolution implements _SpringSolution { ...@@ -266,13 +266,13 @@ class _UnderdampedSolution implements _SpringSolution {
@override @override
double x(double time) { double x(double time) {
return math.pow(math.e, _r * time) * return (math.pow(math.e, _r * time) as double) *
(_c1 * math.cos(_w * time) + _c2 * math.sin(_w * time)); (_c1 * math.cos(_w * time) + _c2 * math.sin(_w * time));
} }
@override @override
double dx(double time) { double dx(double time) {
final double power = math.pow(math.e, _r * time); final double power = math.pow(math.e, _r * time) as double;
final double cosine = math.cos(_w * time); final double cosine = math.cos(_w * time);
final double sine = math.sin(_w * time); final double sine = math.sin(_w * time);
return power * (_c2 * _w * cosine - _c1 * _w * sine) + return power * (_c2 * _w * cosine - _c1 * _w * sine) +
......
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