added animationController to make smooth progress animation#6
added animationController to make smooth progress animation#6fsayfitdinov wants to merge 2 commits intodjangoflow:masterfrom
Conversation
| duration: _animationDuration, | ||
| curve: Curves.ease, | ||
| ); | ||
| }); |
There was a problem hiding this comment.
the progress should be completed when the action is done.
There was a problem hiding this comment.
I have updated the code. Now the _progressAnimationController is told to animate to 1.0 (or 100%) when the action completes, regardless of whether the action was successful or not. This should ensure that the progress bar completes before switching back to the non-progress state.
lib/src/progress_builder.dart
Outdated
| setState(() { | ||
| _progress = null; | ||
| }); | ||
| _isInProgress = false; |
There was a problem hiding this comment.
How will this work properly without setState?
There was a problem hiding this comment.
The AnimatedBuilder widget listens to the AnimationController and rebuilds whenever the animation changes, therefore if _isInProgress is changed at the same time as the animation value, the AnimatedBuilder should capture that change without requiring a setState().
lib/src/progress_builder.dart
Outdated
| } | ||
| } | ||
| Widget build(BuildContext context) => AnimatedBuilder( | ||
| animation: _progressAnimationController!, |
There was a problem hiding this comment.
If the _progressAnimationController is nullable, then we should never forcefully use it without null check
There was a problem hiding this comment.
Yes, I made a mistake here. Actually the _progressAnimationController is not nullable
|
Hi @fsayfitdinov Thank you for the PR. The idea is nice. But I think the codes have some bugs. Please check my feedback. If you have any confusion please reach me on Slack. |
When progress change, there is no any smooth animation, I have added animationController to handle this