showAlertDialog static method

Future<void> showAlertDialog({
  1. required String msg,
  2. String eors = "E",
})

Implementation

static Future<void> showAlertDialog(
    {required String msg, String eors = "E"}) async
{
  String title = 'msg_title_Attention'.tr;
  if (eors == "S") title = 'msg_title_Information'.tr;
  return showDialog(
      context: Get.context!,
      barrierDismissible: false,
      builder: (BuildContext context) {
        return AlertDialog(
          title: Text(
            title,
            textAlign: TextAlign.center,
            style: TextStyle(
              color: (eors == "S") ? Colors.black : Colors.red,
            ),
          ), // textScaleFactor: 1.0,
          content: Text(msg),
          contentPadding: const EdgeInsets.only(
              left: 10.0, right: 10.0, top: 5.0, bottom: 5.0),
          actions: <Widget>[
            MyElevatedButton(
              style: elevatedButtonNormal(
                backgroundColor: (eors == "S") ? Colors.green : Colors.red,
                textColor: Colors.white,
              ),
              child: const Text('OK'),
              onPressed: () {
                Navigator.pop(context);
              },
            ),
          ],
        );
      });
}