Skip to content
This repository was archived by the owner on Nov 24, 2020. It is now read-only.

Multiple progress dialog instance in a statefull widget #35

Closed
bagus-repository opened this issue Nov 26, 2019 · 2 comments
Closed

Multiple progress dialog instance in a statefull widget #35

bagus-repository opened this issue Nov 26, 2019 · 2 comments

Comments

@bagus-repository
Copy link

bagus-repository commented Nov 26, 2019

Describe the bug
I got strange condition if I have multiple progress dialog instance in a Statefull Widget, progress dialogs instantiate on build widget like this

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),
   );

If I call progressDialog.show() or progressDownloadDialog.show(), the progressDownloadDialog will be triggered.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'make multiple instance progress dialog'
  2. Call on '.show()'
  3. See not properly showing

Expected behavior
I can use multiple ProgressDialog in a StatefullWidget

Screenshots
Not yet

Smartphone (please complete the following information):

  • Device: Pixel 3a
  • OS: Android
  • Version 10
@fayaz07
Copy link
Owner

fayaz07 commented Nov 26, 2019

just tell me one thing, why do one require two instances if the work can be done with only one instance

@fayaz07 fayaz07 closed this as completed Nov 26, 2019
@bagus-repository
Copy link
Author

Ah my bad, I do not see the source code, I think the ProgressDialogType just for this purpose

Expanded(
          child: _progressDialogType == ProgressDialogType.Normal
              ? Text(_dialogMessage,
                  textAlign: TextAlign.justify, style: _messageStyle)
              : Stack(
                  children: <Widget>[
                    Positioned(
                      child: Text(_dialogMessage, style: _messageStyle),
                      top: 30.0,
                    ),
                    Positioned(
                      child: Text("$_progress/$_maxProgress",
                          style: _progressTextStyle),
                      bottom: 10.0,
                      right: 10.0,
                    ),
                  ],
                ),
        ),

So if I can't instantiate multiple instance (Normal and Download), I would just give the type to ProgressDialogType.Normal and update the percentage in the text instead of progress property.

That's ok, thanks for replying. My suggestion is remove the Type and add child property for customize the content element (you know, just if can be done 😄 )

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants