showError static method

void showError(
  1. String message, {
  2. SnackBarAction? action,
  3. EdgeInsetsGeometry? margin,
  4. SnackBarBehavior? behavior,
  5. ShapeBorder? shape,
  6. DismissDirection dismissDirection = DismissDirection.down,
})

Implementation

static void showError(
  String message, {
  SnackBarAction? action,
  EdgeInsetsGeometry? margin,
  SnackBarBehavior? behavior,
  ShapeBorder? shape,
  DismissDirection dismissDirection = DismissDirection.down,
}) {
  if (scaffoldMessengerKey.currentState?.mounted == true) {
    scaffoldMessengerKey.currentState?.showSnackBar(
      SnackBar(
        backgroundColor: Colors.red,
        shape: shape,
        margin: margin,
        behavior: behavior,
        dismissDirection: dismissDirection,
        content: Text(message),
        action: action ??
            const SnackBarAction(
              label: 'Dismiss',
              onPressed: DjangoflowAppSnackbar.dismiss,
              textColor: Colors.white,
            ),
        duration: const Duration(seconds: 15),
      ),
    );
  }
}