53 lines
1.3 KiB
Dart
53 lines
1.3 KiB
Dart
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 MouseRegion(
|
|
cursor: SystemMouseCursors.click,
|
|
child: GestureDetector(
|
|
onTap: onPressed,
|
|
child: Container(
|
|
width: width,
|
|
height: height,
|
|
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,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |