ertgrulll / advstory

An advanced, complete story viewer for Flutter. Has support for images, videos, custom widget contents, gestures, interceptors, listeners, manipulators and much more.
https://advstory.sourcekod.com
MIT License
41 stars 33 forks source link

progress bar frozens while calling on api inside iconbuttom of footer #38

Open surajpaudelNEPAL opened 1 year ago

surajpaudelNEPAL commented 1 year ago

Describe the bug

While calling an api call inside a iconButton callback in footer 2 things happens:

  1. if I am not using async/await in iconButton callback with advcontroller.pause() before API call and advcontroller.resume() after API call frozen the progress bar but does not thorws any error and moves to next content without resuming the progressbar.
  2. if I am using async/await in iconbuttom callback with advcontroller.pause() before API call and advcontroller.resume() after API call it gives me following error for advcontroller.resume() : AssertionError ('package:flutter/src/animation/animation_controller.dart': Failed assertion: line 527 pos 7: '_ticker != null': AnimationController.animateTo() called after AnimationController.dispose() AnimationController methods should not be used after calling dispose.)

To Reproduce Steps to reproduce the behavior: here is my implementation of logic: IconButton( onPressed: () async { storyController.pause(); await ref .read(storyProvider .notifier) .likePostById( postId: currentStory .id); storyController .resume();

                                                },
                                                icon: Icon(
                                                  Icons.favorite,)),

Expected behavior to freeze the progress indicator while calling API and resume after completing the API

versions