updateAnimationPercent method

  1. @override
void updateAnimationPercent(
  1. BaseBarRendererElement previous,
  2. BaseBarRendererElement target,
  3. double animationPercent
)

Implementation

@override
void updateAnimationPercent(BaseBarRendererElement previous,
    BaseBarRendererElement target, double animationPercent) {
  final localPrevious = previous as BarRendererElement<D>;
  final localTarget = target as BarRendererElement<D>;

  final previousBounds = localPrevious.bounds!;
  final targetBounds = localTarget.bounds!;

  var top = ((targetBounds.top - previousBounds.top) * animationPercent) +
      previousBounds.top;
  var right =
      ((targetBounds.right - previousBounds.right) * animationPercent) +
          previousBounds.right;
  var bottom =
      ((targetBounds.bottom - previousBounds.bottom) * animationPercent) +
          previousBounds.bottom;
  var left = ((targetBounds.left - previousBounds.left) * animationPercent) +
      previousBounds.left;

  bounds = Rectangle<int>(left.round(), top.round(), (right - left).round(),
      (bottom - top).round());

  roundPx = localTarget.roundPx;

  super.updateAnimationPercent(previous, target, animationPercent);
}