draw method

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

Implementation

void draw(Canvas canvas, Size size, Paint paint) {
  final Rect rect = Rect.fromCenter(
      center: pos, width: particleWidth, height: particleHeight);
  paint.color = particleColor.withAlpha(lifeTime);

  fillParticleShape
      ? canvas.drawPath(
          particleShape.getOuterPath(
            rect,
          ),
          paint,
        )
      : particleShape
          .copyWith(
            side: particleShape.side.copyWith(
              color: paint.color,
            ),
          )
          .paint(
            canvas,
            rect,
          );

  velocity *= 0.9;
  lifeTime -= 4;
  velocity += acceleration;
  pos += velocity;
  acceleration *= 0;
}