showAlertDialog function
Future<bool?>
showAlertDialog(
- BuildContext context, {
- String? title,
- String? subtitle,
- String? confirmButtonLabel,
Implementation
Future<bool?> showAlertDialog(
BuildContext context, {
String? title,
String? subtitle,
String? confirmButtonLabel,
}) {
final intl = SunnyIntl.of(context);
return showPlatformDialog<bool>(
context: context,
barrierDismissible: true,
builder: (context) {
return PlatformAlertDialog(
title: Text(title ?? intl!.areYouSure),
content: subtitle == null
? null
: Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Text(
subtitle,
style: TextStyle(height: 16 / 14),
),
),
actions: [
PlatformDialogAction(
key: Key("confirm-yes"),
child: Text(confirmButtonLabel ?? "OK"),
cupertino: (context, _) => CupertinoDialogActionData(
isDefaultAction: true, isDestructiveAction: false),
onPressed: () async {
Navigator.of(context).pop(true);
},
).build(context)
],
);
},
);
}