feat: Initial support for indeterminate progress bar #561
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is it?
As title said, this PR implement initial support for indeterminate progress bar, i.e. progress bar that continuously running.
Why?
When we are fetching data from a third party (e.g. downloading files or using web API), most of the time we don't know how big the size of data would be, so we can't determine the percentage for progress bar.
Of course we can leave the progress bar at 0% while waiting for initial response from the server. However, if initial response from server takes too long, the progress bar will stay at zero for too long which make the user think the app is lagging or crashing.
To solve this, most progress bar have indeterminate mode to let users know that the app is still working. Once there are enough data to create the percentage, the progress bar will switch to determinate mode.
How does it work?
This PR introduce a new
Option
namedStartIndeterminate
. As its name suggest, that option will make the progress bar start in indeterminate mode.If we are ready to switch to determinate mode, we can simply set the percentage using
SetPercent
formula or its alternative and the progress bar will automatically changed to determinate mode.The result.
Once this PR implemented, here is how the progress bar will looks like, compared to the one without indeterminate progress:
demo.mp4