paintRadialReaction method

void paintRadialReaction({
  1. required Canvas canvas,
  2. Offset offset = Offset.zero,
  3. required Offset origin,
})

Used by subclasses to paint the radial ink reaction for this control.

The reaction is painted on the given canvas at the given offset. The origin is the center point of the reaction (usually distinct from the downPosition at which the user interacted with the control).

Implementation

void paintRadialReaction({
  required Canvas canvas,
  Offset offset = Offset.zero,
  required Offset origin,
}) {
  if (!reaction.isDismissed || !reactionFocusFade.isDismissed || !reactionHoverFade.isDismissed) {
    final Paint reactionPaint = Paint()
      ..color = Color.lerp(
        Color.lerp(
          Color.lerp(inactiveReactionColor, reactionColor, position.value),
          hoverColor,
          reactionHoverFade.value,
        ),
        focusColor,
        reactionFocusFade.value,
      )!;
    final Animatable<double> radialReactionRadiusTween = Tween<double>(
      begin: 0.0,
      end: splashRadius,
    );
    final double reactionRadius = isFocused || isHovered
        ? splashRadius
        : radialReactionRadiusTween.evaluate(reaction);
    if (reactionRadius > 0.0) {
      canvas.drawCircle(origin + offset, reactionRadius, reactionPaint);
    }
  }
}