showInfoDialog<T> function Null safety

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

Implementation

Future<SnackBarClosedReason> showInfoDialog<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).backgroundColor,
      // backgroundColor: Colors.transparent,
      content: CustomAlertDialog(
        title: title,
        content: message,
        type: CustomAlertDialogType.info,
        onClick: () => ScaffoldMessenger.of(context).hideCurrentSnackBar(),
      ),
      duration: duration,
    ),
  );

  return x.closed;
}