136 lines
3.8 KiB
Dart

import 'package:flutter/material.dart';
/// HomePage - Main menu for Pokéguess
/// Contains PLAY and POKEDEX navigation buttons
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color(0xFF1A1A2E),
Color(0xFF16213E),
Color(0xFF0F3460),
],
),
),
child: SafeArea(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Logo / Title
const Text(
'POKÉGUESS',
style: TextStyle(
fontSize: 48,
fontWeight: FontWeight.bold,
color: Colors.white,
letterSpacing: 4,
shadows: [
Shadow(
blurRadius: 20,
color: Colors.blueAccent,
offset: Offset(0, 0),
),
],
),
),
const SizedBox(height: 8),
const Text(
'Devine le Pokémon !',
style: TextStyle(
fontSize: 18,
color: Colors.white70,
fontStyle: FontStyle.italic,
),
),
const SizedBox(height: 80),
// PLAY Button
_MenuButton(
label: 'JOUER',
icon: Icons.play_arrow_rounded,
color: const Color(0xFFE94560),
onPressed: () => Navigator.pushNamed(context, '/game'),
),
const SizedBox(height: 24),
// POKEDEX Button
_MenuButton(
label: 'POKÉDEX',
icon: Icons.catching_pokemon,
color: const Color(0xFF0F3460),
borderColor: Colors.white38,
onPressed: () => Navigator.pushNamed(context, '/pokedex'),
),
],
),
),
),
),
);
}
}
/// Reusable menu button with icon and gradient effect
class _MenuButton extends StatelessWidget {
final String label;
final IconData icon;
final Color color;
final Color? borderColor;
final VoidCallback onPressed;
const _MenuButton({
required this.label,
required this.icon,
required this.color,
required this.onPressed,
this.borderColor,
});
@override
Widget build(BuildContext context) {
return SizedBox(
width: 220,
height: 60,
child: ElevatedButton(
onPressed: onPressed,
style: ElevatedButton.styleFrom(
backgroundColor: color,
foregroundColor: Colors.white,
elevation: 8,
shadowColor: color.withValues(alpha: 0.5),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
side: borderColor != null
? BorderSide(color: borderColor!, width: 2)
: BorderSide.none,
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(icon, size: 28),
const SizedBox(width: 12),
Text(
label,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
letterSpacing: 2,
),
),
],
),
),
);
}
}