show method
This method is used to display the progress dialog.
This method returns Future<AdaptiveProgressDialogResult<T?>>.
The method can be awaited to get the dialog result data.
Possible states are:
-
AdaptiveProgressDialogResult with 'Success' status and data of type T returned from confirmButtonCallback.
-
AdaptiveProgressDialogResult with 'Canceled' status if the dialog was closed used Cancel button.
-
AdaptiveProgressDialogResult with 'Error' status if the confirmButtonCallback or
cancelButtonCallback
failed. -
AdaptiveProgressDialogResult with 'Closed' status if the dialog was class by tapping outside the dialog.
Implementation
Future<AdaptiveProgressDialogResult<T?>> show(BuildContext context) async {
final result = await showDialog<AdaptiveProgressDialogResult<T?>>(
context: context,
barrierDismissible: isDismissible,
builder: (context) => ProgressDialog(
title: title,
content: content,
confirmationButtonLabel: confirmationButtonLabel,
cancelButtonLabel: cancelButtonLabel,
confirmButtonCallback: confirmButtonCallback,
adaptiveProgressDialogStyle: adaptiveProgressDialogStyle,
),
);
if (result == null) return AdaptiveProgressDialogResult.closed();
return result;
}