showSnackBar function

void showSnackBar(
  1. BuildContext context,
  2. SnackType? type,
  3. String? message
)

Implementation

void showSnackBar(BuildContext context, SnackType? type, String? message) {
  Color backgroundColor= _getColors(type);
  Color textColor = Colors.white;

  if(message != null && message != ''){
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(
        behavior: SnackBarBehavior.floating,
        backgroundColor: backgroundColor,
        content: Text(message, style: TextStyle(fontSize: 18, color: textColor ) ),
        elevation: 8,
        showCloseIcon: true,
        closeIconColor: textColor,
      )
    );
  }
}