-
Notifications
You must be signed in to change notification settings - Fork 6
added animationController to make smooth progress animation #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
added animationController to make smooth progress animation #6
Conversation
| duration: _animationDuration, | ||
| curve: Curves.ease, | ||
| ); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the progress should be completed when the action is done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How will this work properly without setState?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the _progressAnimationController is nullable, then we should never forcefully use it without null check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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