katErrorPopup<T> function

Future<T?> katErrorPopup<T>({
  1. required BuildContext context,
})

Shows a modal error popup with a red title bar, a generic "please try again" message and a single "OK" action that dismisses it.

Implementation

Future<T?> katErrorPopup<T>({required BuildContext context}) {
  final textTheme = Theme.of(context).textTheme;
  final hintColor = Theme.of(context).hintColor;
  final locales = KatLocales.of(context)!;

  return katBasePopup<T>(
    context: context,
    title: Text(
      key: const Key('popupError'),
      locales.messErrorOccurred,
      style: textTheme.titleMedium!.copyWith(color: hintColor),
    ),
    backgroundColorTitle: Theme.of(context).colorScheme.error,
    content: Text(locales.messPleaseTryAgain, style: textTheme.titleMedium),
    actions: <Widget>[
      KatButtonPopup(
        key: Key(KatKeys.btnOk),
        title: locales.lblOk,
        onPressed: () => Navigator.of(context).pop(),
      ),
    ],
  );
}