vai te lixar github
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:playmaker/controllers/placar_controller.dart';
|
||||
import 'package:playmaker/zone_map_dialog.dart';
|
||||
|
||||
// --- PLACAR SUPERIOR ---
|
||||
// ============================================================================
|
||||
// 1. PLACAR SUPERIOR (CRONÓMETRO E RESULTADO)
|
||||
// ============================================================================
|
||||
class TopScoreboard extends StatelessWidget {
|
||||
final PlacarController controller;
|
||||
final double sf;
|
||||
@@ -105,7 +108,9 @@ class TopScoreboard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
// --- BANCO DE SUPLENTES ---
|
||||
// ============================================================================
|
||||
// 2. BANCO DE SUPLENTES (DRAG & DROP)
|
||||
// ============================================================================
|
||||
class BenchPlayersList extends StatelessWidget {
|
||||
final PlacarController controller;
|
||||
final bool isOpponent;
|
||||
@@ -173,7 +178,12 @@ class BenchPlayersList extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
// --- CARTÃO DO JOGADOR NO CAMPO ---
|
||||
// ============================================================================
|
||||
// 3. CARTÃO DO JOGADOR NO CAMPO (TARGET DE FALTAS/PONTOS/SUBSTITUIÇÕES)
|
||||
// ============================================================================
|
||||
// ============================================================================
|
||||
// 3. CARTÃO DO JOGADOR NO CAMPO (AGORA ABRE O POPUP AMARELO)
|
||||
// ============================================================================
|
||||
class PlayerCourtCard extends StatelessWidget {
|
||||
final PlacarController controller;
|
||||
final String name;
|
||||
@@ -203,7 +213,27 @@ class PlayerCourtCard extends StatelessWidget {
|
||||
child: DragTarget<String>(
|
||||
onAcceptWithDetails: (details) {
|
||||
final action = details.data;
|
||||
if (action.startsWith("add_") || action.startsWith("sub_") || action.startsWith("miss_")) {
|
||||
|
||||
// 👇 SE FOR UM LANÇAMENTO DE CAMPO (2 OU 3 PONTOS), ABRE O POPUP AMARELO!
|
||||
if (action == "add_pts_2" || action == "add_pts_3" || action == "miss_2" || action == "miss_3") {
|
||||
bool isMake = action.startsWith("add_");
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => ZoneMapDialog(
|
||||
playerName: name,
|
||||
isMake: isMake,
|
||||
onZoneSelected: (zone, points, relX, relY) {
|
||||
Navigator.pop(ctx); // Fecha o popup amarelo
|
||||
|
||||
// 👇 MANDA OS DADOS PARA O CONTROLLER! (Vais ter de criar esta função no PlacarController)
|
||||
controller.registerShotFromPopup(context, action, "$prefix$name", zone, points, relX, relY);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
// Se for 1 Ponto (Lance Livre), Falta, Ressalto ou Roubo, FAZ TUDO NORMAL!
|
||||
else 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);
|
||||
@@ -219,15 +249,13 @@ class PlayerCourtCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _playerCardUI(String number, String name, Map<String, int> stats, Color teamColor, bool isSubbing, bool isActionHover, double sf) {
|
||||
// ... (Mantém o teu código de design _playerCardUI que já tinhas aqui dentro, fica igualzinho!)
|
||||
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"]!;
|
||||
@@ -260,19 +288,10 @@ class PlayerCourtCard extends StatelessWidget {
|
||||
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)
|
||||
),
|
||||
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)
|
||||
),
|
||||
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)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -284,7 +303,9 @@ class PlayerCourtCard extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
// --- PAINEL DE BOTÕES DE AÇÃO ---
|
||||
// ============================================================================
|
||||
// 4. PAINEL DE BOTÕES DE AÇÃO (PONTOS, RESSALTOS, ETC)
|
||||
// ============================================================================
|
||||
class ActionButtonsPanel extends StatelessWidget {
|
||||
final PlacarController controller;
|
||||
final double sf;
|
||||
@@ -293,8 +314,8 @@ class ActionButtonsPanel extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final double baseSize = 65 * sf; // Reduzido (Antes era 75)
|
||||
final double feedSize = 82 * sf; // Reduzido (Antes era 95)
|
||||
final double baseSize = 65 * sf;
|
||||
final double feedSize = 82 * sf;
|
||||
final double gap = 7 * sf;
|
||||
|
||||
return Row(
|
||||
@@ -347,7 +368,7 @@ class ActionButtonsPanel extends StatelessWidget {
|
||||
child: _circle(label, color, icon, false, baseSize, feedSize, sf, isX: isX)
|
||||
),
|
||||
child: DragTarget<String>(
|
||||
onAcceptWithDetails: (details) {},
|
||||
onAcceptWithDetails: (details) {}, // O PlayerCourtCard é que processa a ação!
|
||||
builder: (context, candidateData, rejectedData) {
|
||||
bool isHovered = candidateData.any((data) => data != null && data.startsWith("player_"));
|
||||
return Transform.scale(
|
||||
@@ -408,7 +429,9 @@ class ActionButtonsPanel extends StatelessWidget {
|
||||
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))]),
|
||||
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,
|
||||
),
|
||||
@@ -416,4 +439,5 @@ class ActionButtonsPanel extends StatelessWidget {
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user