Closed FilledStacks closed 1 week ago
Hey!
You're using two separate instances of the Artboard. Basically adding the event listener on an instance that is never passed to the widget. When manually creating the artboard like this, always call instance()
.
benefitOneArtboard = riveFile.artboardByName('benefit-1-view')!.instance(); // add .instance()
And remove it from the widget creation:
body: Rive(
artboard: benefitOneArtboard, // remove .instance()
useArtboardSize: true,
fit: BoxFit.cover,
enablePointerEvents: true,
),
You'll also note that the event is triggered twice in the "working" example because you've added it twice: once to the "main" loaded artboard and again on the instanced version.
Closing this issue but let me know if you run into problems.
I knew I was overlooking something silly.
Thanks Gordon!
Description
Event listeners do not fire when loading a rive animation from a file directly.
Steps To Reproduce
Clone this repo and run it.
Tapping on the button in the middle of the screen should print out an event but it doesn't.
To test that the event is set up properly you can comment out line
42 -> 47
inmain.dart
then uncomment line49 -> 64
.When tapping on the button in the middle of the screen you'll see the event printing out.
Source
.riv
/.rev
fileYou can download the .riv file here
Expected behavior
Event listeners should fire regardless of how a rive animation is loaded.
Device & Versions (please complete the following information)