fazer o botao de criqar personagem guardar personagem

This commit is contained in:
2026-01-13 17:15:21 +00:00
parent eeb9f0e760
commit fc527084de
5 changed files with 307 additions and 10 deletions

View File

@@ -0,0 +1,90 @@
import 'package:flutter/material.dart';
import '../models/team_model.dart';
class StatsHeader extends StatelessWidget {
final Team team;
const StatsHeader({super.key, required this.team});
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
padding: const EdgeInsets.only(top: 50, left: 16, right: 16, bottom: 25),
decoration: const BoxDecoration(color: Color(0xFF2196F3)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.white),
onPressed: () => Navigator.pop(context),
),
Row(
children: [
_buildLogo(),
const SizedBox(width: 16),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(team.name, style: const TextStyle(color: Colors.white, fontSize: 24, fontWeight: FontWeight.bold)),
Text("Temporada ${team.season}", style: const TextStyle(color: Colors.white70, fontSize: 14)),
],
),
],
),
],
),
);
}
Widget _buildLogo() {
return Container(
width: 60, height: 60,
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(12)),
child: Center(
child: team.imageUrl.startsWith('http')
? ClipRRect(borderRadius: BorderRadius.circular(12), child: Image.network(team.imageUrl))
: Text(team.imageUrl.isEmpty ? "🏀" : team.imageUrl, style: const TextStyle(fontSize: 30)),
),
);
}
}
class SummaryCard extends StatelessWidget {
const SummaryCard({super.key});
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 20),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15),
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)],
),
child: const Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
_StatItem(label: "Jogos", value: "0", color: Colors.black),
_StatItem(label: "Vitórias", value: "0", color: Colors.green),
_StatItem(label: "Derrotas", value: "0", color: Colors.red),
],
),
);
}
}
class _StatItem extends StatelessWidget {
final String label, value;
final Color color;
const _StatItem({required this.label, required this.value, required this.color});
@override
Widget build(BuildContext context) {
return Column(
children: [
Text(value, style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: color)),
Text(label, style: const TextStyle(color: Colors.grey, fontSize: 13)),
],
);
}
}

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:playmaker/screens/team_stats_page.dart';
import '../models/team_model.dart';
import '../controllers/team_controllers.dart';
@@ -83,19 +84,23 @@ subtitle: Padding(
children: [
// Botão Status
IconButton(
padding: EdgeInsets.zero,
constraints: const BoxConstraints(),
icon: const Icon(Icons.bar_chart, color: Colors.blue),
onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("A abrir status de ${team.name}...")),
);
},
),
padding: EdgeInsets.zero,
constraints: const BoxConstraints(),
icon: const Icon(Icons.bar_chart, color: Colors.blue),
onPressed: () {
// NAVEGAÇÃO PARA A NOVA PÁGINA
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => TeamStatsPage(team: team),
),
);
},
),
const SizedBox(width: 12),
// Botão Eliminar
IconButton(
padding: EdgeInsets.zero,
padding: EdgeInsets.zero,
constraints: const BoxConstraints(),
icon: const Icon(Icons.delete_outline, color: Color(0xFFE74C3C)),
onPressed: () => _confirmDelete(context),