game/lib/screens/character_selection_screen....

101 lines
3.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../providers/battle_provider.dart';
import 'main_wrapper.dart';
import '../widgets/responsive_container.dart';
class CharacterSelectionScreen extends StatelessWidget {
const CharacterSelectionScreen({super.key});
@override
Widget build(BuildContext context) {
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),
const Text(
"Warrior",
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
const SizedBox(height: 8),
const Text(
"A balanced fighter with a sword and shield. Great for beginners.",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.grey),
),
const SizedBox(height: 16),
const Divider(),
const SizedBox(height: 8),
const Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Text(
"HP: 80",
style: TextStyle(fontWeight: FontWeight.bold),
),
Text(
"ATK: 5",
style: TextStyle(fontWeight: FontWeight.bold),
),
Text(
"DEF: 5",
style: TextStyle(fontWeight: FontWeight.bold),
),
],
),
],
),
),
),
),
),
),
),
),
),
);
}
}