show method

void show(
  1. String text,
  2. BuildContext? context, {
  3. Color? bgColor,
  4. Color? textColor,
  5. int duration = 3,
  6. bool isError = false,
  7. bool isSuccess = false,
})

pass isError true to have a red bg, isSuccess true to have a green bg.

Implementation

void show(String text, BuildContext? context,
    {Color? bgColor,
    Color? textColor,
    int duration = 3,
    bool isError = false,
    bool isSuccess = false}) {
  Fluttertoast.showToast(
      msg: text,
      toastLength: Toast.LENGTH_LONG,
      gravity: ToastGravity.BOTTOM,
      timeInSecForIosWeb: 1,
      backgroundColor: isError
          ? AllColors().RED
          : (isSuccess ? AllColors().GREEN : (bgColor ?? AllColors().ORANGE)),
      textColor: textColor ?? Colors.white,
      fontSize: 16.0);
}