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

If animationName changed from 'Untitled 1' to anything else - no playback. #36

Closed
Floul opened this issue Dec 7, 2020 · 3 comments
Closed

Comments

@Floul
Copy link

Floul commented Dec 7, 2020

If I change a name of the animation in an animation controller - animation doesn't play. If I set it back to 'Untitled 1' - animation performs as expected.

class CircularLoadingIndicator extends StatefulWidget {
  const CircularLoadingIndicator({
    Key key,
  }) : super(key: key);

  @override
  _CircularLoadingIndicatorState createState() => _CircularLoadingIndicatorState();
}

class _CircularLoadingIndicatorState extends State<CircularLoadingIndicator> with SingleTickerProviderStateMixin {
  Artboard _riveArtboard;
  RiveAnimationController _controller;

  @override
  void initState() {
    rootBundle.load(RiveElements.circularLoadingIndicator).then(
      (data) async {
        final file = RiveFile();

        if (file.import(data)) {
          final artBoard = file.mainArtboard
            ..addController(
              _controller = SimpleAnimation('Spinning')..isActive = true,  //works only if 'Untitled 1'
            );
          setState(() => _riveArtboard = artBoard);
        }
      },
    );
    super.initState();
  }

  @override
  Widget build(BuildContext context) => SizedBox(
        width: 44,
        height: 44,
        child: Rive(
          artboard: _riveArtboard,
        ),
      );

  @override
  void dispose() {
    _controller?.dispose();
    super.dispose();
  }
}
@mjohnsullivan
Copy link
Contributor

mjohnsullivan commented Dec 7, 2020

The animation name must match an animation present in the artboard and Rive file; does the file you're loading have animations with 'spinning' in the main artboard?

@mjohnsullivan
Copy link
Contributor

Can you share a Rive file that's causing the problem? Happy to take a look at it.

@mjohnsullivan
Copy link
Contributor

I'll close this for the moment, but please feel free to reach out if you're still having problems and we can assist.

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

2 participants