snowfall_or_anythings 0.0.3 copy "snowfall_or_anythings: ^0.0.3" to clipboard
snowfall_or_anythings: ^0.0.3 copied to clipboard

A Flutter package to create snowfall or any kind of falling widgets animations.

Snowfall or Anythings #

A Flutter package to create beautiful snowfall or other particle effects in your applications.

Features #

  • Easy to use
  • Customizable particles
  • High performance

Installation #

Add the following to your pubspec.yaml file:

dependencies:
    snowfall_or_anythings: ^0.0.3

Then run flutter pub get to install the package.

Usage #

Basic Example #

class SnowPage extends StatelessWidget {
  const SnowPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Snowfall Demo'),
      ),
      body: const SnowfallOrAnythings(
        numberOfParticles: 200,
        particleSize: 4.0,
        particleSpeed: 0.8,
        particleType: ParticleType.snowflake,
      ),
    );
  }
}

Result #

https://github.com/user-attachments/assets/440c9275-88a7-409d-9f50-a3e0819c8705

Customizing Particles #

class CustomPaintpage extends StatelessWidget {
  const CustomPaintpage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('CustomPainter Demo'),
      ),
      body: SnowfallOrAnythings(
        particleColor: Colors.green,
        numberOfParticles: 150,
        particleSize: 10.0,
        particleSpeed: 2.0,
        customPainter: ({required particles}) =>
            CustomParticlePainter(particles),
      ),
    );
  }
}


class CustomParticlePainter extends CustomPainter {
  final List<Particle> particles;

  CustomParticlePainter(this.particles);

  @override
  void paint(Canvas canvas, Size size) {
    final paint = Paint();

    for (final particle in particles) {
      paint.color = particle.color;
      canvas.drawRect(
        Rect.fromCenter(
          center: Offset(particle.x, particle.y),
          width: particle.size,
          height: particle.size,
        ),
        paint,
      );
    }
  }

  @override
  bool shouldRepaint(covariant CustomPainter oldDelegate) => true;
}
2
likes
160
points
64
downloads

Publisher

verified publishervaldir.dev.br

Weekly Downloads

A Flutter package to create snowfall or any kind of falling widgets animations.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on snowfall_or_anythings