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

@@ -18,44 +18,42 @@ class ActionButtonsPanel extends StatelessWidget {
final double gap = 5 * sf; final double gap = 5 * sf;
return Padding( return Padding(
// 👇 AJUSTA ESTE VALOR (ex: 30, 50, 80) PARA SUBIR MAIS OU MENOS
padding: EdgeInsets.only(bottom: 12 * sf), padding: EdgeInsets.only(bottom: 12 * sf),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
_columnBtn([ _columnBtn([
_dragAndTargetBtn("M1", AppTheme.actionMiss, "miss_1", baseSize, feedSize, sf), _dragAndTargetBtn("-1", AppTheme.actionMiss, "miss_1", baseSize, feedSize, sf, badge: ""),
_dragAndTargetBtn("1", AppTheme.actionPoints, "add_pts_1", baseSize, feedSize, sf), _dragAndTargetBtn("1", AppTheme.actionPoints, "add_pts_1", baseSize, feedSize, sf, badge: "FTM"),
_dragAndTargetBtn("1", AppTheme.actionPoints, "sub_pts_1", baseSize, feedSize, sf, isX: true), _dragAndTargetBtn("1", AppTheme.actionPoints, "sub_pts_1", baseSize, feedSize, sf, badge: "FTA", isX: true),
_dragAndTargetBtn("STL", AppTheme.actionSteal, "add_stl", baseSize, feedSize, sf), _dragAndTargetBtn("STL", AppTheme.actionSteal, "add_stl", baseSize, feedSize, sf, badge: "STL"),
], gap), ], gap),
SizedBox(width: gap), SizedBox(width: gap),
_columnBtn([ _columnBtn([
_dragAndTargetBtn("M2", AppTheme.actionMiss, "miss_2", baseSize, feedSize, sf), _dragAndTargetBtn("-2", AppTheme.actionMiss, "miss_2", baseSize, feedSize, sf, badge: ""),
_dragAndTargetBtn("2", AppTheme.actionPoints, "add_pts_2", baseSize, feedSize, sf), _dragAndTargetBtn("2", AppTheme.actionPoints, "add_pts_2", baseSize, feedSize, sf, badge: "2PM"),
_dragAndTargetBtn("2", AppTheme.actionPoints, "sub_pts_2", baseSize, feedSize, sf, isX: true), _dragAndTargetBtn("2", AppTheme.actionPoints, "sub_pts_2", baseSize, feedSize, sf, badge: "2PA", isX: true),
_dragAndTargetBtn("AST", AppTheme.actionAssist, "add_ast", baseSize, feedSize, sf), _dragAndTargetBtn("AST", AppTheme.actionAssist, "add_ast", baseSize, feedSize, sf, badge: "AST"),
], gap), ], gap),
SizedBox(width: gap), SizedBox(width: gap),
_columnBtn([ _columnBtn([
_dragAndTargetBtn("M3", AppTheme.actionMiss, "miss_3", baseSize, feedSize, sf), _dragAndTargetBtn("-3", AppTheme.actionMiss, "miss_3", baseSize, feedSize, sf, badge: ""),
_dragAndTargetBtn("3", AppTheme.actionPoints, "add_pts_3", baseSize, feedSize, sf), _dragAndTargetBtn("3", AppTheme.actionPoints, "add_pts_3", baseSize, feedSize, sf, badge: "3PM"),
_dragAndTargetBtn("3", AppTheme.actionPoints, "sub_pts_3", baseSize, feedSize, sf, isX: true), _dragAndTargetBtn("3", AppTheme.actionPoints, "sub_pts_3", baseSize, feedSize, sf, badge: "3PA", isX: true),
_dragAndTargetBtn("TOV", AppTheme.actionMiss, "add_tov", baseSize, feedSize, sf), _dragAndTargetBtn("TOV", AppTheme.actionMiss, "add_tov", baseSize, feedSize, sf, badge: "TOV"),
], gap), ], gap),
SizedBox(width: gap), SizedBox(width: gap),
_columnBtn([ _columnBtn([
_dragAndTargetBtn("O", AppTheme.actionRebound, "add_orb", baseSize, feedSize, sf), _dragAndTargetBtn("O", AppTheme.actionRebound, "add_orb", baseSize, feedSize, sf, badge: "OREB"),
_dragAndTargetBtn("D", AppTheme.actionRebound, "add_drb", baseSize, feedSize, sf), _dragAndTargetBtn("D", AppTheme.actionRebound, "add_drb", baseSize, feedSize, sf, badge: "DREB"),
_dragAndTargetBtn("BLK", AppTheme.actionBlock, "add_blk", baseSize, feedSize, sf), _dragAndTargetBtn("BLK", AppTheme.actionBlock, "add_blk", baseSize, feedSize, sf, badge: "BLK"),
], gap), ], gap),
], ],
), ),
); );
} }
// ... (o resto dos teus métodos como _columnBtn, _dragAndTargetBtn, etc., mantêm-se iguais)
Widget _columnBtn(List<Widget> children, double gap) { Widget _columnBtn(List<Widget> children, double gap) {
return Column( return Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@@ -63,13 +61,13 @@ class ActionButtonsPanel extends StatelessWidget {
} }
Widget _dragAndTargetBtn(String label, Color color, String actionData, double baseSize, double feedSize, double sf, Widget _dragAndTargetBtn(String label, Color color, String actionData, double baseSize, double feedSize, double sf,
{IconData? icon, bool isX = false}) { {IconData? icon, bool isX = false, String badge = ""}) {
return Draggable<String>( return Draggable<String>(
data: actionData, data: actionData,
feedback: _circle(label, color, icon, true, baseSize, feedSize, sf, isX: isX), feedback: _circle(label, color, icon, true, baseSize, feedSize, sf, isX: isX, badge: badge),
childWhenDragging: Opacity( childWhenDragging: Opacity(
opacity: 0.5, opacity: 0.5,
child: _circle(label, color, icon, false, baseSize, feedSize, sf, isX: isX), child: _circle(label, color, icon, false, baseSize, feedSize, sf, isX: isX, badge: badge),
), ),
child: DragTarget<String>( child: DragTarget<String>(
onAcceptWithDetails: (details) {}, onAcceptWithDetails: (details) {},
@@ -83,7 +81,7 @@ class ActionButtonsPanel extends StatelessWidget {
shape: BoxShape.circle, shape: BoxShape.circle,
boxShadow: [BoxShadow(color: Colors.white, blurRadius: 10 * sf, spreadRadius: 3 * sf)]) boxShadow: [BoxShadow(color: Colors.white, blurRadius: 10 * sf, spreadRadius: 3 * sf)])
: null, : null,
child: _circle(label, color, icon, false, baseSize, feedSize, sf, isX: isX), child: _circle(label, color, icon, false, baseSize, feedSize, sf, isX: isX, badge: badge),
), ),
); );
}), }),
@@ -105,10 +103,10 @@ class ActionButtonsPanel extends StatelessWidget {
} }
Widget _circle(String label, Color color, IconData? icon, bool isFeed, double baseSize, double feedSize, double sf, Widget _circle(String label, Color color, IconData? icon, bool isFeed, double baseSize, double feedSize, double sf,
{bool isX = false}) { {bool isX = false, String badge = ""}) {
double size = isFeed ? feedSize : baseSize; double size = isFeed ? feedSize : baseSize;
Widget content; Widget content;
bool isPointBtn = label == "1" || label == "2" || label == "3" || label == "M1" || label == "M2" || label == "M3"; bool isPointBtn = label == "1" || label == "2" || label == "3" || label == "-1" || label == "-2" || label == "-3";
bool isRebBtn = label == "O" || label == "D"; bool isRebBtn = label == "O" || label == "D";
bool isBlkBtn = label == "BLK"; bool isBlkBtn = label == "BLK";
bool isStlBtn = label == "STL"; bool isStlBtn = label == "STL";
@@ -177,32 +175,7 @@ class ActionButtonsPanel extends StatelessWidget {
], ],
); );
} else if (isBlkBtn) { } else if (isBlkBtn) {
content = Stack( content = Icon(Icons.front_hand, color: const Color.fromARGB(207, 56, 52, 52), size: size * 0.75);
alignment: Alignment.center,
children: [
Icon(Icons.front_hand, color: color, size: size * 0.75),
Stack(
alignment: Alignment.center,
children: [
Text(label,
style: TextStyle(
fontSize: size * 0.28,
fontWeight: FontWeight.w900,
foreground: Paint()
..style = PaintingStyle.stroke
..strokeWidth = size * 0.05
..color = Colors.black,
decoration: TextDecoration.none)),
Text(label,
style: TextStyle(
fontSize: size * 0.28,
fontWeight: FontWeight.w900,
color: Colors.white,
decoration: TextDecoration.none)),
],
),
],
);
} else if (isStlBtn) { } else if (isStlBtn) {
content = Stack( content = Stack(
alignment: Alignment.center, alignment: Alignment.center,
@@ -248,7 +221,7 @@ class ActionButtonsPanel extends StatelessWidget {
return Stack( return Stack(
clipBehavior: Clip.none, clipBehavior: Clip.none,
alignment: Alignment.bottomRight, alignment: Alignment.bottomLeft,
children: [ children: [
Container( Container(
width: size, width: size,
@@ -258,12 +231,12 @@ class ActionButtonsPanel extends StatelessWidget {
: BoxDecoration( : BoxDecoration(
gradient: RadialGradient(colors: [color.withOpacity(0.7), color], radius: 0.8), gradient: RadialGradient(colors: [color.withOpacity(0.7), color], radius: 0.8),
shape: BoxShape.circle, shape: BoxShape.circle,
boxShadow: [ boxShadow: [BoxShadow(color: Colors.black38, blurRadius: 6 * sf, offset: Offset(0, 3 * sf))]),
BoxShadow(color: Colors.black38, blurRadius: 6 * sf, offset: Offset(0, 3 * sf))
]),
alignment: Alignment.center, alignment: Alignment.center,
child: content, child: content,
), ),
// Badge só aparece se não for vazio
if (badge.isNotEmpty)
Positioned( Positioned(
bottom: size * -0.04, bottom: size * -0.04,
left: size * -0.04, left: size * -0.04,
@@ -275,7 +248,7 @@ class ActionButtonsPanel extends StatelessWidget {
boxShadow: [BoxShadow(color: Colors.black45, blurRadius: 2, offset: const Offset(0, 1))], boxShadow: [BoxShadow(color: Colors.black45, blurRadius: 2, offset: const Offset(0, 1))],
), ),
child: Text( child: Text(
_badgeLabel(label), badge,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: size * 0.16, fontSize: size * 0.16,
@@ -296,20 +269,6 @@ class ActionButtonsPanel extends StatelessWidget {
], ],
); );
} }
String _badgeLabel(String label) {
switch (label) {
case "1": return "FTM";
case "M1": return "FTA";
case "2": return "2PM";
case "M2": return "2PA";
case "3": return "3PM";
case "M3": return "3PA";
case "O": return "OREB";
case "D": return "DREB";
default: return label;
}
}
} }
class HoopIconPainter extends CustomPainter { class HoopIconPainter extends CustomPainter {

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 { class PlayerCourtCard extends StatelessWidget {
final PlacarController controller; final PlacarController controller;
final String playerId; final String playerId;
@@ -296,9 +339,17 @@ class PlayerCourtCard extends StatelessWidget {
String fgPercent = fga > 0 ? ((fgm / fga) * 100).toStringAsFixed(0) : "0"; String fgPercent = fga > 0 ? ((fgm / fga) * 100).toStringAsFixed(0) : "0";
String displayName = displayNameStr.length > 12 ? "${displayNameStr.substring(0, 10)}..." : displayNameStr; String displayName = displayNameStr.length > 12 ? "${displayNameStr.substring(0, 10)}..." : displayNameStr;
// Tamanho da camisola
final double shirtSize = 38 * sf;
return Container( return Container(
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 4), 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( child: ClipRRect(
borderRadius: BorderRadius.circular(6 * sf), borderRadius: BorderRadius.circular(6 * sf),
child: IntrinsicHeight( child: IntrinsicHeight(
@@ -306,12 +357,44 @@ class PlayerCourtCard extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
// ── Camisola com número ──────────────────────────────
Container( Container(
padding: EdgeInsets.symmetric(horizontal: 10 * sf), padding: EdgeInsets.symmetric(horizontal: 6 * sf, vertical: 4 * sf),
color: isFouledOut ? Colors.grey[700] : teamColor, color: isFouledOut ? Colors.grey.shade200 : teamColor.withOpacity(0.12),
alignment: Alignment.center, 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(
padding: EdgeInsets.symmetric(horizontal: 8 * sf, vertical: 4 * sf), padding: EdgeInsets.symmetric(horizontal: 8 * sf, vertical: 4 * sf),
child: Column( child: Column(