ContextDialogExtensions extension

Extensions for showing dialogs from BuildContext.

Example:

await context.showAlertDialog(
  title: 'Notice',
  message: 'Your session has expired.',
);
on

Methods

hideDialog() → void

Available on BuildContext, provided by the ContextDialogExtensions extension

Dismisses the currently shown dialog.
showAlertDialog({required String title, required String message, String confirmLabel = 'OK', bool barrierDismissible = true}) Future<void>

Available on BuildContext, provided by the ContextDialogExtensions extension

Shows a simple alert dialog with a title and message.
showConfirmDialog({required String title, required String message, String confirmLabel = 'Confirm', String cancelLabel = 'Cancel', bool isDestructive = false, bool barrierDismissible = false}) Future<bool>

Available on BuildContext, provided by the ContextDialogExtensions extension

Shows a confirmation dialog with confirm and cancel buttons.
showCustomDialog<T>({required WidgetBuilder builder, bool barrierDismissible = true}) Future<T?>

Available on BuildContext, provided by the ContextDialogExtensions extension

Shows a custom dialog with a fully custom widget.
showLoadingDialog({String message = 'Loading...', bool barrierDismissible = false}) → void

Available on BuildContext, provided by the ContextDialogExtensions extension

Shows a loading dialog with a spinner and optional message.