errorDialog method

dynamic errorDialog(
  1. dynamic context
)

Implementation

Widget errorDialog(BuildContext context) {
  final theme = Theme.of(context);
  final lang = L10n.of(context);
  final err = ErrorCode.guessFromError(error);
  QuickAlertOptions options = QuickAlertOptions(
    title: title ??
        switch (err) {
          ErrorCode.notFound => lang.notFound,
          _ => lang.fatalError,
        },
    text: text ?? (textBuilder != null ? textBuilder!(error) : null),
    type: switch (err) {
      ErrorCode.notFound => QuickAlertType.warning,
      _ => QuickAlertType.error,
    },
    showCancelBtn: true,
    showConfirmBtn: false,
    cancelBtnText: lang.back,
    borderRadius: borderRadius,
  );
  if (onRetryTap != null) {
    options.showConfirmBtn = true;
    options.confirmBtnColor = theme.primaryColor;
    options.confirmBtnText = lang.retry;
    options.onConfirmBtnTap = () {
      onRetryTap!();
    };
  }

  return _ActerErrorAlert(
    error: error,
    stack: stack,
    options: options,
    includeBugReportButton: includeBugReportButton,
  );
}