confirm method
Future<bool>
confirm({
- required BuildContext context,
- Widget? content,
- Widget? title,
- bool defaultValue = false,
Implementation
Future<bool> confirm({
required BuildContext context,
Widget? content,
Widget? title,
bool defaultValue = false,
}) async {
var locale = MaterialLocalizations.of(context);
var nav = navigator(context);
return await withChild(AlertDialog(
title: title,
content: Padding(
padding: const EdgeInsets.all(8),
child: content,
),
actions: [
TextButton(
onPressed: () => nav.pop(true),
child: Text(locale.okButtonLabel)),
TextButton(
onPressed: () => nav.pop(false),
child: Text(locale.cancelButtonLabel))
],
)).prompt<bool>(context: context) ??
defaultValue;
}