melhorar a camisola

This commit is contained in:
2026-04-23 16:13:21 +01:00
parent 4075c56d44
commit 309a2f98bc
2 changed files with 195 additions and 311 deletions

View File

@@ -257,6 +257,9 @@ class ShirtPainter extends CustomPainter {
bool shouldRepaint(ShirtPainter old) => old.color != color || old.isFouledOut != isFouledOut;
}
// ============================================================================
// CARD DO JOGADOR NO CAMPO
// ============================================================================
class PlayerCourtCard extends StatelessWidget {
final PlacarController controller;
final String playerId;
@@ -327,7 +330,7 @@ class PlayerCourtCard extends StatelessWidget {
);
}
Widget _playerCardUI(String number, String displayNameStr, Map<String, int> stats, Color teamColor, bool isSubbing, bool isActionHover, double sf) {
Widget _playerCardUI(String number, String displayNameStr, Map<String, int> stats, Color teamColor, bool isSubbing, bool isActionHover, double sf) {
bool isFouledOut = stats["fls"]! >= 5;
Color bgColor = isFouledOut ? Colors.red.shade100 : Colors.white;
Color borderColor = isFouledOut ? AppTheme.actionMiss : Colors.transparent;
@@ -339,77 +342,67 @@ class PlayerCourtCard extends StatelessWidget {
String fgPercent = fga > 0 ? ((fgm / fga) * 100).toStringAsFixed(0) : "0";
String displayName = displayNameStr.length > 12 ? "${displayNameStr.substring(0, 10)}..." : displayNameStr;
// Tamanho da camisola
final double shirtSize = 38 * sf;
// Tamanho da camisola ajustado para ficar perfeito no cartão
final double shirtSize = 42 * sf;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 4),
padding: EdgeInsets.symmetric(horizontal: 8 * sf, vertical: 6 * sf),
decoration: BoxDecoration(
color: bgColor,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: borderColor, width: 1.5),
boxShadow: const [BoxShadow(color: Colors.black26, blurRadius: 4, offset: Offset(0, 2))],
borderRadius: BorderRadius.circular(8 * sf),
border: Border.all(color: borderColor, width: 1.5 * sf),
boxShadow: [BoxShadow(color: Colors.black26, blurRadius: 4 * sf, offset: Offset(0, 2 * sf))],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(6 * sf),
child: IntrinsicHeight(
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// ── Camisola com número ──────────────────────────────
Container(
padding: EdgeInsets.symmetric(horizontal: 6 * sf, vertical: 4 * sf),
color: isFouledOut ? Colors.grey.shade200 : teamColor.withOpacity(0.12),
child: IntrinsicHeight(
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center, // Centra verticalmente a camisola com o texto
children: [
// ── APENAS A CAMISOLA (Sem quadrado de fundo) ──
SizedBox(
width: shirtSize,
height: shirtSize,
child: Stack(
alignment: Alignment.center,
child: SizedBox(
width: shirtSize,
height: shirtSize * 1.1,
child: Stack(
alignment: Alignment.center,
children: [
// Camisola desenhada
CustomPaint(
size: Size(shirtSize, shirtSize * 1.1),
painter: ShirtPainter(
color: isFouledOut ? Colors.grey.shade600 : teamColor,
isFouledOut: isFouledOut,
),
),
// Número por cima
Padding(
padding: EdgeInsets.only(top: shirtSize * 0.15),
child: Text(
number,
style: TextStyle(
color: Colors.white,
fontSize: shirtSize * 0.42,
fontWeight: FontWeight.w900,
decoration: isFouledOut ? TextDecoration.lineThrough : TextDecoration.none,
shadows: const [Shadow(color: Colors.black45, blurRadius: 3)],
),
),
),
],
children: [
CustomPaint(
size: Size(shirtSize, shirtSize),
painter: ShirtPainter(
color: teamColor,
isFouledOut: isFouledOut,
),
),
),
Padding(
padding: EdgeInsets.only(top: shirtSize * 0.15),
child: Text(
number,
style: TextStyle(
color: Colors.white,
fontSize: shirtSize * 0.40,
fontWeight: FontWeight.w900,
decoration: isFouledOut ? TextDecoration.lineThrough : TextDecoration.none,
shadows: const [Shadow(color: Colors.black45, blurRadius: 2, offset: Offset(1, 1))],
),
),
),
],
),
// ── Estatísticas ─────────────────────────────────────
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 ? AppTheme.actionMiss : Colors.black87, decoration: isFouledOut ? TextDecoration.lineThrough : TextDecoration.none)),
SizedBox(height: 1.5 * sf),
Text("${stats["pts"]} Pts | FG: $fgm/$fga ($fgPercent%)", style: TextStyle(fontSize: 10 * sf, color: isFouledOut ? AppTheme.actionMiss : Colors.grey[700], fontWeight: FontWeight.w600)),
Text("${stats["ast"]} Ast | ${stats["orb"]! + stats["drb"]!} Rbs | ${stats["fls"]} Fls", style: TextStyle(fontSize: 10 * sf, color: isFouledOut ? AppTheme.actionMiss : Colors.grey[500], fontWeight: FontWeight.w600)),
],
),
),
],
),
),
SizedBox(width: 8 * sf), // Espaço entre a camisola e as estatísticas
// ── Estatísticas ─────────────────────────────────────
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text(displayName, style: TextStyle(fontSize: 14 * sf, fontWeight: FontWeight.bold, color: isFouledOut ? AppTheme.actionMiss : Colors.black87, decoration: isFouledOut ? TextDecoration.lineThrough : TextDecoration.none)),
SizedBox(height: 1.5 * sf),
Text("${stats["pts"]} Pts | FG: $fgm/$fga ($fgPercent%)", style: TextStyle(fontSize: 10 * sf, color: isFouledOut ? AppTheme.actionMiss : Colors.grey[700], fontWeight: FontWeight.w600)),
Text("${stats["ast"]} Ast | ${stats["orb"]! + stats["drb"]!} Rbs | ${stats["fls"]} Fls", style: TextStyle(fontSize: 10 * sf, color: isFouledOut ? AppTheme.actionMiss : Colors.grey[500], fontWeight: FontWeight.w600)),
],
),
],
),
),
);