showCustomAlertDialog static method

Future<bool?> showCustomAlertDialog(
  1. BuildContext context,
  2. String message, {
  3. String? title,
  4. bool isActionCancel = false,
  5. double elevation = 4.0,
  6. Color primaryColor = Colors.white54,
})

Implementation

static Future<bool?> showCustomAlertDialog(BuildContext context, String message,
    {String? title, bool isActionCancel = false, double elevation = 4.0,
      Color primaryColor = Colors.white54}) {
  final List<Widget> actions = [];
  if (isActionCancel)
    actions.add(addAction(context, MultiLanguage.get(CoreLanguageKey.btnCancel), false, Colors.grey, elevation));

  actions.add(addAction(context, MultiLanguage.get(CoreLanguageKey.btnOK), true, primaryColor, elevation));

  return showDialog(context: context, barrierDismissible: false, barrierColor: Colors.black12,
      builder: (context) => AlertDialog(actionsPadding: EdgeInsets.all(8.sp),
          title: Text(title??MultiLanguage.get(CoreLanguageKey.ttlWarning), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.sp)),
          content: Text(message, style: TextStyle(fontSize: 14.sp)), actions: actions));
}