117 lines
4.2 KiB
Dart
117 lines
4.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import '../providers/battle_provider.dart';
|
|
import '../game/data/player_table.dart';
|
|
import 'main_wrapper.dart';
|
|
import '../widgets/responsive_container.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: Colors.black, // 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<BattleProvider>().initializeBattle();
|
|
|
|
// Navigate to Game Screen (MainWrapper)
|
|
// Using pushReplacement to prevent going back to selection
|
|
Navigator.pushAndRemoveUntil(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => const MainWrapper(),
|
|
),
|
|
(route) => false,
|
|
);
|
|
},
|
|
child: Card(
|
|
color: Colors.blueGrey[800],
|
|
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: Colors.blue,
|
|
),
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
warrior.name,
|
|
style: const TextStyle(
|
|
fontSize: 24,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
warrior.description,
|
|
textAlign: TextAlign.center,
|
|
style: const TextStyle(color: Colors.grey),
|
|
),
|
|
const SizedBox(height: 16),
|
|
const Divider(),
|
|
const SizedBox(height: 8),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
Text(
|
|
"HP: ${warrior.baseHp}",
|
|
style: const TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
Text(
|
|
"ATK: ${warrior.baseAtk}",
|
|
style: const TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
Text(
|
|
"DEF: ${warrior.baseDefense}",
|
|
style: const TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|