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

FlareActor callback persisting unwanted state #276

Open
alirezava opened this issue Aug 18, 2020 · 1 comment
Open

FlareActor callback persisting unwanted state #276

alirezava opened this issue Aug 18, 2020 · 1 comment

Comments

@alirezava
Copy link

alirezava commented Aug 18, 2020

Hi,

New to flare and flutter so I might be using it wrong. But what I'm trying to do is create a simple Stateless widget that renders a background with a flare animation with a callback on completing animation. However, once the callback is set it will get called even when instantiated with a new callback (or null).

class LoginHeader extends StatelessWidget {
  final Function callback;
  final String animation;
  LoginHeader(this.callback, this.animation);

  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(
      builder: (context, constraints) => Container(
        height: constraints.maxHeight,
        width: constraints.maxWidth,
        child: FlareActor(
          "assets/flare/LoginBackground.flr",
          alignment: Alignment.topCenter,
          fit: BoxFit.fill,
          animation: animation,
          callback: this.callback,
        ),
      ),
    );
  }
}

And from a stateful widget I'm instantiating it like so

LoginHeader(loggedIn ? doSomethingElse : showLoginCard, animation)

The animation parameter does what's expected when called with a new animation string, but some reason the callback still references the previous one even if loggedIn is true. It completely ignored my doSomethingElse callback and invokes showLoginCard.

Any help would be really appreciated.

@ghost
Copy link

ghost commented Oct 26, 2020

Having similar issues. Here's my issue (if it helps): #284 (comment)

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

1 participant