displaySnack function

void displaySnack(
  1. BuildContext context, {
  2. String? text,
  3. Color? color,
  4. dynamic onPressed()?,
  5. Color textColor = Colors.white,
})

Creates a simple snackbr

Implementation

void displaySnack(BuildContext context,
    {String? text,
    Color? color,
    Function()? onPressed,
    Color textColor = Colors.white}) {
  ScaffoldMessenger.of(context).showSnackBar(SnackBar(
    elevation: 40,
    content: Text(
      text!,
      textAlign: TextAlign.center,
    ),
    backgroundColor: Colors.red,
    duration: Duration(seconds: 2),
  ));
}