LineSplash constructor

LineSplash({
  1. required MaterialInkController controller,
  2. required RenderBox referenceBox,
  3. required Color color,
  4. VoidCallback? onRemoved,
  5. Paint? newPaint,
})

Implementation

LineSplash({
  required MaterialInkController controller,
  required RenderBox referenceBox,
  required Color color,
  VoidCallback? onRemoved,
  Paint? newPaint,
}) : super(
        controller: controller,
        referenceBox: referenceBox,
        color: color,
        onRemoved: onRemoved,
      ) {
  // Start animation as soon as possible
  _progressController = AnimationController(
    duration: _kProgressDuration,
    vsync: controller.vsync,
  )
    ..addListener(controller.markNeedsPaint)
    ..forward();

  _progressAnimation = _progressController.drive(Tween<double>(
    begin: 0,
    end: 1,
  ));

  // Add this InkFeature to the controller so that this gets drawn
  controller.addInkFeature(this);

  if (newPaint == null) {
    paint = Paint()
      ..color = color
      ..strokeWidth = 4
      ..strokeCap = StrokeCap.round
      ..style = PaintingStyle.stroke;
  } else {
    paint = newPaint;
  }
}