showError function
Implementation
void showError({
required BuildContext context,
required String title,
required String content,
required VoidCallback onOkPressed,
}) {
// Set up the Exit button
Widget ExitButton = TextButton(
child: const Text('Exit'),
onPressed: () {
// Execute the custom behavior
onOkPressed();
},
);
// Set up the AlertDialog
AlertDialog alert = AlertDialog(
title: Row(
children: [
const Icon(Icons.warning, color: Colors.red),
const SizedBox(width: 20),
Text(title),
],
),
content: MarkdownBody(
data: wordWrap(content),
selectable: true,
softLineBreak: true,
),
actions: [
ExitButton,
],
);
// Show the dialog
showDialog(
context: context,
builder: (BuildContext context) {
return alert;
},
);
}