onScaleEnd method
Called when a scale gesture ends.
Implementation
void onScaleEnd(ScaleEndDetails details) {
if (!inertiaEnabled || _scaledDuringGesture || _ticker == null) return;
final velocity = details.velocity.pixelsPerSecond;
final speed = velocity.distance;
if (speed < kMinFlingVelocity) return;
_stopAnimation();
final direction = velocity / speed;
var lastPosition = 0.0;
final animation = AnimationController.unbounded(vsync: _ticker!);
_activeAnimation = animation;
animation.addListener(() {
final delta = animation.value - lastPosition;
lastPosition = animation.value;
_gsTopLeftOffset -= direction * delta / _scale;
markDirty();
});
animation
.animateWith(FrictionSimulation(inertiaFrictionCoefficient, 0, speed))
.whenCompleteOrCancel(() => _disposeAnimation(animation));
}