DangerAlertBox constructor

DangerAlertBox({
  1. BuildContext? context,
  2. String? title,
  3. String? messageText,
  4. Color? titleTextColor,
  5. Color? messageTextColor,
  6. Color? buttonColor,
  7. String? buttonText,
  8. Color? buttonTextColor,
  9. IconData? icon,
})

Implementation

DangerAlertBox(
    {this.context,
    this.title,
    this.messageText,
    this.titleTextColor,
    this.messageTextColor,
    this.buttonColor,
    this.buttonText,
    this.buttonTextColor,
    this.icon}) {
  showDialog(
      barrierDismissible: false,
      context: context!,
      builder: (BuildContext context) {
        return SimpleDialog(
          shape: Border(left: BorderSide(width: 2, color: Color(0xFFFF5455))),
          title: Row(
            children: <Widget>[
              Icon(
                Icons.error,
                color: titleTextColor ?? Color(0xFFFF5455),
              ),
              SizedBox(
                width: 4.0,
              ),
              Flexible(
                child: Text(
                  title ?? "Your alert title",
                  style: TextStyle(
                      fontWeight: FontWeight.w600,
                      color: titleTextColor ?? Color(0xFF4E4E4E)),
                ),
              )
            ],
          ),
          contentPadding: const EdgeInsets.fromLTRB(24, 12, 24, 12),
          children: <Widget>[
            Text(
              messageText ?? "Alert message here",
              style: TextStyle(color: messageTextColor),
            ),
            Row(
              mainAxisAlignment: MainAxisAlignment.end,
              children: <Widget>[
                TextButton(
                  style: ButtonStyle(
                      backgroundColor: MaterialStateProperty.all(
                          buttonColor ?? Color(0xFFFF5455))),
                  onPressed: () {
                    Navigator.of(context).pop();
                  },
                  child: Text(
                    buttonText ?? "Close",
                    style: TextStyle(color: buttonTextColor ?? Colors.white),
                  ),
                )
              ],
            )
          ],
        );
      });
}