showConfirmDialog function

Future<void> showConfirmDialog(
  1. BuildContext context, {
  2. required AppTheme theme,
  3. bool dismissible = true,
  4. String? title,
  5. String? message,
  6. String? positiveText,
  7. String? negativeText,
  8. Color? negativeColor,
  9. Color? positiveColor,
  10. void onNegativePressed()?,
  11. void onPositivePressed()?,
})

Shows a confirmation dialog with customizable text and callbacks.

Implementation

Future<void> showConfirmDialog(
  BuildContext context, {
  required AppTheme theme,
  bool dismissible = true,
  String? title,
  String? message,
  String? positiveText,
  String? negativeText,
  Color? negativeColor,
  Color? positiveColor,
  void Function()? onNegativePressed,
  void Function()? onPositivePressed,
}) {
  return showCustomDialog(
    context,
    theme: theme,
    dismissible: dismissible,
    backgroundColor: theme.backgroundColor().withValues(alpha: .9),
    content: Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        _titleWidget(title, theme.textColor()),
        const SizedBox(height: 12.0),
        _messageWidget(message, theme.textColor()),
      ],
    ),
    textColor: theme.textColor(),
    color: theme.backgroundColor(),
    positiveText: positiveText ?? StringUtils.capitalize(tr('yes')),
    negativeText: negativeText ?? StringUtils.capitalize(tr('no')),
    negativeColor: negativeColor,
    positiveColor: positiveColor,
    onNegativePressed: onNegativePressed,
    onPositivePressed: onPositivePressed,
  );
}