// lib/screens/player_profile_screen.dart import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:kzeduca_app/providers/game_state_provider.dart'; import 'package:kzeduca_app/models/attributes.dart'; import 'package:kzeduca_app/models/character.dart'; class PlayerProfileScreen extends StatelessWidget { const PlayerProfileScreen({super.key}); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: const Color(0xFF1E1C3A), // Fundo principal appBar: AppBar( title: const Text("Perfil do Jogador", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)), backgroundColor: Colors.transparent, elevation: 0, leading: IconButton( icon: const Icon(Icons.arrow_back_ios, color: Colors.white), onPressed: () => Navigator.of(context).pop(), ), ), body: Consumer( builder: (context, gameState, child) { final character = gameState.playerCharacter; if (character == null) { return const Center( child: Text("Nenhum jogador selecionado.", style: TextStyle(color: Colors.white))); } final attributes = character.attributes; return SingleChildScrollView( padding: const EdgeInsets.all(24.0), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ CircleAvatar( radius: 60, backgroundColor: const Color(0xFFDA70D6), child: Icon(_getIconForCharacter(character.type), size: 60, color: Colors.white), ), const SizedBox(height: 20), Text( character.name, style: const TextStyle( color: Colors.white, fontSize: 32, fontWeight: FontWeight.bold, ), textAlign: TextAlign.center, ), Text( character.story, style: const TextStyle(color: Colors.white70, fontSize: 16), textAlign: TextAlign.center, ), const SizedBox(height: 40), _buildAttributesSection(attributes), const SizedBox(height: 40), _buildGradientButton( text: 'Voltar ao Jogo', onPressed: () { Navigator.pop(context); }, ), ], ), ); }, ), ); } Widget _buildAttributesSection(Attributes attributes) { return Container( padding: const EdgeInsets.all(20.0), decoration: BoxDecoration( color: const Color(0xFF2A284B), borderRadius: BorderRadius.circular(20), boxShadow: [ BoxShadow( color: const Color(0xFFDA70D6).withOpacity(0.2), spreadRadius: 2, blurRadius: 15, offset: const Offset(0, 8), ), ], ), child: Column( children: [ _buildAttributeItem("Dinheiro", "${attributes.money.toStringAsFixed(2)} Kz", Colors.greenAccent), _buildAttributeItem("Saúde", "${(attributes.health * 100).toStringAsFixed(0)}%", Colors.redAccent), _buildAttributeItem("Felicidade", "${(attributes.happiness * 100).toStringAsFixed(0)}%", Colors.yellowAccent), _buildAttributeItem("Educação", "${(attributes.education * 100).toStringAsFixed(0)}%", Colors.lightBlueAccent), _buildAttributeItem("Experiência Profissional", "${(attributes.professionalExperience * 100).toStringAsFixed(0)}%", Colors.deepOrangeAccent), ], ), ); } Widget _buildAttributeItem(String label, String value, Color color) { return Padding( padding: const EdgeInsets.symmetric(vertical: 12.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( label, style: const TextStyle(color: Colors.white70, fontSize: 18), ), Text( value, style: TextStyle(color: color, fontSize: 18, fontWeight: FontWeight.bold), ), ], ), ); } IconData _getIconForCharacter(CharacterType type) { switch (type) { case CharacterType.estudante: return Icons.school; case CharacterType.empreendedor: return Icons.business_center; case CharacterType.profissional: return Icons.work; default: return Icons.person; } } Widget _buildGradientButton({required String text, required VoidCallback onPressed}) { return Container( width: double.infinity, decoration: BoxDecoration( gradient: const LinearGradient( colors: [Color(0xFF8A2BE2), Color(0xFFDA70D6)], begin: Alignment.centerLeft, end: Alignment.centerRight, ), borderRadius: BorderRadius.circular(12), boxShadow: [ BoxShadow( color: const Color(0xFFDA70D6).withOpacity(0.5), spreadRadius: 2, blurRadius: 8, offset: const Offset(0, 4), ), ], ), child: ElevatedButton( onPressed: onPressed, style: ElevatedButton.styleFrom( backgroundColor: Colors.transparent, shadowColor: Colors.transparent, padding: const EdgeInsets.symmetric(vertical: 18), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), ), child: Text( text, style: const TextStyle( fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white), ), ), ); } }