Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type 'FlutterColorFill' is not a subtype of type 'ActorNode' in type cast #45

Open
ljsalvatierra opened this issue Feb 19, 2019 · 8 comments

Comments

@ljsalvatierra
Copy link

Hi, first I would like to thank you for this amazing project, truly amazing :)

I/flutter (10799): ══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (10799): The following _CastError was thrown during a scheduler callback:
I/flutter (10799): type 'FlutterColorFill' is not a subtype of type 'ActorNode' in type cast
I/flutter (10799): 
I/flutter (10799): When the exception was thrown, this was the stack:
I/flutter (10799): #0      KeyFrameOpacity.setValue (package:flare_dart/animation/keyframe.dart:371:32)
I/flutter (10799): #1      KeyFrameNumeric.applyInterpolation (package:flare_dart/animation/keyframe.dart:134:5)
I/flutter (10799): #2      PropertyAnimation.apply (package:flare_dart/animation/actor_animation.dart:207:21)
I/flutter (10799): #3      ComponentAnimation.apply (package:flare_dart/animation/actor_animation.dart:248:27)
I/flutter (10799): #4      ActorAnimation.apply (package:flare_dart/animation/actor_animation.dart:403:26)
I/flutter (10799): #5      FlareActorRenderObject.beginFrame (package:flare_flutter/flare_actor.dart:328:23)
I/flutter (10799): #6      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:988:15)
I/flutter (10799): #7      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleBeginFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:904:11)
I/flutter (10799): #8      __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.forEach (dart:collection/runtime/libcompact_hash.dart:367:8)
I/flutter (10799): #9      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleBeginFrame (package:flutter/src/scheduler/binding.dart:902:17)
I/flutter (10799): #10     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleBeginFrame (package:flutter/src/scheduler/binding.dart:832:5)
I/flutter (10799): #14     _invoke1 (dart:ui/hooks.dart:223:10)
I/flutter (10799): #15     _beginFrame (dart:ui/hooks.dart:162:3)
I/flutter (10799): (elided 3 frames from package dart:async)

It happens when i try to transform the visibility of a FlareActor. I set the percent visible with a gesture detector.

          Transform(
            transform: new Matrix4.translationValues(
                0.0, 50.0 * (1.0 - widget.percentVisible), 0.0),
            child: new Padding(
              padding: new EdgeInsets.only(top: 20.0, bottom: 10.0),
              child: FlareActor(
                "assets/animation.flr",
                alignment: Alignment.center,
                fit: BoxFit.contain,
                animation: 'idle',
              ),
            ),
          )

Kind regards,
Luis

@umberto-sonnino
Copy link
Contributor

Hey @ljsalvatierra, thanks for the error report! Could you share the affected Flare file?

@jasonch99
Copy link

I am also getting a similar issue.
Is there any update on this?

@dnfield
Copy link
Contributor

dnfield commented Sep 18, 2020

The case that @jasonch99 is talking about is difficult to reproduce consistently.

This assignment should just never happen though, unless the class heirarchy is re-worked. FlutterFillColor inherits from FrareComponent, which is a superclass of FlareActor.

An "easy" fix would be to make it a descendent of FlareActor, but I don't know if that's correct.

@kekecorp
Copy link

Hi @dnfield and @jasonch99 - Let me check in on this today for both of you with engineering.
-Kelly (Rive CS)

@jasonch99
Copy link

@kekecorp, any update on this?

@mehmetf
Copy link
Collaborator

mehmetf commented Oct 13, 2020

We are seeing similar stack traces in other apps as well:

error: type 'FlutterActorShape' is not a subtype of type 'ActorPath' in type cast
#0      KeyFramePathVertices.applyInterpolation (package:flare_dart/animation/keyframe.dart:683)
#1      PropertyAnimation.apply (package:flare_dart/animation/actor_animation.dart:215)
#2      ComponentAnimation.apply (package:flare_dart/animation/actor_animation.dart:257)
#3      ActorAnimation.apply (package:flare_dart/animation/actor_animation.dart:411)
#4      FlareControls.advance (package:flare_flutter/flare_controls.dart:85)
#5      FlareActorRenderObject.advance (package:flare_flutter/flare_actor.dart:474)
#6      FlareActorRenderObject._instanceArtboard (package:flare_flutter/flare_actor.dart:380)
#7      FlareActorRenderObject.coldLoad (package:flare_flutter/flare_actor.dart:411)
type 'FlutterActorEllipse' is not a subtype of type 'ActorPath' in type cast
at KeyFramePathVertices.apply   (keyframe.dart:663)
at PropertyAnimation.apply      (actor_animation.dart:207)
at ComponentAnimation.apply     (actor_animation.dart:257)
at ActorAnimation.apply (actor_animation.dart:411)
at FlareControls.advance        (flare_controls.dart:85)
at FlareActorRenderObject.advance       (flare_actor.dart:474)
at FlareRenderBox._beginFrame   (flare_render_box.dart:121)

@luigi-rosso any idea under what conditions these would appear?

@luigi-rosso
Copy link
Contributor

This could happen if an animation is being applied to an artboard that it wasn't created for.

FlareActor usually takes care of maintaining valid animations for the active artboard. However, when using a custom controller it's possible for the controlling widget to change the file being displayed and not change the controller in tandem. The controller could still be applied with the wrong animation. In Rive 2 we change this around a bit by making the controller's lifecycle being tied to the artboard instead of the rendering widget, making it difficult for someone to accidentally run into this condition.

The important thing for is to make sure custom controllers are removed from the rendering widget when the file changes (change filename/artboard reference and controller in sync).

@jasonch99
Copy link

Thanks for the clarification. I will try using a new FlareControls whenever the file is changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants