File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,5 +53,6 @@ class ColorEffect extends ComponentEffect<HasPaint> {
5353 void reset () {
5454 super .reset ();
5555 target.getPaint (paintId).colorFilter = _original;
56+ target.onChanged ();
5657 }
5758}
Original file line number Diff line number Diff line change @@ -96,6 +96,32 @@ void main() {
9696 },
9797 );
9898
99+ testWithFlameGame (
100+ 'reset notifies the component of the restored color filter' ,
101+ (game) async {
102+ final component = TextComponent <TextPaint >(text: 'foo' );
103+ await game.ensureAdd (component);
104+
105+ final effect = ColorEffect (
106+ Colors .red,
107+ EffectController (duration: 1 ),
108+ );
109+ await component.ensureAdd (effect);
110+ game.update (0.5 );
111+ expect (
112+ component.textRenderer.style.foreground! .colorFilter,
113+ isNotNull,
114+ );
115+
116+ effect.reset ();
117+
118+ expect (
119+ component.textRenderer.style.foreground! .colorFilter,
120+ isNull,
121+ );
122+ },
123+ );
124+
99125 testWithFlameGame (
100126 'can be re-added in the component tree' ,
101127 (game) async {
You can’t perform that action at this time.
0 commit comments