showSmartConfirmDialog function
Shows an adaptive confirmation dialog.
Returns true if the user confirmed, false otherwise.
Implementation
Future<bool> showSmartConfirmDialog({
required BuildContext context,
String? title,
String? content,
Widget? contentWidget,
String confirmLabel = 'OK',
String cancelLabel = 'Cancel',
bool isDestructive = false,
bool forceMaterial = false,
bool forceCupertino = false,
}) async {
final result = await showSmartDialog<bool>(
context: context,
title: title,
content: content,
contentWidget: contentWidget,
forceMaterial: forceMaterial,
forceCupertino: forceCupertino,
actions: [
SmartDialogAction(
label: cancelLabel,
onPressed: () => Navigator.of(context).pop(false),
),
SmartDialogAction(
label: confirmLabel,
isDestructive: isDestructive,
isDefault: true,
onPressed: () => Navigator.of(context).pop(true),
),
],
);
return result ?? false;
}