showErrorDialog<T> function

Future<SnackBarClosedReason> showErrorDialog<T>(
  1. {required BuildContext context,
  2. required String title,
  3. required String message,
  4. Duration duration = const Duration(seconds: 3)}
)

Implementation

Future<SnackBarClosedReason> showErrorDialog<T>({
  required BuildContext context,
  required String title,
  required String message,
  Duration duration = const Duration(seconds: 3),
}) {
  final x = ScaffoldMessenger.of(context).showSnackBar(
    SnackBar(
      padding: const EdgeInsets.all(16),
      backgroundColor: Theme.of(context).colorScheme.background,
      // backgroundColor: Colors.transparent,
      content: CustomAlertDialog(
        title: title,
        content: message,
        type: CustomAlertDialogType.error,
        onClick: () => ScaffoldMessenger.of(context).hideCurrentSnackBar(),
      ),
      duration: duration,
    ),
  );

  return x.closed;
}