confirm method
Future<bool>
confirm({
- BuildContext? context,
- Widget? content,
- Widget? title,
- Widget? icon,
- bool cancel = false,
- EdgeInsetsGeometry padding = const EdgeInsets.all(8),
Implementation
Future<bool> confirm({
BuildContext? context,
Widget? content,
Widget? title,
Widget? icon,
bool cancel = false,
EdgeInsetsGeometry padding = const EdgeInsets.all(8),
}) async {
var locale = MaterialLocalizations.of(context ?? this.context!);
var nav = navigator(context);
return await withChild(AlertDialog(
title: title,
icon: icon,
content: Padding(
padding: padding,
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) ??
cancel;
}