import 'package:flutter/material.dart';

import 'tap_bounce.dart';

const Color _teal = Color(0xFF2F9E94);
const Color _accentPink = Color(0xFFFF55A7);

/// Diálogo de confirmação com a identidade visual do app (título rosa,
/// botões em pílula), usado para todas as confirmações destrutivas/decisórias.
Future<bool?> showConfirmDialog(
  BuildContext context, {
  required String title,
  String? message,
  String cancelLabel = 'Cancelar',
  required String confirmLabel,
  Color confirmColor = _teal,
}) {
  return showDialog<bool>(
    context: context,
    builder: (ctx) {
      return AlertDialog(
        shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
        title: Text(
          title,
          style: const TextStyle(fontWeight: FontWeight.w900, color: _accentPink),
        ),
        content: message == null ? null : Text(message),
        actions: [
          TapBounce(
            child: TextButton(
              style: TextButton.styleFrom(foregroundColor: _teal),
              onPressed: () => Navigator.of(ctx).pop(false),
              child: Text(cancelLabel),
            ),
          ),
          TapBounce(
            child: FilledButton(
              style: FilledButton.styleFrom(
                backgroundColor: confirmColor,
                foregroundColor: Colors.white,
                shape: const StadiumBorder(),
                textStyle: const TextStyle(fontWeight: FontWeight.w800),
              ),
              onPressed: () => Navigator.of(ctx).pop(true),
              child: Text(confirmLabel),
            ),
          ),
        ],
      );
    },
  );
}
