paintInkCircle method

  1. @protected
void paintInkCircle(
  1. {required Canvas canvas,
  2. required Matrix4 transform,
  3. required Paint paint,
  4. required Offset center,
  5. required double radius,
  6. TextDirection? textDirection,
  7. ShapeBorder? customBorder,
  8. BorderRadius borderRadius =,
  9. RectCallback? clipCallback}

Draws an ink splash or ink ripple on the passed in Canvas.

The transform argument is the Matrix4 transform that typically shifts the coordinate space of the canvas to the space in which the ink circle is to be painted.

center is the Offset from origin of the canvas where the center of the circle is drawn.

paint takes a Paint object that describes the styles used to draw the ink circle. For example, paint can specify properties like color, strokewidth, colorFilter.

radius is the radius of ink circle to be drawn on canvas.

clipCallback is the callback used to obtain the Rect used for clipping the ink effect. If clipCallback is null, no clipping is performed on the ink circle.

Clipping can happen in 3 different ways:

  1. If customBorder is provided, it is used to determine the path for clipping.
  2. If customBorder is null, and borderRadius is provided, the canvas is clipped by an RRect created from clipCallback and borderRadius.
  3. If borderRadius is the default, then the Rect provided by clipCallback is used for clipping.

textDirection is used by customBorder if it is non-null. This allows the customBorder's path to be properly defined if it was the path was expressed in terms of "start" and "end" instead of "left" and "right".

For examples on how the function is used, see InkSplash and InkRipple.


void paintInkCircle({
  required Canvas canvas,
  required Matrix4 transform,
  required Paint paint,
  required Offset center,
  required double radius,
  TextDirection? textDirection,
  ShapeBorder? customBorder,
  BorderRadius borderRadius =,
  RectCallback? clipCallback,
}) {

  final Offset? originOffset = MatrixUtils.getAsTranslation(transform);;
  if (originOffset == null) {
  } else {
    canvas.translate(originOffset.dx, originOffset.dy);
  if (clipCallback != null) {
    final Rect rect = clipCallback();
    if (customBorder != null) {
      canvas.clipPath(customBorder.getOuterPath(rect, textDirection: textDirection));
    } else if (borderRadius != {
        topLeft: borderRadius.topLeft, topRight: borderRadius.topRight,
        bottomLeft: borderRadius.bottomLeft, bottomRight: borderRadius.bottomRight,
    } else {
  canvas.drawCircle(center, radius, paint);