animated_icon_button icon indicating copy to clipboard operation
animated_icon_button copied to clipboard

Animation loop controller

Open aneeskA opened this issue 3 years ago • 0 comments

Excellent plugin. Is it possible to add a loop to the controller also? My use case is this: I have a download operation in progress when a button is clicked using Icons.refresh_outlined icon button. It needs to spin till the action is complete.

I created an animation controller

_controller = AnimationController(
      vsync: this, // the SingleTickerProviderStateMixin
      duration: Duration(seconds: 1),
    );

and the button as

AnimatedIconButton(
    animationController: _controller,
    icons: [
      AnimatedIconItem(
        icon: Icon(
          Icons.refresh_outlined,
          color: Colors.white,
        ),
        onPressed: () async {
          // _controller.forward();
          _controller.loop(count: 10);
          print("start");
          await InstallQuestions().Do();
          await Future.delayed(Duration(seconds: 3));
          print("end");
          _controller.stop();
        },
      ),
    ],
  ),

The plugin seems to ignore loop. Is that correct?

aneeskA avatar Feb 17 '23 02:02 aneeskA