ConfettiWidget constructor
const
ConfettiWidget({
- Key? key,
- required ConfettiController confettiController,
- double emissionFrequency = 0.02,
- int numberOfParticles = 10,
- double maxBlastForce = 20,
- double minBlastForce = 5,
- BlastDirectionality blastDirectionality = BlastDirectionality.directional,
- double blastDirection = pi,
- double gravity = 0.2,
- bool shouldLoop = false,
- bool displayTarget = false,
- List<
Color> ? colors, - Color strokeColor = Colors.black,
- double strokeWidth = 0,
- Size minimumSize = const Size(20, 10),
- Size maximumSize = const Size(30, 15),
- double particleDrag = 0.05,
- Size? canvas,
- Widget? child,
- Path createParticlePath(
- Size size
ConfettiWidget constructor.
Implementation
const ConfettiWidget({
super.key,
required this.confettiController,
this.emissionFrequency = 0.02,
this.numberOfParticles = 10,
this.maxBlastForce = 20,
this.minBlastForce = 5,
this.blastDirectionality = BlastDirectionality.directional,
this.blastDirection = pi,
this.gravity = 0.2,
this.shouldLoop = false,
this.displayTarget = false,
this.colors,
this.strokeColor = Colors.black,
this.strokeWidth = 0,
this.minimumSize = const Size(20, 10),
this.maximumSize = const Size(30, 15),
this.particleDrag = 0.05,
this.canvas,
this.child,
this.createParticlePath,
}) : assert(
emissionFrequency >= 0 &&
emissionFrequency <= 1 &&
numberOfParticles > 0 &&
maxBlastForce > 0 &&
minBlastForce > 0 &&
maxBlastForce > minBlastForce,
),
assert(gravity >= 0 && gravity <= 1,
'`gravity` needs to be between 0 and 1'),
assert(strokeWidth >= 0, '`strokeWidth needs to be bigger than 0');