tentative de firebase
This commit is contained in:
@@ -2,35 +2,40 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class HomeConfig {
|
||||
// Dimensões dos cards
|
||||
static const double cardwidthPadding = 400;
|
||||
static const double cardheightPadding = 300;
|
||||
static const double cardwidthPadding = 400;
|
||||
static const double cardheightPadding = 300;
|
||||
|
||||
// Cores principais
|
||||
// Cores
|
||||
static const Color primaryColor = Colors.orange;
|
||||
static const Color secondaryColor = Colors.blue;
|
||||
static const Color accentColor = Colors.green;
|
||||
|
||||
// Espaçamentos
|
||||
static const double cardSpacing = 20;
|
||||
static const double cardMargin = 10;
|
||||
|
||||
// Estilos de texto
|
||||
static TextStyle titleStyle = TextStyle(
|
||||
fontSize: 20,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
color: Colors.white.withOpacity(0.9),
|
||||
letterSpacing: 1.5,
|
||||
);
|
||||
|
||||
static TextStyle subtitleStyle = TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.white.withOpacity(0.8),
|
||||
static TextStyle playerNameStyle = TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
);
|
||||
|
||||
static TextStyle statValueStyle = TextStyle(
|
||||
fontSize: 36,
|
||||
fontSize: 42,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
height: 1,
|
||||
);
|
||||
|
||||
static TextStyle statLabelStyle = TextStyle(
|
||||
fontSize: 12,
|
||||
fontSize: 14,
|
||||
color: Colors.white.withOpacity(0.8),
|
||||
letterSpacing: 1.5,
|
||||
letterSpacing: 2,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class HomeController extends ChangeNotifier {
|
||||
// Se precisar de estado para a home screen
|
||||
int _selectedCardIndex = 0;
|
||||
|
||||
int get selectedCardIndex => _selectedCardIndex;
|
||||
|
||||
void selectCard(int index) {
|
||||
_selectedCardIndex = index;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
// Métodos adicionais para lógica da home
|
||||
void navigateToDetails(String playerName) {
|
||||
print('Navegando para detalhes de $playerName');
|
||||
// Implementar navegação
|
||||
}
|
||||
|
||||
void refreshData() {
|
||||
print('Atualizando dados da home...');
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ class _PieChartCardState extends State<PieChartCard> with SingleTickerProviderSt
|
||||
width: HomeConfig.cardwidthPadding,
|
||||
height: HomeConfig.cardheightPadding,
|
||||
child: Card(
|
||||
elevation: 8,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
|
||||
53
lib/models/home_models.dart
Normal file
53
lib/models/home_models.dart
Normal file
@@ -0,0 +1,53 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SportStat {
|
||||
final String title;
|
||||
final String playerName;
|
||||
final String statValue;
|
||||
final String statLabel;
|
||||
final Color color;
|
||||
final IconData icon;
|
||||
final bool isHighlighted;
|
||||
|
||||
const SportStat({
|
||||
required this.title,
|
||||
required this.playerName,
|
||||
required this.statValue,
|
||||
required this.statLabel,
|
||||
required this.color,
|
||||
required this.icon,
|
||||
this.isHighlighted = false,
|
||||
});
|
||||
}
|
||||
|
||||
class HomeData {
|
||||
static List<SportStat> get sportStats => [
|
||||
SportStat(
|
||||
title: 'Mais Pontos',
|
||||
playerName: 'Michael Jordan',
|
||||
statValue: '34.5',
|
||||
statLabel: 'PPG',
|
||||
color: Colors.blue[800]!,
|
||||
icon: Icons.sports_basketball,
|
||||
isHighlighted: true,
|
||||
),
|
||||
SportStat(
|
||||
title: 'Mais Assistências',
|
||||
playerName: 'Magic Johnson',
|
||||
statValue: '12.8',
|
||||
statLabel: 'APG',
|
||||
color: Colors.green[800]!,
|
||||
icon: Icons.sports_basketball,
|
||||
isHighlighted: false,
|
||||
),
|
||||
SportStat(
|
||||
title: 'Mais Rebotes',
|
||||
playerName: 'Dennis Rodman',
|
||||
statValue: '15.3',
|
||||
statLabel: 'RPG',
|
||||
color: Colors.purple[800]!,
|
||||
icon: Icons.sports_basketball,
|
||||
isHighlighted: false,
|
||||
),
|
||||
];
|
||||
}
|
||||
@@ -2,9 +2,41 @@ import 'package:flutter/material.dart';
|
||||
import 'package:playmaker/classe/home.config.dart';
|
||||
import 'package:playmaker/grafico%20de%20pizza/grafico.dart';
|
||||
|
||||
class HomeScreen extends StatelessWidget {
|
||||
class HomeScreen extends StatefulWidget {
|
||||
const HomeScreen({super.key});
|
||||
|
||||
@override
|
||||
State<HomeScreen> createState() => _HomeScreenState();
|
||||
}
|
||||
|
||||
class _HomeScreenState extends State<HomeScreen> {
|
||||
int _selectedIndex = 0;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -22,6 +54,7 @@ class HomeScreen extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Primeira linha com 2 cards
|
||||
Row(
|
||||
@@ -40,14 +73,14 @@ class HomeScreen extends StatelessWidget {
|
||||
|
||||
SizedBox(width: 20),
|
||||
|
||||
// Card 2 - Estatísticas de Futebol
|
||||
// Card 2 - Estatísticas de Basquete (corrigido)
|
||||
_buildStatCard(
|
||||
title: 'Mais Assistências',
|
||||
playerName: 'magic Johnson',
|
||||
playerName: 'Magic Johnson',
|
||||
statValue: '12.8',
|
||||
statLabel: 'APG',
|
||||
color: Colors.green[800]!,
|
||||
icon: Icons.sports_soccer,
|
||||
icon: Icons.sports_basketball, // Corrigido para basquete
|
||||
isHighlighted: false,
|
||||
),
|
||||
],
|
||||
@@ -59,21 +92,21 @@ class HomeScreen extends StatelessWidget {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Card 3 - Estatísticas de Tênis
|
||||
// Card 3 - Estatísticas de Basquete (corrigido)
|
||||
_buildStatCard(
|
||||
title: 'Mais Rebotes',
|
||||
playerName: 'Denis Rodman',
|
||||
playerName: 'Dennis Rodman',
|
||||
statValue: '15.3',
|
||||
statLabel: 'RPG',
|
||||
color: Colors.purple[800]!,
|
||||
icon: Icons.sports_tennis,
|
||||
icon: Icons.sports_basketball, // Corrigido para basquete
|
||||
isHighlighted: false,
|
||||
),
|
||||
|
||||
SizedBox(width: 20),
|
||||
|
||||
// Card 4 - Estatísticas de Vôlei
|
||||
PieChartCard(
|
||||
// Card 4 - Gráfico
|
||||
PieChartCard(
|
||||
title: 'DESEMPENHO',
|
||||
subtitle: 'Vitórias vs Derrotas',
|
||||
backgroundColor: Colors.red[800]!,
|
||||
@@ -83,10 +116,54 @@ class HomeScreen extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
SizedBox(height: 40),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'Histórico de Jogos',
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.grey[800],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// ⬇️⬇️⬇️ NAVIGATION BAR AQUI ⬇️⬇️⬇️
|
||||
bottomNavigationBar: NavigationBar(
|
||||
selectedIndex: _selectedIndex,
|
||||
onDestinationSelected: _onItemSelected,
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
surfaceTintColor: Theme.of(context).colorScheme.surfaceTint,
|
||||
elevation: 1,
|
||||
height: 70,
|
||||
destinations: const [
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.home_outlined),
|
||||
selectedIcon: Icon(Icons.home_filled),
|
||||
label: 'Home',
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.sports_soccer_outlined),
|
||||
selectedIcon: Icon(Icons.sports_soccer),
|
||||
label: 'Jogo',
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.people_outline),
|
||||
selectedIcon: Icon(Icons.people),
|
||||
label: 'Equipas',
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.insights_outlined),
|
||||
selectedIcon: Icon(Icons.insights),
|
||||
label: 'Status',
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -104,7 +181,7 @@ class HomeScreen extends StatelessWidget {
|
||||
width: HomeConfig.cardwidthPadding,
|
||||
height: HomeConfig.cardheightPadding,
|
||||
child: Card(
|
||||
elevation: isHighlighted ? 12 : 8,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
side: isHighlighted
|
||||
@@ -122,13 +199,6 @@ class HomeScreen extends StatelessWidget {
|
||||
color.withOpacity(0.7),
|
||||
],
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: color.withOpacity(0.3),
|
||||
blurRadius: 15,
|
||||
spreadRadius: 2,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
@@ -256,4 +326,5 @@ class HomeScreen extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1
lib/screens/game_screen.dart
Normal file
1
lib/screens/game_screen.dart
Normal file
@@ -0,0 +1 @@
|
||||
import 'package:flutter/material.dart';
|
||||
208
lib/widgets/home_widgets.dart
Normal file
208
lib/widgets/home_widgets.dart
Normal file
@@ -0,0 +1,208 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:playmaker/classe/home.config.dart';
|
||||
|
||||
class StatCard extends StatelessWidget {
|
||||
final String title;
|
||||
final String playerName;
|
||||
final String statValue;
|
||||
final String statLabel;
|
||||
final Color color;
|
||||
final IconData icon;
|
||||
final bool isHighlighted;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
const StatCard({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.playerName,
|
||||
required this.statValue,
|
||||
required this.statLabel,
|
||||
required this.color,
|
||||
required this.icon,
|
||||
this.isHighlighted = false,
|
||||
this.onTap,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: HomeConfig.cardwidthPadding,
|
||||
height: HomeConfig.cardheightPadding,
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
side: isHighlighted
|
||||
? BorderSide(color: Colors.amber, width: 2)
|
||||
: BorderSide.none,
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
color.withOpacity(0.9),
|
||||
color.withOpacity(0.7),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Cabeçalho
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title.toUpperCase(),
|
||||
style: HomeConfig.titleStyle,
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Text(
|
||||
playerName,
|
||||
style: HomeConfig.playerNameStyle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (isHighlighted)
|
||||
Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.amber,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.star,
|
||||
size: 20,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
SizedBox(height: 10),
|
||||
|
||||
// Ícone
|
||||
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
|
||||
Center(
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
statValue,
|
||||
style: HomeConfig.statValueStyle,
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Text(
|
||||
statLabel.toUpperCase(),
|
||||
style: HomeConfig.statLabelStyle,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Spacer(),
|
||||
|
||||
// Botão
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SportGrid extends StatelessWidget {
|
||||
final List<Widget> children;
|
||||
final double spacing;
|
||||
|
||||
const SportGrid({
|
||||
super.key,
|
||||
required this.children,
|
||||
this.spacing = HomeConfig.cardSpacing,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (children.isEmpty) return SizedBox();
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
// Primeira linha
|
||||
if (children.length >= 2)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: spacing),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
children[0],
|
||||
SizedBox(width: spacing),
|
||||
children[1],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Segunda linha
|
||||
if (children.length >= 4)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
children[2],
|
||||
SizedBox(width: spacing),
|
||||
children[3],
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user