showSubZeroAlertDialog function

Future<void> showSubZeroAlertDialog({
  1. required BuildContext context,
  2. required String title,
  3. String? body,
  4. String dismissLabel = 'OK',
  5. bool useFlushedButton = false,
  6. IconData? trailingIcon,
})

An alert dialog helper for informational messages.

This is a convenience wrapper around showSubZeroDialog for simple alert/info scenarios with a single dismiss button.

Example usage:

await showSubZeroAlertDialog(
  context: context,
  title: 'Success',
  body: 'Your profile has been updated.',
  dismissLabel: 'OK',
);

Implementation

Future<void> showSubZeroAlertDialog({
  required BuildContext context,
  required String title,
  String? body,
  String dismissLabel = 'OK',
  bool useFlushedButton = false,
  IconData? trailingIcon,
}) {
  return showSubZeroDialog(
    context: context,
    title: title,
    body: body,
    actionLayout: useFlushedButton
        ? SubZeroDialogActionLayout.flushed
        : SubZeroDialogActionLayout.sideBySide,
    actions: SubZeroDialogActions(
      primaryLabel: dismissLabel,
      onPrimary: () => Navigator.of(context).pop(),
      primaryTrailingIcon: trailingIcon,
    ),
  );
}