buildAnimation method
      
void
buildAnimation({ 
    
- required Duration delay,
- required bool animate,
- required bool manualTrigger,
- required bool infinite,
- Function? onFinish,
- dynamic controllerCallback(- AnimationController controller
 
inherited
    Builds and controls the animation based on the provided parameters.
This method handles:
- Delayed animation start
- Infinite animation loops
- Animation reversal
- Manual animation control
Parameters:
- delay: Duration to wait before starting the animation
- animate: Whether the animation should start automatically
- manualTrigger: Whether animation requires manual triggering
- infinite: Whether animation should loop infinitely
- onFinish: Callback function when animation completes
- controllerCallback: Callback to access the animation controller
Implementation
void buildAnimation({
  required Duration delay,
  required bool animate,
  required bool manualTrigger,
  required bool infinite,
  Function? onFinish,
  Function(AnimationController controller)? controllerCallback,
}) {
  /// Launch the animation ASAP or wait until needed
  print("animate: $animate");
  if (animate && !manualTrigger) {
    // controller.value = 0;
    Future.delayed(delay, () {
      if (disposed) return;
      if (infinite) {
        controller.repeat();
        return;
      }
      (animate) ? controller.forward() : controller.reverse();
    });
  }
  /// If the animation already happen, we can animate it back
  if (!animate) {
    if (disposed) return;
    if (infinite) {
      controller.stop();
      return;
    }
    // If the animation is finished, we need to reset the animation to the original state
    // after the animation is finished just for the following classes:
    if (resetAnimationClasses.contains(this.runtimeType) && !isFirstTime) {
      controller.value = 0;
      return;
    }
    controller.animateBack(0);
    isFirstTime = false;
  }
}