From 8e179df1dc326476aacba6db1b01719b5a6bef06 Mon Sep 17 00:00:00 2001 From: 230404 <230404@epvc.pt> Date: Fri, 12 Dec 2025 10:37:10 +0000 Subject: [PATCH] tentative de firebase --- android/app/build.gradle.kts | 10 + android/app/google-services.json | 9 + android/build.gradle.kts | 6 + lib/classe/home.config.dart | 31 +-- lib/controllers/home_controller.dart | 24 ++ lib/grafico de pizza/grafico.dart | 2 +- lib/models/home_models.dart | 53 +++++ lib/pages/home.dart | 107 +++++++-- lib/screens/game_screen.dart | 1 + lib/widgets/home_widgets.dart | 208 ++++++++++++++++++ macos/Flutter/GeneratedPluginRegistrant.swift | 4 + pubspec.lock | 103 ++++++++- pubspec.yaml | 2 + .../flutter/generated_plugin_registrant.cc | 6 + windows/flutter/generated_plugins.cmake | 2 + 15 files changed, 535 insertions(+), 33 deletions(-) create mode 100644 android/app/google-services.json create mode 100644 lib/models/home_models.dart create mode 100644 lib/screens/game_screen.dart create mode 100644 lib/widgets/home_widgets.dart diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 19abc82..c95d943 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -37,6 +37,16 @@ android { signingConfig = signingConfigs.getByName("debug") } } + +// Adicione no FINAL do arquivo: +apply plugin: 'com.google.gms.google-services' + +dependencies { + // Dependências do Firebase que você vai usar + implementation 'com.google.firebase:firebase-analytics' + // Adicione outras conforme necessário +} + } flutter { diff --git a/android/app/google-services.json b/android/app/google-services.json new file mode 100644 index 0000000..280f900 --- /dev/null +++ b/android/app/google-services.json @@ -0,0 +1,9 @@ +{ + "project_info": { + "project_number": "123456789012", + "project_id": "playmaker-basketball", + "storage_bucket": "playmaker-basketball.appspot.com" + }, + "client": [], + "configuration_version": "1" +} \ No newline at end of file diff --git a/android/build.gradle.kts b/android/build.gradle.kts index dbee657..f98099a 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -22,3 +22,9 @@ subprojects { tasks.register("clean") { delete(rootProject.layout.buildDirectory) } +buildscript { + dependencies { + // Adicione esta linha: + classpath 'com.google.gms:google-services:4.4.0' + } +} diff --git a/lib/classe/home.config.dart b/lib/classe/home.config.dart index 17acc88..472293b 100644 --- a/lib/classe/home.config.dart +++ b/lib/classe/home.config.dart @@ -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, ); } \ No newline at end of file diff --git a/lib/controllers/home_controller.dart b/lib/controllers/home_controller.dart index e69de29..63f3f74 100644 --- a/lib/controllers/home_controller.dart +++ b/lib/controllers/home_controller.dart @@ -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(); + } +} \ No newline at end of file diff --git a/lib/grafico de pizza/grafico.dart b/lib/grafico de pizza/grafico.dart index a05f7e7..174f816 100644 --- a/lib/grafico de pizza/grafico.dart +++ b/lib/grafico de pizza/grafico.dart @@ -73,7 +73,7 @@ class _PieChartCardState extends State with SingleTickerProviderSt width: HomeConfig.cardwidthPadding, height: HomeConfig.cardheightPadding, child: Card( - elevation: 8, + elevation: 0, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(20), ), diff --git a/lib/models/home_models.dart b/lib/models/home_models.dart new file mode 100644 index 0000000..df50fdf --- /dev/null +++ b/lib/models/home_models.dart @@ -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 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, + ), + ]; +} \ No newline at end of file diff --git a/lib/pages/home.dart b/lib/pages/home.dart index bb4274c..2002644 100644 --- a/lib/pages/home.dart +++ b/lib/pages/home.dart @@ -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 createState() => _HomeScreenState(); +} + +class _HomeScreenState extends State { + 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 { ), ); } -} \ No newline at end of file +} + diff --git a/lib/screens/game_screen.dart b/lib/screens/game_screen.dart new file mode 100644 index 0000000..a47f241 --- /dev/null +++ b/lib/screens/game_screen.dart @@ -0,0 +1 @@ +import 'package:flutter/material.dart'; diff --git a/lib/widgets/home_widgets.dart b/lib/widgets/home_widgets.dart new file mode 100644 index 0000000..04b3f48 --- /dev/null +++ b/lib/widgets/home_widgets.dart @@ -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 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], + ], + ), + ], + ); + } +} \ No newline at end of file diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index cccf817..7b9be20 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,6 +5,10 @@ import FlutterMacOS import Foundation +import firebase_auth +import firebase_core func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin")) + FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) } diff --git a/pubspec.lock b/pubspec.lock index fe03fd7..070c0d2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,14 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + _flutterfire_internals: + dependency: transitive + description: + name: _flutterfire_internals + sha256: "8a1f5f3020ef2a74fb93f7ab3ef127a8feea33a7a2276279113660784ee7516a" + url: "https://pub.dev" + source: hosted + version: "1.3.64" async: dependency: transitive description: @@ -57,6 +65,54 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.3" + firebase_auth: + dependency: "direct main" + description: + name: firebase_auth + sha256: e54fb3ba57de041d832574126a37726eedf0f57400869f1942b0ca8ce4a6e209 + url: "https://pub.dev" + source: hosted + version: "6.1.2" + firebase_auth_platform_interface: + dependency: transitive + description: + name: firebase_auth_platform_interface + sha256: "421f95dc553cb283ed9d4d140e719800c0331d49ed37b962e513c9d1d61b090b" + url: "https://pub.dev" + source: hosted + version: "8.1.4" + firebase_auth_web: + dependency: transitive + description: + name: firebase_auth_web + sha256: a064ffee202f7d42d62e2c01775899d4ffcb83c602af07632f206acd46a0964e + url: "https://pub.dev" + source: hosted + version: "6.1.0" + firebase_core: + dependency: "direct main" + description: + name: firebase_core + sha256: "1f2dfd9f535d81f8b06d7a50ecda6eac1e6922191ed42e09ca2c84bd2288927c" + url: "https://pub.dev" + source: hosted + version: "4.2.1" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + sha256: cccb4f572325dc14904c02fcc7db6323ad62ba02536833dddb5c02cac7341c64 + url: "https://pub.dev" + source: hosted + version: "6.0.2" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + sha256: ff18fabb0ad0ed3595d2f2c85007ecc794aadecdff5b3bb1460b7ee47cded398 + url: "https://pub.dev" + source: hosted + version: "3.3.0" flutter: dependency: "direct main" description: flutter @@ -75,6 +131,27 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + http: + dependency: transitive + description: + name: http + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" + url: "https://pub.dev" + source: hosted + version: "1.6.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" leak_tracker: dependency: transitive description: @@ -147,6 +224,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.9.1" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" provider: dependency: "direct main" description: @@ -208,6 +293,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.7" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" vector_math: dependency: transitive description: @@ -224,6 +317,14 @@ packages: url: "https://pub.dev" source: hosted version: "15.0.2" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" sdks: dart: ">=3.9.2 <4.0.0" - flutter: ">=3.18.0-18.0.pre.54" + flutter: ">=3.22.0" diff --git a/pubspec.yaml b/pubspec.yaml index 3a843f4..f07822b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -35,6 +35,8 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.8 provider: ^6.1.5+1 + firebase_core: ^4.2.1 + firebase_auth: ^6.1.2 dev_dependencies: flutter_test: diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 8b6d468..d141b74 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,6 +6,12 @@ #include "generated_plugin_registrant.h" +#include +#include void RegisterPlugins(flutter::PluginRegistry* registry) { + FirebaseAuthPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FirebaseAuthPluginCApi")); + FirebaseCorePluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FirebaseCorePluginCApi")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index b93c4c3..29944d5 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,6 +3,8 @@ # list(APPEND FLUTTER_PLUGIN_LIST + firebase_auth + firebase_core ) list(APPEND FLUTTER_FFI_PLUGIN_LIST