showErrorSnackBar method

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

Implementation

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