draw method

void draw(
  1. Canvas canvas,
  2. Size size,
  3. Paint paint
)

Implementation

void draw(Canvas canvas, Size size, Paint paint) {
  if (lifeTime <= 0) return;

  final Rect rect = Rect.fromCenter(
    center: pos,
    width: particleWidth,
    height: particleHeight,
  );

  paint
    ..color = particleColor.withAlpha(lifeTime)
    ..style = fillParticleShape ? PaintingStyle.fill : PaintingStyle.stroke;

  canvas.drawPath(particleShape.getOuterPath(rect), paint);

  velocity *= 0.9;
  lifeTime -= 4;
  velocity += acceleration;
  pos += velocity;
  acceleration = Offset.zero;
}