paintFeature method
override
Override this method to paint the ink feature.
The transform argument gives the coordinate conversion from the coordinate system of the canvas to the coordinate system of the referenceBox.
Implementation
@override
void paintFeature(Canvas canvas, Matrix4 transform) {
final int alpha =
_fadeInController.isAnimating ? _fadeIn.value : _fadeOut.value;
final Paint paint = Paint()..color = color.withAlpha(alpha);
/// Mirror splash around [referenceBox.size.center] from [_position]
final double dx =
-(_position.dx.toDouble() - referenceBox.size.center(Offset.zero).dx);
final double dy = 0.75 *
-(_position.dy.toDouble() - referenceBox.size.center(Offset.zero).dy);
final Offset mirrorTouch = Offset.lerp(
_position,
referenceBox.size.center(
Offset(dx, dy),
),
Curves.elasticOut.transform(_radiusController.value),
);
paintInkCircle(
canvas: canvas,
transform: transform,
paint: paint,
center: mirrorTouch,
textDirection: _textDirection,
radius: _radius.value,
customBorder: _customBorder,
borderRadius: _borderRadius,
clipCallback: _clipCallback,
);
}