import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../providers.dart'; import '../game/data.dart'; import 'story_screen.dart'; import '../widgets.dart'; import '../game/config.dart'; class CharacterSelectionScreen extends StatelessWidget { const CharacterSelectionScreen({super.key}); @override Widget build(BuildContext context) { // Fetch Warrior data final warrior = PlayerTable.get("warrior"); if (warrior == null) { return const Scaffold( body: Center(child: Text("Error: Player data not found")), ); } return Scaffold( backgroundColor: ThemeConfig.mainMenuBgTop, // Outer background body: Center( child: ResponsiveContainer( child: Scaffold( appBar: AppBar( title: const Text("Choose Your Hero"), centerTitle: true, ), body: Center( child: Padding( padding: const EdgeInsets.all(16.0), child: InkWell( onTap: () { // Initialize Game context.read().initializeBattle(); // Navigate to Story Screen first // Using pushReplacement to prevent going back to selection Navigator.pushAndRemoveUntil( context, MaterialPageRoute( builder: (context) => const StoryScreen(), ), (route) => false, ); }, child: Card( color: ThemeConfig.selectionCardBg, elevation: 8, child: Container( width: 300, padding: const EdgeInsets.all(24.0), child: Column( mainAxisSize: MainAxisSize.min, children: [ const Icon( Icons.shield, size: 80, color: ThemeConfig.selectionIconColor, ), const SizedBox(height: 16), Text( warrior.name, style: const TextStyle( fontSize: ThemeConfig.fontSizeTitle, fontWeight: ThemeConfig.fontWeightBold, color: ThemeConfig.textColorWhite, ), ), const SizedBox(height: 8), Text( warrior.description, textAlign: TextAlign.center, style: const TextStyle( color: ThemeConfig.textColorGrey, ), ), const SizedBox(height: 16), const Divider(), const SizedBox(height: 8), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Text( "${AppStrings.hp}: ${warrior.baseHp}", style: const TextStyle( fontWeight: ThemeConfig.fontWeightBold, ), ), Text( "${AppStrings.atk}: ${warrior.baseAtk}", style: const TextStyle( fontWeight: ThemeConfig.fontWeightBold, ), ), Text( "${AppStrings.def}: ${warrior.baseDefense}", style: const TextStyle( fontWeight: ThemeConfig.fontWeightBold, ), ), ], ), ], ), ), ), ), ), ), ), ), ), ); } }