showErrorDialog function

void showErrorDialog (
  1. {@required BuildContext context,
  2. @required dynamic error,
  3. ErrorDialogL10n l10n: const ErrorDialogL10n()}
)

Implementation

void showErrorDialog({
  @required BuildContext context,
  @required dynamic error,
  ErrorDialogL10n l10n = const ErrorDialogL10n(),
}) {
  showDialog<dynamic>(
    context: context,
    builder: (context) => AlertDialog(
      title: Text(
        l10n.errorTitle,
        style: TextStyle(
          color: Theme.of(context).errorColor,
        ),
      ),
      content: Text(
        l10n.localizeError(error),
      ),
      actions: [
        FlatButton(
          child: Text(MaterialLocalizations.of(context).okButtonLabel),
          onPressed: () {
            Navigator.of(context).pop();
          },
        )
      ],
    ),
  );
}