fayaz07 / progress_dialog

A light weight library to easily manage a progress dialog with simple steps whenever you need to do it. You can easily show and hide it.

Home Page:https://fayaz07.github.io/progress_dialog/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow to await for the dialog show

neokree opened this issue · comments

Problem statement
I use the progress dialog to keep the user informed of a blocking operation.
So the progress dialog must be showed and hidden after an operation, but if the operation is async but terminates very quickly, the dialog is not hidden, because the showDialog method (used internally in the .show()) does not have finished showing the dialog.

Describe the solution you'd like
I would like to be allow to await the .show() method, like this

ProgressDialog dialog = ...; 
await dialog.show();

// do some work ...

await dialog.hide();

good idea, but call funciton require async.

good idea, but call funciton require async.

Yeah sure, it is the main point of doing it.
Obviously you could also use the .then() method and chaining the Futures, but I think it is more readable this way.

Until this issue is resolved, you can use
await Future.delayed(Duration(seconds: 1));
for allowing the dialog to pop up

Could we get a new release with the fixed version?

By the way (for the impatient), a workaround until then:

pubspec.yaml

dependencies:
  progress_dialog:
    git: https://github.com/fayaz07/progress_dialog.git

Update v1.2.1 is live, please checkout