import 'package:flutter/material.dart';
import 'package:particles_fly/particles_fly.dart';

class ParticleBackground extends StatelessWidget {
  final Widget child;
  final double numberOfParticles;

  const ParticleBackground({
    super.key,
    required this.child,
    this.numberOfParticles = 100,
  });

  @override
  Widget build(BuildContext context) {
    final Size size = MediaQuery.of(context).size;

    return Stack(
      children: [
        ParticlesFly(
          height: size.height,
          width: size.width,
          connectDots: true,
          numberOfParticles: numberOfParticles,
        ),
        child, // contenu au-dessus des particules
      ],
    );
  }
}
