Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confetti package animation not displaying correctly upon scroll #59

Open
Aristidios opened this issue Nov 22, 2021 · 5 comments
Open

Confetti package animation not displaying correctly upon scroll #59

Aristidios opened this issue Nov 22, 2021 · 5 comments

Comments

@Aristidios
Copy link

I'm using Package Confetti 0.6.0 ConfettiWidget() within Card()s generated in a GridView.builder

Upon scroll the animation stops working properly & even vanishes if I scroll too much.

SliverGrid with Confetti Animation

I thought the issue had to do with lazy loading, so I tried two other particle animation widgets:

  1. Particles 0.1.4 and
  2. Animated Background 2.0.0

Both of which worked fine, displaying correct animation - even through scrolling.

-> It could be just an issue with Package Confetti 0.6.0, but I think the problem might come from the way I'm initializing the ConfettiController and calling .play() method & disposing of it.

Here is my complete simplified code:

class HomePage extends StatefulWidget {
  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  late ConfettiController _controllerCenter;

  @override
  void initState() {
    super.initState();
    _controllerCenter =
        ConfettiController(duration: const Duration(seconds: 1000));
    _controllerCenter.play();
  }

  @override
  void dispose() {
    _controllerCenter.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: SafeArea(
        child: new GridView.builder(
          itemCount: 30,
          itemBuilder: (BuildContext context, int index) {
            return Card(
              child: Center(
// 
                child: ConfettiWidget(
                  confettiController: _controllerCenter,
                  shouldLoop: true,
                ),
//
              ),
            );
          },
          gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
            crossAxisCount: 2,
          ),
        ),
      ),
    );
  }
}

-> I'd like to keep the animation running despite scrolling through the GridView.

I need to use a GridView.builder or GridView.count as data within the cards will be populated with Firebase Data.

@Bhat015
Copy link

Bhat015 commented Dec 24, 2021

Any update on this?
Facing similar issue.

@roubachof
Copy link

Same for me..

@jaskiratAtNexG
Copy link

same issue any update??

@Eerey
Copy link

Eerey commented Sep 2, 2022

I'm facing similar issues. It looks like theres some problem when the size of the confetti area is calculated.

@jaskiratAtNexG
Copy link

jaskiratAtNexG commented Sep 2, 2022

@Eerey canvas: const Size(double.infinity, double.infinity),
use canvas like this and this issue will resolve.
canvas property of Confetti widget

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants