55 lines
1.5 KiB
Dart

import 'package:flutter/material.dart';
import '../../../l10n/app_localizations.dart';
/// Boutons d'action de l'écran game over : rejouer ou retourner au Pokédex.
class GameOverActions extends StatelessWidget {
final Color primaryColor;
final Color primaryDark;
final VoidCallback onTryAgain;
final VoidCallback onBack;
const GameOverActions({
super.key,
required this.primaryColor,
required this.primaryDark,
required this.onTryAgain,
required this.onBack,
});
@override
Widget build(BuildContext context) {
final l = AppLocalizations.of(context)!;
return Column(
children: [
_button(label: l.tryAgain, icon: Icons.refresh, color: primaryColor, onPressed: onTryAgain),
const SizedBox(height: 16),
_button(label: l.backToPokedex, icon: Icons.menu_book, color: primaryDark, onPressed: onBack),
],
);
}
Widget _button({
required String label,
required IconData icon,
required Color color,
required VoidCallback onPressed,
}) {
return SizedBox(
width: double.infinity,
height: 60,
child: ElevatedButton.icon(
onPressed: onPressed,
icon: Icon(icon, color: Colors.white, size: 24),
label: Text(
label,
style: const TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold, letterSpacing: 2),
),
style: ElevatedButton.styleFrom(
backgroundColor: color,
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
),
),
);
}
}