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!;

  final top = ((targetBounds.top - previousBounds.top) * animationPercent) +
      previousBounds.top;
  final right =
      ((targetBounds.right - previousBounds.right) * animationPercent) +
          previousBounds.right;
  final bottom =
      ((targetBounds.bottom - previousBounds.bottom) * animationPercent) +
          previousBounds.bottom;
  final 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);
}