toast method

dynamic toast(
  1. dynamic context, {
  2. String? title,
  3. String? buttonLabel,
  4. dynamic onPressed()?,
  5. Color? buttonTheme,
  6. Color? theme,
})

Implementation

toast(context,
    {String? title,
    String? buttonLabel,
    Function()? onPressed,
    Color? buttonTheme,
    Color? theme}) {
  ScaffoldMessenger.of(context).showSnackBar(
    SnackBar(
      content: Text(title ?? ''),
      backgroundColor: theme ?? Colors.green,
      action: SnackBarAction(
        label: buttonLabel ?? '',
        textColor: buttonTheme ?? Colors.black,
        onPressed: onPressed ?? () {},
      ),
    ),
  );
}