Skip to content

how do I know the riv file has finished playing? #537

@remantou

Description

@remantou

I am using rive: 0.14.0-dev.8, and the RiveWidget works well.

My question is, how do I know the riv file has finished playing or if I want the riv file plays in a loop what should I do? With rive: 0.13 I can use stateMachineController.isActiveChanged.addListener(() {}) to do something.

The code is simply as follows and the controller's listener never get called.

@override 
void initState() {
    super.initState();
    var file = await File.path(somePath, riveFactory: Factory.rive);
    _controller = RiveWidgetController(file!);
    _controller!.addListener(() {
        /// never get called
        print('${_controller!.active}');
    });

    setState(() {
        _isInitialized = true;
    });
}

@override 
Widget build(BuildContext context) {
    if (!_isInitialized) {
        return CupertinoActivityIndicator();
    }

    return RiveWidget(controller: _controller!);
}

Thanks for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions