bounceTranslate property

double get bounceTranslate

弹性处理后的坐标变化

Implementation

double get bounceTranslate {
  if (widget._bounceStyle.maxDistance == 0) {
    return translateX.clamp(-maxDragDistance, 0.0);
  }
  var resultTranslate = translateX;
  // 超伸状态
  if (resultTranslate < -maxDragDistance) {
    var moreDistance = resultTranslate + maxDragDistance;
    resultTranslate -= moreDistance * widget._bounceStyle.k;
  }
  return min(
      0,
      resultTranslate.clamp(
          -maxDragDistance - widget._bounceStyle.maxDistance, 0.0));
}