// import 'package:flutter/material.dart';
// import 'Constants.dart';
// class CustomAlertDialog extends StatelessWidget {
//   final String titleText;
//   final String contentText;
//   final String buttonText;
//   final VoidCallback onButtonPressed;
//   final Widget icon;
//   CustomAlertDialog({
//     required this.titleText,
//     required this.contentText,
//     required this.buttonText,
//     required this.onButtonPressed,
//     required this.icon,
//   });
//   @override
//   Widget build(BuildContext context) {
//     return AlertDialog(
//       shape: RoundedRectangleBorder(
//         borderRadius: BorderRadius.circular(15.0),
//       ),
//       titlePadding: EdgeInsets.zero,
//       contentPadding: EdgeInsets.zero,
//       actionsPadding: EdgeInsets.zero,
//       title: Container(
//         decoration: const BoxDecoration(
//           gradient: LinearGradient(
//             colors: [
//               Color.fromARGB(255, 227, 144, 214),
//               Color.fromARGB(255, 125, 174, 251),
//             ],
//             begin: Alignment.topLeft,
//             end: Alignment.bottomRight,
//           ),
//           borderRadius: BorderRadius.only(
//             topLeft: Radius.circular(10.0),
//             topRight: Radius.circular(10.0),
//           ),
//         ),
//         padding: const EdgeInsets.all(10),
//         child: Center(
//           child: icon,
//         ),
//       ),
//       content: Container(
//         padding: const EdgeInsets.all(20),
//         child: Column(
//           mainAxisSize: MainAxisSize.min,
//           children: [
//             Text(
//               titleText,
//               style: Constants.colorfontStyle,
//             ),
//             const SizedBox(height: 10),
//             Text(
//               contentText,
//               style: Constants.loginfontStyle,
//             ),
//           ],
//         ),
//       ),
//       actions: [
//         Center(
//           child: Container(
//             margin: const EdgeInsets.only(bottom: 10),
//             child: ElevatedButton(
//               style: ElevatedButton.styleFrom(
//                 backgroundColor: const Color.fromARGB(
//                     255, 164, 164, 164), // Background color
//                 shape: RoundedRectangleBorder(
//                   borderRadius: BorderRadius.circular(50),
//                 ),
//               ),
//               onPressed: onButtonPressed,
//               child: Text(
//                 buttonText,
//                 textAlign: TextAlign.center,
//                 style: const TextStyle(color: Colors.white), // Text color
//               ),
//             ),
//           ),
//         ),
//       ],
//     );
//   }
// }

import 'package:flutter/material.dart';
import 'Constants.dart';

class CustomAlertDialog extends StatelessWidget {
  final String titleText;
  final String contentText;
  final String buttonText;
  final VoidCallback onButtonPressed;
  final Widget icon;
  final String? secondButtonText;
  final VoidCallback? onSecondButtonPressed;

  const CustomAlertDialog({
    required this.titleText,
    required this.contentText,
    required this.buttonText,
    required this.onButtonPressed,
    required this.icon,
    this.secondButtonText,
    this.onSecondButtonPressed,
  });

  //added new line

  @override
  Widget build(BuildContext context) {
    return AlertDialog(
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(15.0),
      ),
      titlePadding: EdgeInsets.zero,
      contentPadding: EdgeInsets.zero,
      actionsPadding: EdgeInsets.zero,
      title: Container(
        decoration: const BoxDecoration(
          gradient: LinearGradient(
            colors: [
              Color.fromARGB(255, 227, 144, 214),
              Color.fromARGB(255, 125, 174, 251),
            ],
            begin: Alignment.topLeft,
            end: Alignment.bottomRight,
          ),
          borderRadius: BorderRadius.only(
            topLeft: Radius.circular(10.0),
            topRight: Radius.circular(10.0),
          ),
        ),
        padding: const EdgeInsets.all(10),
        child: Center(
          child: icon,
        ),
      ),
      content: Container(
        padding: const EdgeInsets.all(20),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            Text(
              titleText,
              style: Constants.colorfontStyle,
            ),
            const SizedBox(height: 10),
            Text(
              contentText,
              style: Constants.loginfontStyle,
            ),
          ],
        ),
      ),
      actions: [
        Center(
          child: Column(
            children: [
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: [
                  ElevatedButton(
                    style: ElevatedButton.styleFrom(
                      backgroundColor: const Color.fromARGB(
                          255, 164, 164, 164), // Background color
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(50),
                      ),
                    ),
                    onPressed: onButtonPressed,
                    child: Text(
                      buttonText,
                      textAlign: TextAlign.center,
                      style: const TextStyle(color: Colors.white), // Text color
                    ),
                  ),
                  if (secondButtonText != null && onSecondButtonPressed != null)
                    ElevatedButton(
                      style: ElevatedButton.styleFrom(
                        backgroundColor: const Color.fromARGB(
                            255, 164, 164, 164), // Background color
                        shape: RoundedRectangleBorder(
                          borderRadius: BorderRadius.circular(50),
                        ),
                      ),
                      onPressed: onSecondButtonPressed,
                      child: Text(
                        secondButtonText!,
                        textAlign: TextAlign.center,
                        style:
                            const TextStyle(color: Colors.white), // Text color
                      ),
                    ),
                ],
              ),
              const SizedBox(height: 15), // Add spacing below the buttons
            ],
          ),
        ),
      ],
    );
  }
}
