focar na tela de equipa
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:playmaker/classe/home.config.dart';
|
||||
import 'package:playmaker/grafico%20de%20pizza/grafico.dart';
|
||||
import 'package:playmaker/pages/teams_page.dart';
|
||||
|
||||
class HomeScreen extends StatefulWidget {
|
||||
const HomeScreen({super.key});
|
||||
@@ -11,35 +12,34 @@ class HomeScreen extends StatefulWidget {
|
||||
|
||||
class _HomeScreenState extends State<HomeScreen> {
|
||||
int _selectedIndex = 0;
|
||||
|
||||
|
||||
// Lista de Widgets para cada aba
|
||||
// O IndexedStack vai alternar entre estes 4 widgets
|
||||
late final List<Widget> _pages;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_pages = [
|
||||
_buildHomeContent(), // Index 0
|
||||
const Center(child: Text('Tela de Jogo')), // Index 1
|
||||
const TeamsPage(), // Index 2 (TUA TELA DE EQUIPAS)
|
||||
const Center(child: Text('Tela de Status')), // Index 3
|
||||
];
|
||||
}
|
||||
|
||||
void _onItemSelected(int index) {
|
||||
setState(() {
|
||||
_selectedIndex = index;
|
||||
});
|
||||
|
||||
// Navegação entre telas
|
||||
switch (index) {
|
||||
case 0:
|
||||
// Já está na Home
|
||||
break;
|
||||
case 1:
|
||||
print('Navegar para tela de Jogo');
|
||||
// Navigator.push(context, MaterialPageRoute(builder: (_) => GameScreen()));
|
||||
break;
|
||||
case 2:
|
||||
print('Navegar para tela de Equipas');
|
||||
// Navigator.push(context, MaterialPageRoute(builder: (_) => TeamsScreen()));
|
||||
break;
|
||||
case 3:
|
||||
print('Navegar para tela de Status');
|
||||
// Navigator.push(context, MaterialPageRoute(builder: (_) => StatusScreen()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//home
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
title: const Text('PlayMaker'),
|
||||
backgroundColor: HomeConfig.primaryColor,
|
||||
@@ -49,91 +49,13 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
onPressed: () {},
|
||||
),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Primeira linha com 2 cards
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Card 1 - Estatísticas de Basquete
|
||||
_buildStatCard(
|
||||
title: 'Mais Pontos',
|
||||
playerName: 'Michael Jordan',
|
||||
statValue: '34.5',
|
||||
statLabel: 'PPG',
|
||||
color: Colors.blue[800]!,
|
||||
icon: Icons.sports_basketball,
|
||||
isHighlighted: true,
|
||||
),
|
||||
|
||||
SizedBox(width: 20),
|
||||
|
||||
// Card 2 - Estatísticas de Basquete (corrigido)
|
||||
_buildStatCard(
|
||||
title: 'Mais Assistências',
|
||||
playerName: 'Magic Johnson',
|
||||
statValue: '12.8',
|
||||
statLabel: 'APG',
|
||||
color: Colors.green[800]!,
|
||||
icon: Icons.sports_basketball, // Corrigido para basquete
|
||||
isHighlighted: false,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
SizedBox(height: 20),
|
||||
|
||||
// Segunda linha com 2 cards
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Card 3 - Estatísticas de Basquete (corrigido)
|
||||
_buildStatCard(
|
||||
title: 'Mais Rebotes',
|
||||
playerName: 'Dennis Rodman',
|
||||
statValue: '15.3',
|
||||
statLabel: 'RPG',
|
||||
color: Colors.purple[800]!,
|
||||
icon: Icons.sports_basketball, // Corrigido para basquete
|
||||
isHighlighted: false,
|
||||
),
|
||||
|
||||
SizedBox(width: 20),
|
||||
|
||||
// Card 4 - Gráfico
|
||||
PieChartCard(
|
||||
title: 'DESEMPENHO',
|
||||
subtitle: 'Vitórias vs Derrotas',
|
||||
backgroundColor: Colors.red[800]!,
|
||||
onTap: () {
|
||||
print('Gráfico clicado!');
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
SizedBox(height: 40),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'Histórico de Jogos',
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.grey[800],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// O IndexedStack mantém todas as páginas "vivas" mas só mostra uma
|
||||
body: IndexedStack(
|
||||
index: _selectedIndex,
|
||||
children: _pages,
|
||||
),
|
||||
// ⬇️⬇️⬇️ NAVIGATION BAR AQUI ⬇️⬇️⬇️
|
||||
|
||||
bottomNavigationBar: NavigationBar(
|
||||
selectedIndex: _selectedIndex,
|
||||
onDestinationSelected: _onItemSelected,
|
||||
@@ -167,7 +89,76 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
// Método para criar cards de estatísticas
|
||||
// --- WIDGETS DE CONTEÚDO ---
|
||||
|
||||
Widget _buildHomeContent() {
|
||||
return SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
_buildStatCard(
|
||||
title: 'Mais Pontos',
|
||||
playerName: 'Michael Jordan',
|
||||
statValue: '34.5',
|
||||
statLabel: 'PPG',
|
||||
color: Colors.blue[800]!,
|
||||
icon: Icons.sports_basketball,
|
||||
isHighlighted: true,
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
_buildStatCard(
|
||||
title: 'Mais Assistências',
|
||||
playerName: 'Magic Johnson',
|
||||
statValue: '12.8',
|
||||
statLabel: 'APG',
|
||||
color: Colors.green[800]!,
|
||||
icon: Icons.sports_basketball,
|
||||
isHighlighted: false,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
_buildStatCard(
|
||||
title: 'Mais Rebotes',
|
||||
playerName: 'Dennis Rodman',
|
||||
statValue: '15.3',
|
||||
statLabel: 'RPG',
|
||||
color: Colors.purple[800]!,
|
||||
icon: Icons.sports_basketball,
|
||||
isHighlighted: false,
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
PieChartCard(
|
||||
title: 'DESEMPENHO',
|
||||
subtitle: 'Vitórias vs Derrotas',
|
||||
backgroundColor: Colors.red[800]!,
|
||||
onTap: () {},
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
Text(
|
||||
'Histórico de Jogos',
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.grey[800],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatCard({
|
||||
required String title,
|
||||
required String playerName,
|
||||
@@ -177,7 +168,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
required IconData icon,
|
||||
bool isHighlighted = false,
|
||||
}) {
|
||||
return Container(
|
||||
return SizedBox(
|
||||
width: HomeConfig.cardwidthPadding,
|
||||
height: HomeConfig.cardheightPadding,
|
||||
child: Card(
|
||||
@@ -185,7 +176,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
side: isHighlighted
|
||||
? BorderSide(color: Colors.amber, width: 2)
|
||||
? const BorderSide(color: Colors.amber, width: 2)
|
||||
: BorderSide.none,
|
||||
),
|
||||
child: Container(
|
||||
@@ -194,10 +185,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
color.withOpacity(0.9),
|
||||
color.withOpacity(0.7),
|
||||
],
|
||||
colors: [color.withOpacity(0.9), color.withOpacity(0.7)],
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
@@ -205,7 +193,6 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Cabeçalho com título e ícone
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@@ -213,111 +200,27 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title.toUpperCase(),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white.withOpacity(0.9),
|
||||
letterSpacing: 1.5,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Text(
|
||||
playerName,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Text(title.toUpperCase(), style: const TextStyle(fontSize: 12, fontWeight: FontWeight.bold, color: Colors.white70)),
|
||||
Text(playerName, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Colors.white)),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (isHighlighted)
|
||||
Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.amber,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.star,
|
||||
size: 20,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
if (isHighlighted) const Icon(Icons.star, color: Colors.amber, size: 20),
|
||||
],
|
||||
),
|
||||
|
||||
SizedBox(height: 10),
|
||||
|
||||
// Ícone do esporte
|
||||
Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
icon,
|
||||
size: 30,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
|
||||
Spacer(),
|
||||
|
||||
// Estatística central
|
||||
const Spacer(),
|
||||
Center(
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
statValue,
|
||||
style: TextStyle(
|
||||
fontSize: 42,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Text(
|
||||
statLabel.toUpperCase(),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.white.withOpacity(0.8),
|
||||
letterSpacing: 2,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Text(statValue, style: const TextStyle(fontSize: 38, fontWeight: FontWeight.bold, color: Colors.white)),
|
||||
),
|
||||
|
||||
Spacer(),
|
||||
|
||||
// Rodapé com botão
|
||||
Center(
|
||||
child: Text(statLabel, style: const TextStyle(fontSize: 12, color: Colors.white70)),
|
||||
),
|
||||
const Spacer(),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'VER DETALHES',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14,
|
||||
letterSpacing: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
decoration: BoxDecoration(color: Colors.white24, borderRadius: BorderRadius.circular(10)),
|
||||
child: const Center(child: Text('VER DETALHES', style: TextStyle(color: Colors.white, fontSize: 12))),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -326,5 +229,4 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user