showAlertDialog method
to show alert dialog to user to show alert messages to user
Implementation
void showAlertDialog(
{required String alertMessage, required BuildContext context}) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
content: Padding(
padding: const EdgeInsets.only(top: 20.0),
child: Text(
alertMessage,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
),
contentPadding: const EdgeInsets.symmetric(
horizontal: 15,
),
actionsPadding:
const EdgeInsets.symmetric(horizontal: 15, vertical: 15),
actions: [
Row(
children: [
Expanded(
child: Widgets().textButton(
onPressed: () {
Navigator.of(context).pop();
},
text: getTranslated(context, ["common", "ok"])),
),
],
)
],
);
},
);
}