expressiveSettleTime function
How long spring takes to carry a 0–1 progress to rest at the kit's
designSpringTolerance: a spring route's transitionDuration. The spring drives the route's controller; the navigator only reads
the figure.
Implementation
Duration expressiveSettleTime(SpringDescription spring) {
final simulation = designSpringSimulation(spring, from: 0, to: 1);
const step = Duration.microsecondsPerMillisecond;
const limit = Duration.microsecondsPerSecond * 10;
var elapsed = 0;
while (elapsed < limit &&
!simulation.isDone(elapsed / Duration.microsecondsPerSecond)) {
elapsed += step;
}
return Duration(microseconds: elapsed);
}