QuickAlert icon indicating copy to clipboard operation
QuickAlert copied to clipboard

Support for Dynamic Component Updates

Open MDeLuise opened this issue 11 months ago • 0 comments

Describe the bug

It is not currently possible to dynamically update components (e.g., progress bars or percentage text) inside the QuickAlert dialog. Since QuickAlert.show does not return a widget or expose mechanisms to refresh its child widget tree, dynamic updates during operations like file downloads are not reflected in the UI.

To Reproduce

Steps to reproduce the behavior:

  1. Attempt to display a QuickAlert dialog for an operation (e.g., a file download).
  2. Add a child widget inside the QuickAlert dialog, such as a LinearProgressIndicator, and try to update its state dynamically.
  3. Observe that the UI does not refresh or reflect changes to the widget’s state.

Minimal example:

QuickAlert.show(
  context: context,
  type: QuickAlertType.custom,
  title: 'Downloading...',
  text: 'This might take a few minutes. Please do not close the app.',
  widget: Column(
    children: [
      const SizedBox(height: 10),
      StatefulBuilder(builder: (context, setState) {
        return Column(
          children: [
            LinearProgressIndicator(value: progress), // progress updates externally
            const SizedBox(height: 10),
            Text('${(progress * 100).toStringAsFixed(1)}% completed'),
          ],
        );
      }),
    ],
  ),
  showCancelBtn: false,
);

Behavior:

The LinearProgressIndicator and the Text do not update as the progress value changes.

Expected behavior:

QuickAlert should allow updating its child widgets dynamically, providing a way to reflect state changes during long-running operations like file downloads.

MDeLuise avatar Jan 27 '25 13:01 MDeLuise