Skip to content

Feature/controller-enhancements#32

Open
ben-fornefeld wants to merge 5 commits intomainfrom
feature/controller-enhancements
Open

Feature/controller-enhancements#32
ben-fornefeld wants to merge 5 commits intomainfrom
feature/controller-enhancements

Conversation

@ben-fornefeld
Copy link
Copy Markdown
Owner

@ben-fornefeld ben-fornefeld commented Oct 5, 2025

Note

Implemented by @msamoeed in #25

Enhanced MeshGradientController with Integrated Sequence Repetition

Changes

  • Modified animateSequence method to include repeatCount and pauseBetweenRepeats parameters
  • Integrated sequence repetition functionality directly into animateSequence
  • Removed separate repeatSequenceAnimation method
  • Refactored animateSequence for better code organization and reusability

Motivation

This update streamlines the API for animating mesh gradient sequences by incorporating repetition functionality directly into the animateSequence method. It simplifies usage and reduces code duplication while maintaining flexibility for complex animations.

Impact

  • Improved API consistency and ease of use
  • Enhanced control over sequence animations with built-in repetition
  • Reduced method count in the controller class

Usage Example

controller.animateSequence(
  duration: Duration(seconds: 2),
  sequences: [/* ... */],
  repeatCount: 3,
  pauseBetweenRepeats: Duration(milliseconds: 500),
);

This PR enhances the MeshGradientController's capabilities while simplifying its interface, making it more intuitive for developers to create complex, repeating gradient animations.

to avoid calling the dispose method if controller already disposed.
also added condition to cancel all animations before disposing the controller to avoid any exceptions.
to avoid it being called twice on navigation.
cursor[bot]

This comment was marked as outdated.

@ben-fornefeld ben-fornefeld self-assigned this Oct 5, 2025
cursor[bot]

This comment was marked as outdated.

@ben-fornefeld
Copy link
Copy Markdown
Owner Author

bugbot run

} catch (e) {
rethrow;
} finally {
isAnimating.value = _activeAnimationControllers.isNotEmpty;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Animation Controller Leak in Animation Methods

The animatePoint and animateSequence methods can leak AnimationController instances. If an exception occurs after a controller is added to _activeAnimationControllers but before its completion listener removes it, the controller remains in the list. This prevents disposal, leading to a memory leak and an inaccurate isAnimating state.

Additional Locations (1)

Fix in Cursor Fix in Web

controller.dispose();
}
_activeAnimationControllers.clear();
isAnimating.value = false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Animation Controller Disposal Causes Concurrent Modification

In stopAllAnimations, calling controller.stop() triggers the animation's status listener. This listener disposes the controller and removes it from _activeAnimationControllers, causing a double disposal and a concurrent modification error while iterating the list.

Fix in Cursor Fix in Web

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