22d ago

Flutter update issue

I have a project with a menu in a nested artboard. The menu artboard contains buttons as nested artboards. Each button artboard has listeners for pointer input. In the editor and in the browser everything works as expected, but in Flutter the listeners do not work. However, if I add a random repeating animation to any of the artboards, everything works. Are nested artboards maybe not initialised as active in the Flutter runtime?

6 replies
M
+1
14d ago

Hi ! Sorry for the late reply, shared this with our developers, hope this will be resolved soon.

13d ago

Hi , can you share the code your using along with the .riv/.rev file.

Some things that could be going wrong:

  • Not using an up-to-date version of the Rive Flutter runtime

  • If you are manually initializing/creating an artboard in Flutter, be sure to call .instance() on the artboard

  • You could potentially be adding multiple state machine controllers to the same artboard and they are competing against each other.

If you need to share the files privately you can reach out to our support: https://rive.atlassian.net/servicedesk/customer/portals

M
12d ago
RiveAnimation.asset(
          behavior: RiveHitTestBehavior.translucent,
          useArtboardSize: true,
          'assets/animations/navigation.riv',
          alignment: Alignment.center,
          fit: BoxFit.fitWidth,
          onInit: onRiveInit,
        ),
void onRiveInit(Artboard artboard) {
    usedArtboard = artboard;

    final riveController =
        StateMachineController.fromArtboard(usedArtboard, 'Brugt');

    artboard.addController(riveController!);

    buttonCount = riveController.getNumberInput('Count')!;

    riveVisible = riveController.getBoolInput('Visible');
    bottonLogo = riveController.getBoolInput('Logo');

    buttonSelected = riveController.getNumberInput('Selected');

    buttonOneColor = riveController.getNumberInput('B1Color');
    buttonTwoColor = riveController.getNumberInput('B2Color');
    buttonThreeColor = riveController.getNumberInput('B3Color');

    usedArtboard.setTextRun('Menu/Button 1/Label', 'Køb');
    usedArtboard.setTextRun('Menu/Button 2/Label', 'Brugt');
    usedArtboard.setTextRun('Menu/Button 3/Label', 'Salg');

    riveController.addEventListener(onRiveEvent);
  }

This is the Flutter code - please tell me if I can give you more information that will help.

Thanks

8d ago

Hi Thanks for your reply.
I've shared the .rev file as instructed, the reference is RIV-4908. As for your suggestions:

  • Everything is updated

  • We're not. The implementation is posted above, but the problem persists with a minimal implementation

  • This gave me a massive headache, since it's not apparent that the StateMachines designation in the widget parameters is the same as a state machine controller. The implementation stuff in Flutter generally seems overly complicated and convoluted and I hope it'll be simplified at some point. This is not the issue with the nested listeners, however.

I'm equally sorry for the late reply, but hope to hear from you soon. I still love Rive.❤️

7d ago

Hey , thanks for sharing! We will be launching a new version of the Flutter runtime soon, which should simplify the API a lot and will keep the above in consideration. This version of the Flutter runtime is unique as there is a lot of shared code between the runtime and the Rive editor.

I can reproduce your issue, and we will investigate it. Thanks for reporting.

4d ago

Great!