import "package:flutter/material.dart"; import "package:google_fonts/google_fonts.dart"; import "../theme/ensup_colors.dart"; /// Grande carte d'action de l'accueil (Emprunter / Restituer). class ActionCard extends StatefulWidget { const ActionCard({ super.key, required this.icon, required this.title, required this.description, required this.color, this.onTap, }); final IconData icon; final String title; final String description; final Color color; final VoidCallback? onTap; @override State createState() => _ActionCardState(); } class _ActionCardState extends State { bool _hovered = false; @override Widget build(BuildContext context) { final color = widget.color; return MouseRegion( onEnter: (_) => setState(() => _hovered = true), onExit: (_) => setState(() => _hovered = false), cursor: SystemMouseCursors.click, child: AnimatedContainer( duration: const Duration(milliseconds: 180), curve: Curves.easeOut, constraints: const BoxConstraints(minHeight: 230), decoration: BoxDecoration( color: _hovered ? color.withValues(alpha: 0.1) : color.withValues(alpha: 0.06), borderRadius: BorderRadius.circular(16), border: Border.all( color: color.withValues(alpha: _hovered ? 0.55 : 0.22), width: _hovered ? 2 : 1.5, ), boxShadow: [ BoxShadow( color: color.withValues(alpha: _hovered ? 0.16 : 0.06), blurRadius: _hovered ? 22 : 10, offset: Offset(0, _hovered ? 8 : 3), ), ], ), child: Material( color: Colors.transparent, child: InkWell( onTap: widget.onTap, borderRadius: BorderRadius.circular(16), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 28), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ AnimatedContainer( duration: const Duration(milliseconds: 180), width: 60, height: 60, decoration: BoxDecoration( color: color, borderRadius: BorderRadius.circular(18), boxShadow: [ BoxShadow( color: color.withValues(alpha: 0.3), blurRadius: _hovered ? 18 : 12, offset: const Offset(0, 5), ), ], ), child: Icon(widget.icon, color: Colors.white, size: 28), ), const SizedBox(height: 16), Text( widget.title, textAlign: TextAlign.center, style: GoogleFonts.darkerGrotesque( fontSize: 25, height: 1, fontWeight: FontWeight.w900, color: EnsupColors.text, ), ), const SizedBox(height: 8), Text( widget.description, textAlign: TextAlign.center, style: GoogleFonts.titilliumWeb( fontSize: 13, color: EnsupColors.muted, height: 1.45, ), ), const SizedBox(height: 16), Container( width: 30, height: 30, decoration: BoxDecoration( color: color.withValues(alpha: 0.12), shape: BoxShape.circle, ), child: Icon( Icons.arrow_forward_rounded, size: 17, color: color, ), ), ], ), ), ), ), ), ); } }