showAlertSnackBar function

void showAlertSnackBar({
  1. required BuildContext context,
  2. required String title,
  3. String? message,
  4. SILSnackBarAction? action,
  5. SnackBarType? type,
})

used to show the custom SilSnackBar takes an optional title and message also takes an optional action of type SILSnackBarAction also takes an optional SnackBarType

Implementation

void showAlertSnackBar({
  required BuildContext context,
  required String title,
  String? message,
  SILSnackBarAction? action,
  SnackBarType? type,
}) {
  ScaffoldMessenger.of(context)
    ..hideCurrentSnackBar()
    ..showSnackBar(
      SILSnackBar(
        type: type ?? SnackBarType.info,
        onAction: action,
        title: title,
        content: Text(
          message ?? UserFeedBackTexts.getErrorMessage(),
          textAlign: TextAlign.start,
          style: normalSize12Text().copyWith(height: 1.3),
        ),
        duration: const Duration(seconds: kShortSnackBarDuration),
      ),
    );
  return;
}