import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; class ImageButton extends StatelessWidget { final String bg; final double width; final double height; final String text; final Color textColor; final VoidCallback onPressed; final double fontSize; // Ajout pour la flexibilité const ImageButton({ super.key, required this.bg, required this.width, required this.height, required this.text, required this.textColor, required this.onPressed, this.fontSize = 16, // Valeur par défaut }); @override Widget build(BuildContext context) { return SizedBox( width: width, height: height, child: Semantics( button: true, label: text, child: MouseRegion( cursor: SystemMouseCursors.click, child: TextButton( onPressed: onPressed, style: TextButton.styleFrom( padding: EdgeInsets.zero, tapTargetSize: MaterialTapTargetSize.shrinkWrap, shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), ), child: Ink( decoration: BoxDecoration( image: DecorationImage( image: AssetImage(bg), fit: BoxFit.fill, ), ), child: Center( child: Text( text, style: GoogleFonts.merienda( color: textColor, fontSize: fontSize, // Utilisation du paramètre fontWeight: FontWeight.bold, ), ), ), ), ), ), ), ); } }