katWarningPopup<T> function

Future<T?> katWarningPopup<T>({
  1. required BuildContext context,
  2. required String content,
})

Shows a modal warning popup with an orange title bar, content and a single "OK" action that dismisses it.

Implementation

Future<T?> katWarningPopup<T>({
  required BuildContext context,
  required String content,
}) {
  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('popupWarning'),
      '${locales.lblWarning}!',
      style: textTheme.titleMedium!.copyWith(color: hintColor),
    ),
    backgroundColorTitle: KatColors.warning,
    content: Text(content, style: textTheme.titleMedium),
    actions: <Widget>[
      KatButtonPopup(
        key: Key(KatKeys.btnOk),
        title: locales.lblOk,
        onPressed: () => Navigator.of(context).pop(),
      ),
    ],
  );
}