Skip to content

Unable to change stroke color at runtime after upgrading to 0.14.0 #596

@kunboy1608

Description

@kunboy1608

Hi,

In version 0.13.20, I was able to change the stroke color at runtime using the following snippet:

RiveAnimation.asset(
          riveAsset.src,
          artboard: riveAsset.artboard,
          onInit: (Artboard artboard) {
            final StateMachineController controller = RiveUtils.getController(
              artboard,
              stateMachine: riveAsset.stateMachineName,
            );
            artboard.forEachComponent((child) {
              if (child is Stroke) {
                child.paint.color = Theme.of(context).colorScheme.primary;
              }
            });
            riveAsset.input = controller.findSMI("active");
          },
 )

After upgrading to 0.14.0, I can’t find a way to achieve the same behavior. I checked the documentation and source code but couldn’t locate an equivalent approach.

Question:
Is there a supported way to change stroke color at runtime in version 0.14.0 or later? If not, is there an alternative recommended approach?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions