show static method

Future<bool?> show(
  1. BuildContext context, {
  2. required String title,
  3. String? message,
  4. String confirmLabel = 'Confirm',
  5. String cancelLabel = 'Cancel',
})

Show a confirmation dialog.

Returns true if the user confirmed, false (or null) if cancelled.

Implementation

static Future<bool?> show(
  BuildContext context, {
  required String title,
  String? message,
  String confirmLabel = 'Confirm',
  String cancelLabel = 'Cancel',
}) {
  return Navigator.of(context).showDialog<bool>(
    builder: (ctx) => DialogConfirm(
      title: title,
      message: message,
      confirmLabel: confirmLabel,
      cancelLabel: cancelLabel,
      onConfirm: () {
        Navigator.of(ctx).pop(true);
        return null;
      },
      onCancel: () {
        Navigator.of(ctx).pop(false);
        return null;
      },
    ),
  );
}