Skip to content
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

feat: Initial support for indeterminate progress bar #561

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

RadhiFadlillah
Copy link

@RadhiFadlillah RadhiFadlillah commented Jul 19, 2024

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 named StartIndeterminate. 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

@RadhiFadlillah RadhiFadlillah marked this pull request as ready for review July 19, 2024 16:05
@caarlos0 caarlos0 added the enhancement New feature or request label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants