showSnackException static method

void showSnackException(
  1. String message,
  2. Color color, {
  3. required BuildContext context,
  4. int seconds = 5,
})

Implementation

static void showSnackException(
  String message,
  Color color, {
  required BuildContext context,
  int seconds = 5,
}) {
  FocusScope.of(context).requestFocus(
    FocusNode(),
  );
  ScaffoldMessenger.of(context).removeCurrentSnackBar();
  ScaffoldMessenger.of(context).showSnackBar(
    SnackBar(
      content: Text(
        message,
        style: const TextStyle(color: Colors.white),
      ),
      backgroundColor: color,
      duration: Duration(
        seconds: seconds,
      ),
    ),
  );
}