showErrorSnackBar method

void showErrorSnackBar(
  1. String text, {
  2. Duration duration = const Duration(milliseconds: 500),
  3. Color? backgroundColor,
  4. TextDirection? direction,
})

Implementation

void showErrorSnackBar(
  String text, {
  Duration duration = const Duration(milliseconds: 500),
  Color? backgroundColor,
  TextDirection? direction,
}) {
  try {
    ScaffoldMessenger.of(this).showSnackBar(
      SnackBar(
        backgroundColor: backgroundColor ?? Colors.white,
        content: Text(
          text,
          textDirection: direction,
          style: const TextStyle(color: Colors.red),
        ),
        duration: duration,
      ),
    );
  } catch (e) {
    Logger('ErrorSnackBar').severe(e);
  }
}