Skip to content

Expose frame synced event callback #430

@asaworld

Description

@asaworld

Description

An event listener added using addEventListener is being called from within a paint loop. I have a button in a rive file which triggers an event. I then have code listening to this. It is failing because the event occurs within the paint loop so I cannot setState

Steps To Reproduce

void _onAnimationInit(Artboard artboard) {
StateMachineController controller = StateMachineController.fromArtboard(artboard, "Default", onStateChange: _onAnimationStateChange)!;
artboard.addController(controller);
_controller.addEventListener(_onAnimationEvent);
}

Expected behavior

Event listeners should only be called outside the paint loop

Screenshots

image

Device & Versions (please complete the following information)

  • Device: Android phone
    Flutter 3.24.4 • channel stable • https://github.com/flutter/flutter.git
    Framework • revision 603104015d (8 days ago) • 2024-10-24 08:01:25 -0700
    Engine • revision db49896cf2
    Tools • Dart 3.5.4 • DevTools 2.37.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions