fazer vitoria e derrota
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:playmaker/pages/PlacarPage.dart'; // Garante que o import está correto
|
||||
import 'package:playmaker/pages/PlacarPage.dart';
|
||||
import '../controllers/team_controller.dart';
|
||||
import '../controllers/game_controller.dart';
|
||||
|
||||
@@ -7,8 +7,9 @@ import '../controllers/game_controller.dart';
|
||||
class GameResultCard extends StatelessWidget {
|
||||
final String gameId;
|
||||
final String myTeam, opponentTeam, myScore, opponentScore, status, season;
|
||||
final String? myTeamLogo; // NOVA VARIÁVEL
|
||||
final String? opponentTeamLogo; // NOVA VARIÁVEL
|
||||
final String? myTeamLogo;
|
||||
final String? opponentTeamLogo;
|
||||
final double sf; // NOVA VARIÁVEL DE ESCALA
|
||||
|
||||
const GameResultCard({
|
||||
super.key,
|
||||
@@ -19,71 +20,70 @@ class GameResultCard extends StatelessWidget {
|
||||
required this.opponentScore,
|
||||
required this.status,
|
||||
required this.season,
|
||||
this.myTeamLogo, // ADICIONADO AO CONSTRUTOR
|
||||
this.opponentTeamLogo, // ADICIONADO AO CONSTRUTOR
|
||||
this.myTeamLogo,
|
||||
this.opponentTeamLogo,
|
||||
required this.sf, // OBRIGATÓRIO RECEBER A ESCALA
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
margin: EdgeInsets.only(bottom: 16 * sf),
|
||||
padding: EdgeInsets.all(16 * sf),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
boxShadow: const [BoxShadow(color: Colors.black12, blurRadius: 10)],
|
||||
borderRadius: BorderRadius.circular(20 * sf),
|
||||
boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 10 * sf)],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// Passamos a imagem para a função
|
||||
Expanded(child: _buildTeamInfo(myTeam, const Color(0xFFE74C3C), myTeamLogo)),
|
||||
_buildScoreCenter(context, gameId),
|
||||
// Passamos a imagem para a função
|
||||
Expanded(child: _buildTeamInfo(opponentTeam, Colors.black87, opponentTeamLogo)),
|
||||
Expanded(child: _buildTeamInfo(myTeam, const Color(0xFFE74C3C), myTeamLogo, sf)),
|
||||
_buildScoreCenter(context, gameId, sf),
|
||||
Expanded(child: _buildTeamInfo(opponentTeam, Colors.black87, opponentTeamLogo, sf)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ATUALIZADO para desenhar a imagem
|
||||
Widget _buildTeamInfo(String name, Color color, String? logoUrl) {
|
||||
Widget _buildTeamInfo(String name, Color color, String? logoUrl, double sf) {
|
||||
return Column(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 24 * sf, // Ajuste do tamanho do logo
|
||||
backgroundColor: color,
|
||||
backgroundImage: (logoUrl != null && logoUrl.isNotEmpty)
|
||||
? NetworkImage(logoUrl)
|
||||
: null,
|
||||
child: (logoUrl == null || logoUrl.isEmpty)
|
||||
? const Icon(Icons.shield, color: Colors.white)
|
||||
? Icon(Icons.shield, color: Colors.white, size: 24 * sf)
|
||||
: null,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
SizedBox(height: 6 * sf),
|
||||
Text(name,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 12),
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 13 * sf),
|
||||
textAlign: TextAlign.center,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 2, // Permite 2 linhas para nomes compridos não cortarem
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildScoreCenter(BuildContext context, String id) {
|
||||
Widget _buildScoreCenter(BuildContext context, String id, double sf) {
|
||||
return Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_scoreBox(myScore, Colors.green),
|
||||
const Text(" : ", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20)),
|
||||
_scoreBox(opponentScore, Colors.grey),
|
||||
_scoreBox(myScore, Colors.green, sf),
|
||||
Text(" : ", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 22 * sf)),
|
||||
_scoreBox(opponentScore, Colors.grey, sf),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
SizedBox(height: 10 * sf),
|
||||
TextButton.icon(
|
||||
onPressed: () {
|
||||
// NAVEGAÇÃO PARA O PLACAR (Usando o ID real)
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
@@ -95,25 +95,25 @@ class GameResultCard extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
},
|
||||
icon: const Icon(Icons.play_circle_fill, size: 16, color: Color(0xFFE74C3C)),
|
||||
label: const Text("RETORNAR", style: TextStyle(fontSize: 10, color: Color(0xFFE74C3C), fontWeight: FontWeight.bold)),
|
||||
icon: Icon(Icons.play_circle_fill, size: 18 * sf, color: const Color(0xFFE74C3C)),
|
||||
label: Text("RETORNAR", style: TextStyle(fontSize: 11 * sf, color: const Color(0xFFE74C3C), fontWeight: FontWeight.bold)),
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: const Color(0xFFE74C3C).withOpacity(0.1),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
||||
padding: EdgeInsets.symmetric(horizontal: 14 * sf, vertical: 8 * sf),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20 * sf)),
|
||||
visualDensity: VisualDensity.compact,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(status, style: const TextStyle(fontSize: 10, color: Colors.blue, fontWeight: FontWeight.bold)),
|
||||
SizedBox(height: 6 * sf),
|
||||
Text(status, style: TextStyle(fontSize: 12 * sf, color: Colors.blue, fontWeight: FontWeight.bold)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _scoreBox(String pts, Color c) => Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
decoration: BoxDecoration(color: c, borderRadius: BorderRadius.circular(8)),
|
||||
child: Text(pts, style: const TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
|
||||
Widget _scoreBox(String pts, Color c, double sf) => Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12 * sf, vertical: 6 * sf),
|
||||
decoration: BoxDecoration(color: c, borderRadius: BorderRadius.circular(8 * sf)),
|
||||
child: Text(pts, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 16 * sf)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -121,11 +121,13 @@ class GameResultCard extends StatelessWidget {
|
||||
class CreateGameDialogManual extends StatefulWidget {
|
||||
final TeamController teamController;
|
||||
final GameController gameController;
|
||||
final double sf; // NOVA VARIÁVEL DE ESCALA
|
||||
|
||||
const CreateGameDialogManual({
|
||||
super.key,
|
||||
required this.teamController,
|
||||
required this.gameController
|
||||
required this.gameController,
|
||||
required this.sf,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -153,33 +155,46 @@ class _CreateGameDialogManualState extends State<CreateGameDialogManual> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
||||
title: const Text('Configurar Partida', style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20 * widget.sf)),
|
||||
title: Text('Configurar Partida', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18 * widget.sf)),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextField(
|
||||
controller: _seasonController,
|
||||
decoration: const InputDecoration(labelText: 'Temporada', border: OutlineInputBorder(), prefixIcon: Icon(Icons.calendar_today)),
|
||||
style: TextStyle(fontSize: 14 * widget.sf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Temporada',
|
||||
labelStyle: TextStyle(fontSize: 14 * widget.sf),
|
||||
border: const OutlineInputBorder(),
|
||||
prefixIcon: Icon(Icons.calendar_today, size: 20 * widget.sf)
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
SizedBox(height: 15 * widget.sf),
|
||||
|
||||
_buildSearch(label: "Minha Equipa", controller: _myTeamController),
|
||||
_buildSearch(label: "Minha Equipa", controller: _myTeamController, sf: widget.sf),
|
||||
|
||||
const Padding(padding: EdgeInsets.symmetric(vertical: 8), child: Text("VS", style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey))),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 10 * widget.sf),
|
||||
child: Text("VS", style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 16 * widget.sf))
|
||||
),
|
||||
|
||||
_buildSearch(label: "Adversário", controller: _opponentController),
|
||||
_buildSearch(label: "Adversário", controller: _opponentController, sf: widget.sf),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Navigator.pop(context), child: const Text('CANCELAR')),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text('CANCELAR', style: TextStyle(fontSize: 14 * widget.sf))
|
||||
),
|
||||
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFFE74C3C),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10 * widget.sf)),
|
||||
padding: EdgeInsets.symmetric(horizontal: 16 * widget.sf, vertical: 10 * widget.sf)
|
||||
),
|
||||
onPressed: _isLoading ? null : () async {
|
||||
if (_myTeamController.text.isNotEmpty && _opponentController.text.isNotEmpty) {
|
||||
@@ -210,15 +225,14 @@ class _CreateGameDialogManualState extends State<CreateGameDialogManual> {
|
||||
}
|
||||
},
|
||||
child: _isLoading
|
||||
? const SizedBox(width: 20, height: 20, child: CircularProgressIndicator(color: Colors.white, strokeWidth: 2))
|
||||
: const Text('CRIAR', style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
|
||||
? SizedBox(width: 20 * widget.sf, height: 20 * widget.sf, child: const CircularProgressIndicator(color: Colors.white, strokeWidth: 2))
|
||||
: Text('CRIAR', style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 14 * widget.sf)),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// ATUALIZADO para usar Map e mostrar a imagem na lista de pesquisa
|
||||
Widget _buildSearch({required String label, required TextEditingController controller}) {
|
||||
Widget _buildSearch({required String label, required TextEditingController controller, required double sf}) {
|
||||
return StreamBuilder<List<Map<String, dynamic>>>(
|
||||
stream: widget.teamController.teamsStream,
|
||||
builder: (context, snapshot) {
|
||||
@@ -242,10 +256,9 @@ class _CreateGameDialogManualState extends State<CreateGameDialogManual> {
|
||||
alignment: Alignment.topLeft,
|
||||
child: Material(
|
||||
elevation: 4.0,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderRadius: BorderRadius.circular(8 * sf),
|
||||
child: ConstrainedBox(
|
||||
// Ajuste do tamanho máximo do pop-up de sugestões
|
||||
constraints: BoxConstraints(maxHeight: 250, maxWidth: MediaQuery.of(context).size.width * 0.7),
|
||||
constraints: BoxConstraints(maxHeight: 250 * sf, maxWidth: MediaQuery.of(context).size.width * 0.7),
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.zero,
|
||||
shrinkWrap: true,
|
||||
@@ -257,15 +270,16 @@ class _CreateGameDialogManualState extends State<CreateGameDialogManual> {
|
||||
|
||||
return ListTile(
|
||||
leading: CircleAvatar(
|
||||
radius: 20 * sf,
|
||||
backgroundColor: Colors.grey.shade200,
|
||||
backgroundImage: (imageUrl != null && imageUrl.isNotEmpty)
|
||||
? NetworkImage(imageUrl)
|
||||
: null,
|
||||
child: (imageUrl == null || imageUrl.isEmpty)
|
||||
? const Icon(Icons.shield, color: Colors.grey)
|
||||
? Icon(Icons.shield, color: Colors.grey, size: 20 * sf)
|
||||
: null,
|
||||
),
|
||||
title: Text(name, style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||
title: Text(name, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14 * sf)),
|
||||
onTap: () {
|
||||
onSelected(option);
|
||||
},
|
||||
@@ -288,9 +302,11 @@ class _CreateGameDialogManualState extends State<CreateGameDialogManual> {
|
||||
return TextField(
|
||||
controller: txtCtrl,
|
||||
focusNode: node,
|
||||
style: TextStyle(fontSize: 14 * sf),
|
||||
decoration: InputDecoration(
|
||||
labelText: label,
|
||||
prefixIcon: const Icon(Icons.search),
|
||||
labelStyle: TextStyle(fontSize: 14 * sf),
|
||||
prefixIcon: Icon(Icons.search, size: 20 * sf),
|
||||
border: const OutlineInputBorder()
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:playmaker/classe/home.config.dart';
|
||||
|
||||
class StatCard extends StatelessWidget {
|
||||
final String title;
|
||||
@@ -10,6 +9,11 @@ class StatCard extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final bool isHighlighted;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
// Variáveis novas para que o tamanho não fique preso à HomeConfig
|
||||
final double sf;
|
||||
final double cardWidth;
|
||||
final double cardHeight;
|
||||
|
||||
const StatCard({
|
||||
super.key,
|
||||
@@ -21,27 +25,30 @@ class StatCard extends StatelessWidget {
|
||||
required this.icon,
|
||||
this.isHighlighted = false,
|
||||
this.onTap,
|
||||
this.sf = 1.0, // Default 1.0 para não dar erro se não passares o valor
|
||||
required this.cardWidth,
|
||||
required this.cardHeight,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: HomeConfig.cardwidthPadding,
|
||||
height: HomeConfig.cardheightPadding,
|
||||
return SizedBox(
|
||||
width: cardWidth,
|
||||
height: cardHeight,
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: BorderRadius.circular(20 * sf),
|
||||
side: isHighlighted
|
||||
? BorderSide(color: Colors.amber, width: 2)
|
||||
? BorderSide(color: Colors.amber, width: 2 * sf)
|
||||
: BorderSide.none,
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: BorderRadius.circular(20 * sf),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: BorderRadius.circular(20 * sf),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
@@ -52,13 +59,14 @@ class StatCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
padding: EdgeInsets.all(16.0 * sf),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Cabeçalho
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
@@ -66,12 +74,12 @@ class StatCard extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
title.toUpperCase(),
|
||||
style: HomeConfig.titleStyle,
|
||||
style: TextStyle(fontSize: 11 * sf, fontWeight: FontWeight.bold, color: Colors.white70),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
SizedBox(height: 2 * sf),
|
||||
Text(
|
||||
playerName,
|
||||
style: HomeConfig.playerNameStyle,
|
||||
style: TextStyle(fontSize: 14 * sf, fontWeight: FontWeight.bold, color: Colors.white),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
@@ -80,38 +88,38 @@ class StatCard extends StatelessWidget {
|
||||
),
|
||||
if (isHighlighted)
|
||||
Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
padding: EdgeInsets.all(6 * sf),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.amber,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.star,
|
||||
size: 20,
|
||||
size: 16 * sf,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
SizedBox(height: 10),
|
||||
SizedBox(height: 8 * sf),
|
||||
|
||||
// Ícone
|
||||
Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
width: 45 * sf,
|
||||
height: 45 * sf,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
icon,
|
||||
size: 30,
|
||||
size: 24 * sf,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
|
||||
Spacer(),
|
||||
const Spacer(),
|
||||
|
||||
// Estatística
|
||||
Center(
|
||||
@@ -119,26 +127,26 @@ class StatCard extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
statValue,
|
||||
style: HomeConfig.statValueStyle,
|
||||
style: TextStyle(fontSize: 34 * sf, fontWeight: FontWeight.bold, color: Colors.white),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
SizedBox(height: 2 * sf),
|
||||
Text(
|
||||
statLabel.toUpperCase(),
|
||||
style: HomeConfig.statLabelStyle,
|
||||
style: TextStyle(fontSize: 12 * sf, color: Colors.white70),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Spacer(),
|
||||
const Spacer(),
|
||||
|
||||
// Botão
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.symmetric(vertical: 12),
|
||||
padding: EdgeInsets.symmetric(vertical: 8 * sf),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
borderRadius: BorderRadius.circular(10 * sf),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
@@ -146,7 +154,7 @@ class StatCard extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14,
|
||||
fontSize: 11 * sf,
|
||||
letterSpacing: 1,
|
||||
),
|
||||
),
|
||||
@@ -169,12 +177,12 @@ class SportGrid extends StatelessWidget {
|
||||
const SportGrid({
|
||||
super.key,
|
||||
required this.children,
|
||||
this.spacing = HomeConfig.cardSpacing,
|
||||
this.spacing = 20.0, // Valor padrão se não for passado nada
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (children.isEmpty) return SizedBox();
|
||||
if (children.isEmpty) return const SizedBox();
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
|
||||
@@ -5,35 +5,48 @@ import 'package:playmaker/controllers/placar_controller.dart';
|
||||
class TopScoreboard extends StatelessWidget {
|
||||
final PlacarController controller;
|
||||
final double sf;
|
||||
|
||||
const TopScoreboard({super.key, required this.controller, required this.sf});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 8 * sf, horizontal: 30 * sf),
|
||||
padding: EdgeInsets.symmetric(vertical: 10 * sf, horizontal: 35 * sf),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF16202C),
|
||||
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(20 * sf), bottomRight: Radius.circular(20 * sf)),
|
||||
border: Border.all(color: Colors.white, width: 2 * sf),
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(22 * sf),
|
||||
bottomRight: Radius.circular(22 * sf)
|
||||
),
|
||||
border: Border.all(color: Colors.white, width: 2.5 * sf),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_buildTeamSection(controller.myTeam, controller.myScore, controller.myFouls, controller.myTimeoutsUsed, const Color(0xFF1E5BB2), false, sf),
|
||||
SizedBox(width: 25 * sf),
|
||||
SizedBox(width: 30 * sf),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16 * sf, vertical: 4 * sf),
|
||||
decoration: BoxDecoration(color: const Color(0xFF2C3E50), borderRadius: BorderRadius.circular(8 * sf)),
|
||||
child: Text(controller.formatTime(), style: TextStyle(color: Colors.white, fontSize: 26 * sf, fontWeight: FontWeight.w900, fontFamily: 'monospace', letterSpacing: 2 * sf)),
|
||||
padding: EdgeInsets.symmetric(horizontal: 18 * sf, vertical: 5 * sf),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF2C3E50),
|
||||
borderRadius: BorderRadius.circular(9 * sf)
|
||||
),
|
||||
child: Text(
|
||||
controller.formatTime(),
|
||||
style: TextStyle(color: Colors.white, fontSize: 28 * sf, fontWeight: FontWeight.w900, fontFamily: 'monospace', letterSpacing: 2 * sf)
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5 * sf),
|
||||
Text(
|
||||
"PERÍODO ${controller.currentQuarter}",
|
||||
style: TextStyle(color: Colors.orangeAccent, fontSize: 14 * sf, fontWeight: FontWeight.w900)
|
||||
),
|
||||
SizedBox(height: 4 * sf),
|
||||
Text("PERÍODO ${controller.currentQuarter}", style: TextStyle(color: Colors.orangeAccent, fontSize: 13 * sf, fontWeight: FontWeight.w900)),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 25 * sf),
|
||||
SizedBox(width: 30 * sf),
|
||||
_buildTeamSection(controller.opponentTeam, controller.opponentScore, controller.opponentFouls, controller.opponentTimeoutsUsed, const Color(0xFFD92C2C), true, sf),
|
||||
],
|
||||
),
|
||||
@@ -41,24 +54,42 @@ class TopScoreboard extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _buildTeamSection(String name, int score, int fouls, int timeouts, Color color, bool isOpp, double sf) {
|
||||
int displayFouls = fouls > 5 ? 5 : fouls;
|
||||
|
||||
final timeoutIndicators = Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: List.generate(3, (index) => Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 3 * sf),
|
||||
width: 10 * sf, height: 10 * sf,
|
||||
decoration: BoxDecoration(shape: BoxShape.circle, color: index < timeouts ? Colors.yellow : Colors.grey.shade600, border: Border.all(color: Colors.white54, width: 1.5 * sf)),
|
||||
margin: EdgeInsets.symmetric(horizontal: 3.5 * sf),
|
||||
width: 12 * sf, height: 12 * sf,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: index < timeouts ? Colors.yellow : Colors.grey.shade600,
|
||||
border: Border.all(color: Colors.white54, width: 1.5 * sf)
|
||||
),
|
||||
)),
|
||||
);
|
||||
|
||||
List<Widget> content = [
|
||||
Column(children: [_scoreBox(score, color, sf), SizedBox(height: 6 * sf), timeoutIndicators]),
|
||||
SizedBox(width: 15 * sf),
|
||||
Column(
|
||||
children: [
|
||||
_scoreBox(score, color, sf),
|
||||
SizedBox(height: 7 * sf),
|
||||
timeoutIndicators
|
||||
]
|
||||
),
|
||||
SizedBox(width: 18 * sf),
|
||||
Column(
|
||||
crossAxisAlignment: isOpp ? CrossAxisAlignment.start : CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(name.toUpperCase(), style: TextStyle(color: Colors.white, fontSize: 18 * sf, fontWeight: FontWeight.w900, letterSpacing: 1 * sf)),
|
||||
SizedBox(height: 4 * sf),
|
||||
Text("FALTAS: $fouls", style: TextStyle(color: fouls >= 5 ? Colors.redAccent : Colors.yellowAccent, fontSize: 12 * sf, fontWeight: FontWeight.bold)),
|
||||
Text(
|
||||
name.toUpperCase(),
|
||||
style: TextStyle(color: Colors.white, fontSize: 20 * sf, fontWeight: FontWeight.w900, letterSpacing: 1.2 * sf)
|
||||
),
|
||||
SizedBox(height: 5 * sf),
|
||||
Text(
|
||||
"FALTAS: $displayFouls",
|
||||
style: TextStyle(color: displayFouls >= 5 ? Colors.redAccent : Colors.yellowAccent, fontSize: 13 * sf, fontWeight: FontWeight.bold)
|
||||
),
|
||||
],
|
||||
)
|
||||
];
|
||||
@@ -67,10 +98,10 @@ class TopScoreboard extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _scoreBox(int score, Color color, double sf) => Container(
|
||||
width: 50 * sf, height: 40 * sf,
|
||||
width: 58 * sf, height: 45 * sf,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(color: color, borderRadius: BorderRadius.circular(6 * sf)),
|
||||
child: Text(score.toString(), style: TextStyle(color: Colors.white, fontSize: 24 * sf, fontWeight: FontWeight.w900)),
|
||||
decoration: BoxDecoration(color: color, borderRadius: BorderRadius.circular(7 * sf)),
|
||||
child: Text(score.toString(), style: TextStyle(color: Colors.white, fontSize: 26 * sf, fontWeight: FontWeight.w900)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -79,6 +110,7 @@ class BenchPlayersList extends StatelessWidget {
|
||||
final PlacarController controller;
|
||||
final bool isOpponent;
|
||||
final double sf;
|
||||
|
||||
const BenchPlayersList({super.key, required this.controller, required this.isOpponent, required this.sf});
|
||||
|
||||
@override
|
||||
@@ -95,23 +127,45 @@ class BenchPlayersList extends StatelessWidget {
|
||||
final bool isFouledOut = fouls >= 5;
|
||||
|
||||
Widget avatarUI = Container(
|
||||
margin: EdgeInsets.only(bottom: 6 * sf),
|
||||
decoration: BoxDecoration(shape: BoxShape.circle, border: Border.all(color: Colors.white, width: 1.5 * sf), boxShadow: [BoxShadow(color: Colors.black45, blurRadius: 4 * sf, offset: Offset(0, 2 * sf))]),
|
||||
margin: EdgeInsets.only(bottom: 7 * sf),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: Colors.white, width: 1.8 * sf),
|
||||
boxShadow: [BoxShadow(color: Colors.black45, blurRadius: 5 * sf, offset: Offset(0, 2.5 * sf))]
|
||||
),
|
||||
child: CircleAvatar(
|
||||
radius: 20 * sf,
|
||||
radius: 22 * sf,
|
||||
backgroundColor: isFouledOut ? Colors.grey.shade800 : teamColor,
|
||||
child: Text(num, style: TextStyle(color: isFouledOut ? Colors.red.shade300 : Colors.white, fontSize: 14 * sf, fontWeight: FontWeight.bold, decoration: isFouledOut ? TextDecoration.lineThrough : TextDecoration.none)),
|
||||
child: Text(
|
||||
num,
|
||||
style: TextStyle(
|
||||
color: isFouledOut ? Colors.red.shade300 : Colors.white,
|
||||
fontSize: 16 * sf,
|
||||
fontWeight: FontWeight.bold,
|
||||
decoration: isFouledOut ? TextDecoration.lineThrough : TextDecoration.none
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
if (isFouledOut) {
|
||||
return GestureDetector(onTap: () => ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('🛑 $playerName não pode voltar (Expulso).'), backgroundColor: Colors.red)), child: avatarUI);
|
||||
return GestureDetector(
|
||||
onTap: () => ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('🛑 $playerName não pode voltar (Expulso).'), backgroundColor: Colors.red)),
|
||||
child: avatarUI
|
||||
);
|
||||
}
|
||||
|
||||
return Draggable<String>(
|
||||
data: "$prefix$playerName",
|
||||
feedback: Material(color: Colors.transparent, child: CircleAvatar(radius: 25 * sf, backgroundColor: teamColor, child: Text(num, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 16 * sf)))),
|
||||
childWhenDragging: Opacity(opacity: 0.5, child: SizedBox(width: 40 * sf, height: 40 * sf)),
|
||||
feedback: Material(
|
||||
color: Colors.transparent,
|
||||
child: CircleAvatar(
|
||||
radius: 28 * sf,
|
||||
backgroundColor: teamColor,
|
||||
child: Text(num, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 18 * sf))
|
||||
)
|
||||
),
|
||||
childWhenDragging: Opacity(opacity: 0.5, child: SizedBox(width: 45 * sf, height: 45 * sf)),
|
||||
child: avatarUI,
|
||||
);
|
||||
}).toList(),
|
||||
@@ -140,17 +194,20 @@ class PlayerCourtCard extends StatelessWidget {
|
||||
feedback: Material(
|
||||
color: Colors.transparent,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16 * sf, vertical: 10 * sf),
|
||||
decoration: BoxDecoration(color: teamColor.withOpacity(0.9), borderRadius: BorderRadius.circular(8 * sf)),
|
||||
child: Text(name, style: TextStyle(color: Colors.white, fontSize: 18 * sf, fontWeight: FontWeight.bold)),
|
||||
padding: EdgeInsets.symmetric(horizontal: 18 * sf, vertical: 11 * sf),
|
||||
decoration: BoxDecoration(color: teamColor.withOpacity(0.9), borderRadius: BorderRadius.circular(9 * sf)),
|
||||
child: Text(name, style: TextStyle(color: Colors.white, fontSize: 20 * sf, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
),
|
||||
childWhenDragging: Opacity(opacity: 0.5, child: _playerCardUI(number, name, stats, teamColor, false, false, sf)),
|
||||
child: DragTarget<String>(
|
||||
onAcceptWithDetails: (details) {
|
||||
final action = details.data;
|
||||
if (action.startsWith("add_") || action.startsWith("sub_") || action.startsWith("miss_")) controller.handleActionDrag(context, action, "$prefix$name");
|
||||
else if (action.startsWith("bench_")) controller.handleSubbing(context, action, name, isOpponent);
|
||||
if (action.startsWith("add_") || action.startsWith("sub_") || action.startsWith("miss_")) {
|
||||
controller.handleActionDrag(context, action, "$prefix$name");
|
||||
} else if (action.startsWith("bench_")) {
|
||||
controller.handleSubbing(context, action, name, isOpponent);
|
||||
}
|
||||
},
|
||||
builder: (context, candidateData, rejectedData) {
|
||||
bool isSubbing = candidateData.any((data) => data != null && (data.startsWith("bench_my_") || data.startsWith("bench_opp_")));
|
||||
@@ -165,8 +222,12 @@ class PlayerCourtCard extends StatelessWidget {
|
||||
bool isFouledOut = stats["fls"]! >= 5;
|
||||
Color bgColor = isFouledOut ? Colors.red.shade50 : Colors.white;
|
||||
Color borderColor = isFouledOut ? Colors.redAccent : Colors.transparent;
|
||||
if (isSubbing) { bgColor = Colors.blue.shade50; borderColor = Colors.blue; }
|
||||
else if (isActionHover && !isFouledOut) { bgColor = Colors.orange.shade50; borderColor = Colors.orange; }
|
||||
|
||||
if (isSubbing) {
|
||||
bgColor = Colors.blue.shade50; borderColor = Colors.blue;
|
||||
} else if (isActionHover && !isFouledOut) {
|
||||
bgColor = Colors.orange.shade50; borderColor = Colors.orange;
|
||||
}
|
||||
|
||||
int fgm = stats["fgm"]!;
|
||||
int fga = stats["fga"]!;
|
||||
@@ -176,111 +237,135 @@ class PlayerCourtCard extends StatelessWidget {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: bgColor,
|
||||
borderRadius: BorderRadius.circular(8 * sf),
|
||||
border: Border.all(color: borderColor, width: 2 * sf),
|
||||
boxShadow: [BoxShadow(color: Colors.black45, blurRadius: 4 * sf, offset: Offset(2 * sf, 3 * sf))],
|
||||
borderRadius: BorderRadius.circular(11 * sf),
|
||||
border: Border.all(color: borderColor, width: 1.8 * sf),
|
||||
boxShadow: [BoxShadow(color: Colors.black26, blurRadius: 5 * sf, offset: Offset(2 * sf, 3.5 * sf))],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10 * sf, vertical: 12 * sf),
|
||||
decoration: BoxDecoration(color: isFouledOut ? Colors.grey[700] : teamColor, borderRadius: BorderRadius.horizontal(left: Radius.circular(6 * sf))),
|
||||
child: Text(number, style: TextStyle(color: Colors.white, fontSize: 18 * sf, fontWeight: FontWeight.w900)),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(9 * sf),
|
||||
child: IntrinsicHeight(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16 * sf),
|
||||
color: isFouledOut ? Colors.grey[700] : teamColor,
|
||||
alignment: Alignment.center,
|
||||
child: Text(number, style: TextStyle(color: Colors.white, fontSize: 22 * sf, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12 * sf, vertical: 7 * sf),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
displayName,
|
||||
style: TextStyle(fontSize: 16 * sf, fontWeight: FontWeight.bold, color: isFouledOut ? Colors.red : Colors.black87, decoration: isFouledOut ? TextDecoration.lineThrough : TextDecoration.none)
|
||||
),
|
||||
SizedBox(height: 2.5 * sf),
|
||||
Text(
|
||||
"${stats["pts"]} Pts | FG: $fgm/$fga ($fgPercent%)",
|
||||
style: TextStyle(fontSize: 12 * sf, color: isFouledOut ? Colors.red : Colors.grey[700], fontWeight: FontWeight.w600)
|
||||
),
|
||||
Text(
|
||||
"${stats["ast"]} Ast | ${stats["orb"]! + stats["drb"]!} Rbs | ${stats["fls"]} Fls",
|
||||
style: TextStyle(fontSize: 12 * sf, color: isFouledOut ? Colors.red : Colors.grey[500], fontWeight: FontWeight.w600)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8 * sf, vertical: 4 * sf),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(displayName, style: TextStyle(fontSize: 14 * sf, fontWeight: FontWeight.bold, color: isFouledOut ? Colors.red : Colors.black87, decoration: isFouledOut ? TextDecoration.lineThrough : TextDecoration.none)),
|
||||
Text("${stats["pts"]} Pts | FG: $fgm/$fga ($fgPercent%)", style: TextStyle(fontSize: 10 * sf, color: isFouledOut ? Colors.red : Colors.grey[800], fontWeight: FontWeight.bold)),
|
||||
Text("${stats["ast"]} Ast | ${stats["rbs"]} Rbs | ${stats["fls"]} Fls", style: TextStyle(fontSize: 10 * sf, color: isFouledOut ? Colors.red : Colors.grey[600], fontWeight: FontWeight.w600)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// --- PAINEL DE BOTÕES DE AÇÃO (PONTO REBUÇADO) ---
|
||||
// --- PAINEL DE BOTÕES DE AÇÃO ---
|
||||
class ActionButtonsPanel extends StatelessWidget {
|
||||
final PlacarController controller;
|
||||
final double sf;
|
||||
|
||||
const ActionButtonsPanel({super.key, required this.controller, required this.sf});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Aumentei ligeiramente o tamanho dos botões de ação face ao último código!
|
||||
final double baseSize = 56 * sf; // Era 48 (inicialmente 65)
|
||||
final double feedSize = 70 * sf; // Era 60 (inicialmente 80)
|
||||
final double gap = 10 * sf;
|
||||
final double baseSize = 65 * sf; // Reduzido (Antes era 75)
|
||||
final double feedSize = 82 * sf; // Reduzido (Antes era 95)
|
||||
final double gap = 7 * sf;
|
||||
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
_columnBtn([
|
||||
_actionBtn("T.O", const Color(0xFF1E5BB2), () => controller.useTimeout(false), baseSize, feedSize, sf),
|
||||
_dragAndTargetBtn("M1", Colors.redAccent, "miss_1", baseSize, feedSize, sf),
|
||||
_dragAndTargetBtn("1", Colors.orange, "add_pts_1", baseSize, feedSize, sf),
|
||||
_dragAndTargetBtn("1", Colors.orange, "sub_pts_1", baseSize, feedSize, sf, isX: true),
|
||||
_dragAndTargetBtn("STL", Colors.green, "add_stl", baseSize, feedSize, sf),
|
||||
], gap),
|
||||
SizedBox(width: gap * 2),
|
||||
SizedBox(width: gap * 1),
|
||||
_columnBtn([
|
||||
_dragAndTargetBtn("M2", Colors.redAccent, "miss_2", baseSize, feedSize, sf),
|
||||
_dragAndTargetBtn("2", Colors.orange, "add_pts_2", baseSize, feedSize, sf),
|
||||
_dragAndTargetBtn("2", Colors.orange, "sub_pts_2", baseSize, feedSize, sf, isX: true),
|
||||
_dragAndTargetBtn("AST", Colors.blueGrey, "add_ast", baseSize, feedSize, sf),
|
||||
], gap),
|
||||
SizedBox(width: gap * 2),
|
||||
SizedBox(width: gap * 1),
|
||||
_columnBtn([
|
||||
_dragAndTargetBtn("M3", Colors.redAccent, "miss_3", baseSize, feedSize, sf),
|
||||
_dragAndTargetBtn("3", Colors.orange, "add_pts_3", baseSize, feedSize, sf),
|
||||
_dragAndTargetBtn("3", Colors.orange, "sub_pts_3", baseSize, feedSize, sf, isX: true),
|
||||
_dragAndTargetBtn("TOV", Colors.redAccent, "add_tov", baseSize, feedSize, sf),
|
||||
], gap),
|
||||
SizedBox(width: gap * 2),
|
||||
SizedBox(width: gap * 1),
|
||||
_columnBtn([
|
||||
_actionBtn("T.O", const Color(0xFFD92C2C), () => controller.useTimeout(true), baseSize, feedSize, sf),
|
||||
_dragAndTargetBtn("ORB", const Color(0xFF1E2A38), "add_rbs", baseSize, feedSize, sf, icon: Icons.sports_basketball),
|
||||
_dragAndTargetBtn("DRB", const Color(0xFF1E2A38), "add_rbs", baseSize, feedSize, sf, icon: Icons.sports_basketball),
|
||||
_dragAndTargetBtn("ORB", const Color(0xFF1E2A38), "add_orb", baseSize, feedSize, sf, icon: Icons.sports_basketball),
|
||||
_dragAndTargetBtn("DRB", const Color(0xFF1E2A38), "add_drb", baseSize, feedSize, sf, icon: Icons.sports_basketball),
|
||||
_dragAndTargetBtn("BLK", Colors.deepPurple, "add_blk", baseSize, feedSize, sf, icon: Icons.front_hand),
|
||||
], gap),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _columnBtn(List<Widget> children, double gap) => Column(mainAxisSize: MainAxisSize.min, children: children.map((c) => Padding(padding: EdgeInsets.only(bottom: gap), child: c)).toList());
|
||||
Widget _columnBtn(List<Widget> children, double gap) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: children.map((c) => Padding(padding: EdgeInsets.only(bottom: gap), child: c)).toList()
|
||||
);
|
||||
}
|
||||
|
||||
Widget _dragAndTargetBtn(String label, Color color, String actionData, double baseSize, double feedSize, double sf, {IconData? icon, bool isX = false}) {
|
||||
return Draggable<String>(
|
||||
data: actionData,
|
||||
feedback: _circle(label, color, icon, true, baseSize, feedSize, sf, isX: isX),
|
||||
childWhenDragging: Opacity(opacity: 0.5, child: _circle(label, color, icon, false, baseSize, feedSize, sf, isX: isX)),
|
||||
childWhenDragging: Opacity(
|
||||
opacity: 0.5,
|
||||
child: _circle(label, color, icon, false, baseSize, feedSize, sf, isX: isX)
|
||||
),
|
||||
child: DragTarget<String>(
|
||||
onAcceptWithDetails: (details) {},
|
||||
builder: (context, candidateData, rejectedData) {
|
||||
bool isHovered = candidateData.any((data) => data != null && data.startsWith("player_"));
|
||||
return Transform.scale(
|
||||
scale: isHovered ? 1.15 : 1.0,
|
||||
child: Container(decoration: isHovered ? BoxDecoration(shape: BoxShape.circle, boxShadow: [BoxShadow(color: Colors.white, blurRadius: 10 * sf, spreadRadius: 3 * sf)]) : null, child: _circle(label, color, icon, false, baseSize, feedSize, sf, isX: isX)),
|
||||
child: Container(
|
||||
decoration: isHovered ? BoxDecoration(shape: BoxShape.circle, boxShadow: [BoxShadow(color: Colors.white, blurRadius: 10 * sf, spreadRadius: 3 * sf)]) : null,
|
||||
child: _circle(label, color, icon, false, baseSize, feedSize, sf, isX: isX)
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _actionBtn(String label, Color color, VoidCallback onTap, double baseSize, double feedSize, double sf, {IconData? icon, bool isX = false}) {
|
||||
return GestureDetector(onTap: onTap, child: _circle(label, color, icon, false, baseSize, feedSize, sf, isX: isX));
|
||||
}
|
||||
|
||||
Widget _circle(String label, Color color, IconData? icon, bool isFeed, double baseSize, double feedSize, double sf, {bool isX = false}) {
|
||||
double size = isFeed ? feedSize : baseSize;
|
||||
Widget content;
|
||||
bool isPointBtn = label == "1" || label == "2" || label == "3" || label == "M2" || label == "M3";
|
||||
bool isPointBtn = label == "1" || label == "2" || label == "3" || label == "M1" || label == "M2" || label == "M3";
|
||||
bool isBlkBtn = label == "BLK";
|
||||
|
||||
if (isPointBtn) {
|
||||
@@ -297,8 +382,7 @@ class ActionButtonsPanel extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
else if (isBlkBtn) {
|
||||
} else if (isBlkBtn) {
|
||||
content = Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
@@ -319,12 +403,14 @@ class ActionButtonsPanel extends StatelessWidget {
|
||||
}
|
||||
|
||||
return Stack(
|
||||
clipBehavior: Clip.none, alignment: Alignment.bottomRight,
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.bottomRight,
|
||||
children: [
|
||||
Container(
|
||||
width: size, height: size,
|
||||
decoration: (isPointBtn || isBlkBtn) ? const BoxDecoration(color: Colors.transparent) : BoxDecoration(gradient: RadialGradient(colors: [color.withOpacity(0.7), color], radius: 0.8), shape: BoxShape.circle, boxShadow: [BoxShadow(color: Colors.black38, blurRadius: 6 * sf, offset: Offset(0, 3 * sf))]),
|
||||
alignment: Alignment.center, child: content,
|
||||
alignment: Alignment.center,
|
||||
child: content,
|
||||
),
|
||||
if (isX) Positioned(top: 0, right: 0, child: Container(decoration: const BoxDecoration(color: Colors.white, shape: BoxShape.circle), child: Icon(Icons.cancel, color: Colors.red, size: size * 0.4))),
|
||||
],
|
||||
|
||||
@@ -7,12 +7,14 @@ class TeamCard extends StatelessWidget {
|
||||
final Team team;
|
||||
final TeamController controller;
|
||||
final VoidCallback onFavoriteTap;
|
||||
final double sf; // <-- Variável de escala
|
||||
|
||||
const TeamCard({
|
||||
super.key,
|
||||
required this.team,
|
||||
required this.controller,
|
||||
required this.onFavoriteTap,
|
||||
required this.sf,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -20,17 +22,17 @@ class TeamCard extends StatelessWidget {
|
||||
return Card(
|
||||
color: Colors.white,
|
||||
elevation: 3,
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
|
||||
margin: EdgeInsets.only(bottom: 12 * sf),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15 * sf)),
|
||||
child: ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 16 * sf, vertical: 8 * sf),
|
||||
|
||||
// --- 1. IMAGEM + FAVORITO ---
|
||||
leading: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 28,
|
||||
radius: 28 * sf,
|
||||
backgroundColor: Colors.grey[200],
|
||||
backgroundImage: (team.imageUrl.isNotEmpty && team.imageUrl.startsWith('http'))
|
||||
? NetworkImage(team.imageUrl)
|
||||
@@ -38,22 +40,22 @@ class TeamCard extends StatelessWidget {
|
||||
child: (team.imageUrl.isEmpty || !team.imageUrl.startsWith('http'))
|
||||
? Text(
|
||||
team.imageUrl.isEmpty ? "🏀" : team.imageUrl,
|
||||
style: const TextStyle(fontSize: 24),
|
||||
style: TextStyle(fontSize: 24 * sf),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
Positioned(
|
||||
left: -15,
|
||||
top: -10,
|
||||
left: -15 * sf,
|
||||
top: -10 * sf,
|
||||
child: IconButton(
|
||||
icon: Icon(
|
||||
team.isFavorite ? Icons.star : Icons.star_border,
|
||||
color: team.isFavorite ? Colors.amber : Colors.black.withOpacity(0.1),
|
||||
size: 28,
|
||||
size: 28 * sf,
|
||||
shadows: [
|
||||
Shadow(
|
||||
color: Colors.black.withOpacity(team.isFavorite ? 0.3 : 0.1),
|
||||
blurRadius: 4,
|
||||
blurRadius: 4 * sf,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -66,89 +68,89 @@ class TeamCard extends StatelessWidget {
|
||||
// --- 2. TÍTULO ---
|
||||
title: Text(
|
||||
team.name,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16 * sf),
|
||||
overflow: TextOverflow.ellipsis, // Previne overflows em nomes longos
|
||||
),
|
||||
|
||||
// --- 3. SUBTÍTULO (Contagem + Época) ---
|
||||
subtitle: Padding(
|
||||
padding: const EdgeInsets.only(top: 6.0),
|
||||
padding: EdgeInsets.only(top: 6.0 * sf),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.groups_outlined, size: 16, color: Colors.grey),
|
||||
const SizedBox(width: 4),
|
||||
Icon(Icons.groups_outlined, size: 16 * sf, color: Colors.grey),
|
||||
SizedBox(width: 4 * sf),
|
||||
FutureBuilder<int>(
|
||||
future: controller.getPlayerCount(team.id),
|
||||
initialData: 0,
|
||||
builder: (context, snapshot) {
|
||||
final count = snapshot.data ?? 0;
|
||||
return Text(
|
||||
"$count Jogadores",
|
||||
"$count Jogs.", // Abreviado para poupar espaço
|
||||
style: TextStyle(
|
||||
color: count > 0 ? Colors.green[700] : Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 13,
|
||||
fontSize: 13 * sf,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
"| ${team.season}",
|
||||
style: const TextStyle(color: Colors.grey, fontSize: 13),
|
||||
SizedBox(width: 8 * sf),
|
||||
Expanded( // Garante que a temporada se adapta se faltar espaço
|
||||
child: Text(
|
||||
"| ${team.season}",
|
||||
style: TextStyle(color: Colors.grey, fontSize: 13 * sf),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// --- 4. BOTÕES (Estatísticas e Apagar) ---
|
||||
trailing: SizedBox(
|
||||
width: 96, // Aumentei um pouco para caberem bem os dois botões
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
IconButton(
|
||||
tooltip: 'Ver Estatísticas',
|
||||
icon: const Icon(Icons.bar_chart_rounded, color: Colors.blue),
|
||||
onPressed: () {
|
||||
// CORRIGIDO: Agora chama a classe TeamStatsPage corretamente
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => TeamStatsPage(team: team),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Eliminar Equipa',
|
||||
icon: const Icon(Icons.delete_outline, color: Color(0xFFE74C3C)),
|
||||
onPressed: () => _confirmDelete(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
// Removido o SizedBox fixo! Agora é MainAxisSize.min
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min, // <-- ISTO RESOLVE O OVERFLOW DAS RISCAS AMARELAS
|
||||
children: [
|
||||
IconButton(
|
||||
tooltip: 'Ver Estatísticas',
|
||||
icon: Icon(Icons.bar_chart_rounded, color: Colors.blue, size: 24 * sf),
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => TeamStatsPage(team: team),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Eliminar Equipa',
|
||||
icon: Icon(Icons.delete_outline, color: const Color(0xFFE74C3C), size: 24 * sf),
|
||||
onPressed: () => _confirmDelete(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Função de confirmação de exclusão
|
||||
void _confirmDelete(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('Eliminar Equipa?'),
|
||||
content: Text('Tens a certeza que queres eliminar "${team.name}"?'),
|
||||
title: Text('Eliminar Equipa?', style: TextStyle(fontSize: 18 * sf, fontWeight: FontWeight.bold)),
|
||||
content: Text('Tens a certeza que queres eliminar "${team.name}"?', style: TextStyle(fontSize: 14 * sf)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text('Cancelar'),
|
||||
child: Text('Cancelar', style: TextStyle(fontSize: 14 * sf)),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
controller.deleteTeam(team.id);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Eliminar', style: TextStyle(color: Colors.red)),
|
||||
child: Text('Eliminar', style: TextStyle(color: Colors.red, fontSize: 14 * sf)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -159,8 +161,9 @@ class TeamCard extends StatelessWidget {
|
||||
// --- DIALOG DE CRIAÇÃO ---
|
||||
class CreateTeamDialog extends StatefulWidget {
|
||||
final Function(String name, String season, String imageUrl) onConfirm;
|
||||
final double sf; // Recebe a escala
|
||||
|
||||
const CreateTeamDialog({super.key, required this.onConfirm});
|
||||
const CreateTeamDialog({super.key, required this.onConfirm, required this.sf});
|
||||
|
||||
@override
|
||||
State<CreateTeamDialog> createState() => _CreateTeamDialogState();
|
||||
@@ -174,40 +177,58 @@ class _CreateTeamDialogState extends State<CreateTeamDialog> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Nova Equipa'),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15 * widget.sf)),
|
||||
title: Text('Nova Equipa', style: TextStyle(fontSize: 18 * widget.sf, fontWeight: FontWeight.bold)),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextField(
|
||||
controller: _nameController,
|
||||
decoration: const InputDecoration(labelText: 'Nome da Equipa'),
|
||||
style: TextStyle(fontSize: 14 * widget.sf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Nome da Equipa',
|
||||
labelStyle: TextStyle(fontSize: 14 * widget.sf)
|
||||
),
|
||||
textCapitalization: TextCapitalization.words,
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
SizedBox(height: 15 * widget.sf),
|
||||
DropdownButtonFormField<String>(
|
||||
value: _selectedSeason,
|
||||
decoration: const InputDecoration(labelText: 'Temporada'),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Temporada',
|
||||
labelStyle: TextStyle(fontSize: 14 * widget.sf)
|
||||
),
|
||||
style: TextStyle(fontSize: 14 * widget.sf, color: Colors.black87),
|
||||
items: ['2023/24', '2024/25', '2025/26']
|
||||
.map((s) => DropdownMenuItem(value: s, child: Text(s)))
|
||||
.toList(),
|
||||
onChanged: (val) => setState(() => _selectedSeason = val!),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
SizedBox(height: 15 * widget.sf),
|
||||
TextField(
|
||||
controller: _imageController,
|
||||
decoration: const InputDecoration(
|
||||
style: TextStyle(fontSize: 14 * widget.sf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'URL Imagem ou Emoji',
|
||||
labelStyle: TextStyle(fontSize: 14 * widget.sf),
|
||||
hintText: 'Ex: 🏀 ou https://...',
|
||||
hintStyle: TextStyle(fontSize: 14 * widget.sf)
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Navigator.pop(context), child: const Text('Cancelar')),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text('Cancelar', style: TextStyle(fontSize: 14 * widget.sf))
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(backgroundColor: const Color(0xFFE74C3C)),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFFE74C3C),
|
||||
padding: EdgeInsets.symmetric(horizontal: 16 * widget.sf, vertical: 10 * widget.sf)
|
||||
),
|
||||
onPressed: () {
|
||||
if (_nameController.text.trim().isNotEmpty) {
|
||||
widget.onConfirm(
|
||||
@@ -218,7 +239,7 @@ class _CreateTeamDialogState extends State<CreateTeamDialog> {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
child: const Text('Criar', style: TextStyle(color: Colors.white)),
|
||||
child: Text('Criar', style: TextStyle(color: Colors.white, fontSize: 14 * widget.sf)),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user