showAlert static method

void showAlert({
  1. String? title,
  2. required String message,
  3. List<Widget>? actions,
  4. Widget? content,
  5. bool? barrierDismissible,
  6. required DialogStyle dialogStyle,
})

Implementation

static void showAlert(
    {String? title,
    required String message,
    List<Widget>? actions,
    Widget? content,
    bool? barrierDismissible,
    required DialogStyle dialogStyle}) {
  showDialog(
      context: buildContext,
      routeSettings: _routeSettings,
      builder: (_) {
        return AlertDialog(
          backgroundColor: dialogStyle.backgroundColor, //Colors.white,
          title: title != null
              ? Text(
                  title,
                  style: dialogStyle.titleTextStyle,
                  // style: const TextStyle(fontSize: 17),
                )
              : const Offstage(),
          contentPadding: title != null
              ? const EdgeInsets.only(top: 15, right: 25, left: 25, bottom: 0)
              : const EdgeInsets.only(top: 0, right: 25, left: 25, bottom: 5),
          content: PopScope(
            canPop: barrierDismissible ?? true,
            onPopInvoked: (didPop) {
              if (didPop) {
                return;
              }
            },
            child: content ??
                Text(
                  message,
                  style: dialogStyle.contentTextStyle,
                  /*style: const TextStyle(
                      color: textHintColor,
                      fontWeight: FontWeight.normal,
                      fontSize: 18),*/
                ),
          ),
          contentTextStyle: dialogStyle.contentTextStyle,
          // contentTextStyle: const TextStyle(color: textHintColor, fontWeight: FontWeight.w500),
          actions: actions,
        );
      },
      barrierDismissible: barrierDismissible ?? true);
}