Home > Back-end >  flutter how to stop confetti lopping
flutter how to stop confetti lopping

Time:12-01

I have used confetti package it works but I want to know how to stop lopping the confetti , i tried shouldloop = false; but still lopping

ConfettiWidget(

          confettiController: Ccontroller,shouldLoop: false,
          blastDirectionality: BlastDirectionality.explosive,
          blastDirection: -pi / 2,
          numberOfParticles: 30,
          gravity: 0.1,

        ),

CodePudding user response:

When I run your code on the emulator, the confetti animation stops after about 10 seconds and it doesn't loop. If you want to stop it manually after some time, you can call the stop() method on ConfettiController.

() async {
  _confettiController.play();
  await Future.delayed(Duration(seconds: 2));
  _confettiController.stop();
}
  • Related