import 'package:business_panel/core/config/app_colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

Future<void> showInfoDialog(
  BuildContext context, {
  required String title,
  required String content,
  required String iconPath,
}) async {
  await showDialog(
    context: context,
    builder: (BuildContext context) {
      return Dialog(
        shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
        elevation: 10,
        backgroundColor: Colors.white,
        child: Stack(
          clipBehavior: Clip.none,
          alignment: Alignment.topCenter,
          children: [
            Padding(
              padding: const EdgeInsets.only(top: 50, left: 20, right: 20, bottom: 20),
              child: Column(
                mainAxisSize: MainAxisSize.min,
                children: [
                  Text(
                    title,
                    style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
                  ),
                  const SizedBox(height: 16),
                  Text(
                    content,
                    style: const TextStyle(color: AppColors.hint, fontSize: 16, height: 1.6),
                    textAlign: TextAlign.start,
                  ),
                  const SizedBox(height: 24),
                  ElevatedButton(
                          style: ElevatedButton.styleFrom(
                            backgroundColor: AppColors.primary,
                            foregroundColor: Colors.white,
                            shape: RoundedRectangleBorder(
                              borderRadius: BorderRadius.circular(8),
                              side: const BorderSide(color: AppColors.border),
                            ),
                            padding: const EdgeInsets.symmetric(
                                horizontal: 90, vertical: 10),
                          ),
                          onPressed: () async {
                            Navigator.of(context).pop();
                          },
                          child: const Text(
                            "متوجه شدم",
                            style: TextStyle(color: Colors.white),
                          ),
                        ),
                ],
              ),
            ),
            Positioned(
              top: -40,
              child: Container(
                decoration: BoxDecoration(
                  shape: BoxShape.circle,
                  color: Colors.white,
                  boxShadow: [
                    BoxShadow(
                      color: Colors.black.withOpacity(0.2),
                      blurRadius: 8,
                      offset: const Offset(0, 4),
                    ),
                  ],
                ),
                child: CircleAvatar(
                  backgroundColor: Colors.white,
                  radius: 40,
                  child: Padding(
                    padding: const EdgeInsets.all(12.0),
                    child: SvgPicture.asset(iconPath, height: 60, width: 60),
                  ),
                ),
              ),
            ),
          ],
        ),
      );
    },
  );
}