import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; /// Style de bouton de navigation enum NavigationButtonStyle { green, // Bouton vert avec texte vert foncé purple, // Bouton violet avec texte violet foncé } /// Widget de bouton de navigation personnalisé /// Utilise les assets existants pour le fond class CustomNavigationButton extends StatelessWidget { final String text; final VoidCallback onPressed; final NavigationButtonStyle style; final double? width; final double height; final double fontSize; const CustomNavigationButton({ super.key, required this.text, required this.onPressed, this.style = NavigationButtonStyle.green, this.width, this.height = 50, this.fontSize = 16, }); @override Widget build(BuildContext context) { final backgroundImage = _getBackgroundImage(); final textColor = _getTextColor(); return SizedBox( width: width, height: height, child: Stack( children: [ // Fond avec image Positioned.fill( child: Image.asset( backgroundImage, fit: BoxFit.fill, ), ), // Bouton cliquable Material( color: Colors.transparent, child: InkWell( onTap: onPressed, borderRadius: BorderRadius.circular(8), child: Center( child: Text( text, style: GoogleFonts.merienda( color: textColor, fontSize: fontSize, fontWeight: FontWeight.bold, ), ), ), ), ), ], ), ); } String _getBackgroundImage() { switch (style) { case NavigationButtonStyle.green: return 'assets/images/bg_green.png'; case NavigationButtonStyle.purple: return 'assets/images/bg_lavender.png'; } } Color _getTextColor() { switch (style) { case NavigationButtonStyle.green: return const Color(0xFF2E7D32); // Vert foncé case NavigationButtonStyle.purple: return const Color(0xFF5E35B1); // Violet foncé } } }