showConfirmDialog static method

Future<bool> showConfirmDialog({
  1. required BuildContext context,
  2. required String title,
  3. String? message,
  4. String? secondaryMessage,
  5. String confirmText = 'Confirm',
  6. String cancelText = 'Cancel',
  7. bool isDestructive = false,
  8. IconData? icon,
})

Shows a confirmation dialog with optional message.

Implementation

static Future<bool> showConfirmDialog({
  required BuildContext context,
  required String title,
  String? message,
  String? secondaryMessage,
  String confirmText = 'Confirm',
  String cancelText = 'Cancel',
  bool isDestructive = false,
  IconData? icon,
}) async {
  final result = await _showAdaptive<bool>(
    context: context,
    builder: (context) => _DialogContainer(
      child: Column(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.stretch,
        children: [
          // Icon
          if (icon != null) ...[
            Container(
              width: 56,
              height: 56,
              decoration: BoxDecoration(
                color: (isDestructive ? Colors.red : AppColor.bondiBlue75)
                    .withValues(alpha: 0.1),
                shape: BoxShape.circle,
              ),
              child: Icon(
                icon,
                color: isDestructive ? Colors.red[400] : AppColor.bondiBlue75,
                size: 28,
              ),
            ),
            const SizedBox(height: 16),
          ],

          // Title
          Text(
            title,
            style: const TextStyle(
              fontSize: 20,
              fontWeight: FontWeight.bold,
              color: Colors.white,
            ),
            textAlign: TextAlign.center,
          ),

          // Messages
          if (message != null) ...[
            const SizedBox(height: 12),
            Text(
              message,
              style: TextStyle(
                fontSize: 15,
                color: Colors.grey[400],
              ),
              textAlign: TextAlign.center,
            ),
          ],
          if (secondaryMessage != null) ...[
            const SizedBox(height: 8),
            Text(
              secondaryMessage,
              style: TextStyle(
                fontSize: 14,
                color: Colors.grey[500],
              ),
              textAlign: TextAlign.center,
            ),
          ],
          const SizedBox(height: 24),

          // Buttons
          _DialogButtons(
            confirmText: confirmText,
            cancelText: cancelText,
            isDestructive: isDestructive,
            onConfirm: () {
              HapticFeedback.lightImpact();
              Sint.back(result: true);
            },
            onCancel: () => Sint.back(result: false),
          ),
        ],
      ),
    ),
  );
  return result ?? false;
}