launchAssuredConfirmDialog function
Future<void>
launchAssuredConfirmDialog(- BuildContext context,
- {required String message,
- required String title,
- Icon icon = const Icon(Icons.warning_amber_rounded),
- void onCancel(
)?,
- required void onConfirm(
)}
)
Implementation
Future<void> launchAssuredConfirmDialog(BuildContext context,
{required String message,
required String title,
Icon icon = const Icon(Icons.warning_amber_rounded),
void Function()? onCancel,
required void Function() onConfirm}) async {
Debug().info(
"Launching a ASSURED_CONFIRM_DIALOG with [$message] for ${message.hashCode}");
final String requiredWord = LocaleUtils.RANDOM_WORDS
.elementAt(Random().nextInt(LocaleUtils.RANDOM_WORDS.length));
await showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) =>
AssuredConfirmDialogViewInput(
message: message,
title: title,
icon: icon,
requiredWord: requiredWord,
onCancel: () {
Debug().info(
"ASSURED_CONFIRM_DIALOG [${message.hashCode}] ended with DENY");
onCancel?.call();
},
onConfirm: () {
Debug().info(
"ASSURED_CONFIRM_DIALOG [${message.hashCode}] ended with CONFIRM");
onConfirm.call();
}));
}