fazer camisola

This commit is contained in:
2026-04-23 10:43:21 +01:00
parent 59927521f1
commit 4075c56d44
2 changed files with 140 additions and 98 deletions

View File

@@ -214,6 +214,49 @@ class BenchPopup extends StatelessWidget {
}
}
// ============================================================================
// SHIRT PAINTER — camisola desenhada com CustomPainter
// ============================================================================
class ShirtPainter extends CustomPainter {
final Color color;
final bool isFouledOut;
const ShirtPainter({required this.color, this.isFouledOut = false});
@override
void paint(Canvas canvas, Size size) {
final double w = size.width;
final double h = size.height;
final Color shirtColor = isFouledOut ? Colors.grey.shade700 : color;
final paint = Paint()..color = shirtColor..style = PaintingStyle.fill;
final strokePaint = Paint()
..color = Colors.white.withOpacity(0.25)
..style = PaintingStyle.stroke
..strokeWidth = w * 0.04;
final path = Path();
// Mangas
path.moveTo(w * 0.18, h * 0.18);
path.lineTo(w * 0.00, h * 0.42);
path.lineTo(w * 0.20, h * 0.52);
path.lineTo(w * 0.20, h * 0.95);
path.lineTo(w * 0.80, h * 0.95);
path.lineTo(w * 0.80, h * 0.52);
path.lineTo(w * 1.00, h * 0.42);
path.lineTo(w * 0.82, h * 0.18);
// Gola em V
path.quadraticBezierTo(w * 0.68, h * 0.32, w * 0.50, h * 0.30);
path.quadraticBezierTo(w * 0.32, h * 0.32, w * 0.18, h * 0.18);
path.close();
canvas.drawPath(path, paint);
canvas.drawPath(path, strokePaint);
}
@override
bool shouldRepaint(ShirtPainter old) => old.color != color || old.isFouledOut != isFouledOut;
}
class PlayerCourtCard extends StatelessWidget {
final PlacarController controller;
final String playerId;
@@ -296,22 +339,62 @@ 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;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 4),
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))]),
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))],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(6 * sf),
child: IntrinsicHeight(
child: IntrinsicHeight(
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// ── Camisola com número ──────────────────────────────
Container(
padding: EdgeInsets.symmetric(horizontal: 10 * sf),
color: isFouledOut ? Colors.grey[700] : teamColor,
padding: EdgeInsets.symmetric(horizontal: 6 * sf, vertical: 4 * sf),
color: isFouledOut ? Colors.grey.shade200 : teamColor.withOpacity(0.12),
alignment: Alignment.center,
child: Text(number, style: TextStyle(color: Colors.white, fontSize: 18 * sf, fontWeight: FontWeight.bold)),
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)],
),
),
),
],
),
),
),
// ── Estatísticas ─────────────────────────────────────
Padding(
padding: EdgeInsets.symmetric(horizontal: 8 * sf, vertical: 4 * sf),
child: Column(