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

Progress Dialog not hidding after API call

bagus-repository opened this issue · comments

Hey, nice package!
I can not hide the progress dialog after calling my API even isShowing = true,

But when I wrap the progressDialog.hide() with FutureDelayed 3 seconds, the dialog hidden after get my API call.

hi, sample code please

I have the same issue. If the API call (or whatever you're indicating the progress of) is too fast, the hide() call doesn't actually hide the dialog.

A sample button demonstrating the bug:

RaisedButton(
  child: Text("Test"),
  onPressed: () {
    final dialog = ProgressDialog(context);
    dialog.style(
      message: 'I\'m here to stay',
    );
    dialog.show();
    // Doing nothing inbetween here...
    // dialog.isShowing() is true
    dialog.hide();
    // dialog.isShowing() is false, but it's still showing
  },
),

I have the same issue. If the API call (or whatever you're indicating the progress of) is too fast, the hide() call doesn't actually hide the dialog.

A sample button demonstrating the bug:

RaisedButton(
  child: Text("Test"),
  onPressed: () {
    final dialog = ProgressDialog(context);
    dialog.style(
      message: 'I\'m here to stay',
    );
    dialog.show();
    // Doing nothing inbetween here...
    // dialog.isShowing() is true
    dialog.hide();
    // dialog.isShowing() is false, but it's still showing
  },
),

Yups in fast condition(show and hide simultaneously the pr not hidden).

I found another issue when defining more progress dialog, the first will always be called whatever progress dialog variable you used;

@override
  void initState() {
    super.initState();
    progressDialog = new ProgressDialog(context,
        type: ProgressDialogType.Normal, isDismissible: true, showLogs: false)
      ..style(
        message: msg ?? "Memproses...",
        borderRadius: 8.0,
        backgroundColor: Colors.white,
        elevation: 5.0,
        messageTextStyle: TextStyle(fontSize: 16.0),
        // progressWidget: CircularProgressIndicator(),
      );
    progressDownloadDialog = new ProgressDialog(context,
        isDismissible: false, type: ProgressDialogType.Download)
      ..style(
        message: "Mendownload...",
        borderRadius: 8.0,
        backgroundColor: Colors.white,
        elevation: 5.0,
        messageTextStyle: TextStyle(fontSize: 16.0),
        progress: 0.0,
        maxProgress: 100,
        progressTextStyle: TextStyle(
            color: Colors.black, fontSize: 13.0, fontWeight: FontWeight.w400),
      );
  }

@bagus-repository how can you access the context widget in initstate, when the package clearly mentions that you need to initialize in the build method

How is this issue invalid? Just put my sample code in a build method and see for yourself.

read the rules of the library again @BjoernPetersen

Are you referring to the "Navigating to next screens must be done after the completion of Future - hide()." part?

@BjoernPetersen Did you manage to solve this? I'm facing the same issue

what issue did you face @fernando-s97
can you tell me exactly what's the situation?