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

class SummaryCard extends StatelessWidget {
  final String backgroundImagePath;
  final String title;
  final List<Widget> content;
  final VoidCallback onEdit;

  const SummaryCard({
    super.key,
    required this.backgroundImagePath,
    required this.title,
    required this.content,
    required this.onEdit,
  });

  @override
  Widget build(BuildContext context) {
    return AspectRatio(
      aspectRatio: 2.0,
      child: Container(
        padding: const EdgeInsets.symmetric(vertical: 20.0, horizontal: 25.0),
        decoration: BoxDecoration(
          image: DecorationImage(
            image: AssetImage(backgroundImagePath),
            fit: BoxFit.cover,
          ),
          borderRadius: BorderRadius.circular(15),
        ),
        child: Column(
          children: [
            Row(
              children: [
                Expanded(
                  child: Text(
                    title,
                    style: GoogleFonts.merienda(fontSize: 28, fontWeight: FontWeight.w600),
                    textAlign: TextAlign.center,
                  ),
                ),
                IconButton(
                  icon: const Icon(Icons.edit, color: Colors.black54, size: 28),
                  onPressed: onEdit,
                  tooltip: 'Modifier',
                ),
              ],
            ),
            const SizedBox(height: 18),
            Expanded(
              child: Column(
                children: content,
              ),
            ),
          ],
        ),
      ),
    );
  }
}