updateProgressDialogBox static method
Updates an existing progress dialog with a new progress value.
Closes the current progress dialog and immediately shows a new one with the updated progress percentage. Used for tracking upload/download progress with visual feedback.
Parameters:
progress: Progress value as a percentage (0.0 to 100.0)
Displays the progress as a percentage with one decimal place.
Example:
// Show initial dialog
RtCommonFunction.showProgressDialogBox(text: 'Starting upload...');
// Update progress as upload proceeds
RtCommonFunction.updateProgressDialogBox(25.5); // "Uploading Image... 25.5%"
RtCommonFunction.updateProgressDialogBox(50.0); // "Uploading Image... 50.0%"
RtCommonFunction.updateProgressDialogBox(100.0); // "Uploading Image... 100.0%"
// Close dialog when complete
Get.back();
Note: This method calls Get.back() to close the previous dialog before
showing the updated one. Ensure a progress dialog is already showing.
See also:
- showProgressDialogBox for the initial dialog
Implementation
static void updateProgressDialogBox(double progress) {
WidgetsBinding.instance.addPostFrameCallback((_) {
// Find the dialog and update the progress value
Get.back();
Get.dialog(
AlertDialog(
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
CircularProgressIndicator(value: progress),
const SizedBox(height: 10),
Text('Uploading Image... ${progress.toStringAsFixed(1)}%'),
],
),
),
);
});
}