paintFeature method Null safety

  1. @override
void paintFeature(
  1. Canvas canvas,
  2. Matrix4 transform
)
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) {
  // Mirror splash around [referenceBox.size.center] from [_position]
  final _center = referenceBox.size.center(Offset.zero);
  final _dx = -(_position.dx.toDouble() - _center.dx);
  final _dy = -(_position.dy.toDouble() - _center.dy);
  final _mirror = Offset.lerp(
    _position,
    referenceBox.size.center(Offset(_dx, _dy)),
    _bounce.transform(_radiusController.value),
  );

  // Default `Paint().color != Colors.transparent == 0x00000000`
  final _color =
      ((_rubber.color == const Color(0xff000000)) ? color : _rubber.color)
          .withAlpha(
    (_fadeInController.isAnimating ? _fadeIn.value : _fadeOut.value),
  );

  paintInkCircle(
      canvas: canvas,
      transform: transform,
      center: _mirror ?? Offset.zero,
      textDirection: _textDirection,
      radius: _radius.value,
      customBorder: _customBorder,
      borderRadius: _borderRadius,
      clipCallback: _clipCallback,
      paint: Paint()
        ..isAntiAlias = _rubber.isAntiAlias
        ..shader = _rubber.shader
        ..blendMode = _rubber.blendMode
        ..imageFilter = _rubber.imageFilter
        ..maskFilter = _rubber.maskFilter
        ..colorFilter = _rubber.colorFilter
        ..filterQuality = _rubber.filterQuality
        ..color = _color
        ..style = _rubber.style
        ..strokeWidth = _rubber.strokeWidth
        ..strokeCap = _rubber.strokeCap
        ..strokeJoin = _rubber.strokeJoin
        ..strokeMiterLimit = _rubber.strokeMiterLimit
        ..invertColors = _rubber.invertColors);
}