Skip to content

fix(mix): stop animation when a style drops its animation config - #1071

Merged
tilucasoli merged 1 commit into
mainfrom
fix/animation-config-removal
Oct 1, 2026
Merged

tilucasoli merged 1 commit into
mainfrom
fix/animation-config-removal

Conversation

@leoafarias

Copy link
Copy Markdown
Collaborator

Problem

StyleAnimationBuilder is always in the tree (via StyleSpecBuilder), so dropping an animation from a style goes through didUpdateWidget. When the new config is null, it recreated the driver with config ?? oldConfig. That fallback (#930) is intended for implicit animations, so a variant that removes its animation still animates back. For a looping keyframeAnimation or phaseAnimation (no trigger, so controller.repeat()), the old driver was rebuilt and kept looping forever, emitting its own specs instead of the new style. pumpAndSettle timed out and the new style never rendered.

Fix

Only CurveAnimationConfig and SpringAnimationConfig are reused as the fallback when the config is removed. Keyframe and phase configs fall through to NoAnimationDriver, which stops the loop and applies the new spec directly. The existing implicit fallback behavior and its test are unchanged.

Tests

  • Added widget tests in style_animation_builder_test.dart that go through Box/StyleBuilder: a looping keyframe animation and a looping phase animation are replaced by a plain BoxStyler. Both failed before the fix (animations still running) and pass after it.
  • fvm flutter test in packages/mix: all 2981 tests pass.
  • fvm dart analyze packages/mix: no new issues (7 pre-existing prefer_initializing_formals infos in unrelated files).

@github-actions github-actions Bot added the mix label Sep 29, 2026
@leoafarias
leoafarias changed the base branch from main to feat/blur-modifier-tile-mode September 29, 2026 04:13
@leoafarias
leoafarias force-pushed the fix/animation-config-removal branch from 08fd423 to 48fc63e Compare September 29, 2026 04:13
@leoafarias
leoafarias added this pull request to stack #1075 September 29, 2026 04:13
@leoafarias leoafarias mentioned this pull request Sep 29, 2026
3 of 4 tasks
@tilucasoli
tilucasoli force-pushed the fix/animation-config-removal branch from 48fc63e to 3390368 Compare September 29, 2026 12:26
@tilucasoli
tilucasoli force-pushed the fix/animation-config-removal branch from 3390368 to 33efa81 Compare September 29, 2026 13:20
@leoafarias
leoafarias force-pushed the fix/animation-config-removal branch from 33efa81 to aa40706 Compare September 29, 2026 15:36
@tilucasoli
tilucasoli force-pushed the fix/animation-config-removal branch from aa40706 to e5db0e6 Compare October 1, 2026 02:12
Base automatically changed from feat/blur-modifier-tile-mode to main October 1, 2026 02:57
When a style's animation config became null, StyleAnimationBuilder
recreated the driver with the previous config. For implicit configs this
animates back to the new spec, but keyframe and phase drivers produce
their own specs and loop without a trigger, so the old animation kept
running and overrode the new style.

Only curve and spring configs are now reused as a fallback; keyframe and
phase configs are dropped and the new spec is applied directly.
@tilucasoli
tilucasoli force-pushed the fix/animation-config-removal branch from e5db0e6 to 0e78421 Compare October 1, 2026 02:57
@tilucasoli
tilucasoli merged commit 7f1a486 into main Oct 1, 2026
12 checks passed
@tilucasoli
tilucasoli deleted the fix/animation-config-removal branch October 1, 2026 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants