From 59927521f1b7e8891e5ee27947fd75720cf5c8c9 Mon Sep 17 00:00:00 2001 From: 230404 <230404@epvc.pt> Date: Thu, 23 Apr 2026 00:28:31 +0100 Subject: [PATCH] cor e nomes dos botoes --- lib/icons.dart/resaltosicon.dart | 384 +++++++++++++++++++------------ pubspec.lock | 16 +- 2 files changed, 245 insertions(+), 155 deletions(-) diff --git a/lib/icons.dart/resaltosicon.dart b/lib/icons.dart/resaltosicon.dart index bd3c9e8..57d3128 100644 --- a/lib/icons.dart/resaltosicon.dart +++ b/lib/icons.dart/resaltosicon.dart @@ -8,88 +8,109 @@ import 'package:playmaker/controllers/placar_controller.dart'; 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) { - final double baseSize = 58 * sf; - final double feedSize = 73 * sf; - final double gap = 5 * sf; + final double baseSize = 58 * sf; + final double feedSize = 73 * sf; + final double gap = 5 * sf; - return Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.end, + return Padding( + // 👇 AJUSTA ESTE VALOR (ex: 30, 50, 80) PARA SUBIR MAIS OU MENOS + padding: EdgeInsets.only(bottom: 12 * sf), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + _columnBtn([ + _dragAndTargetBtn("M1", AppTheme.actionMiss, "miss_1", baseSize, feedSize, sf), + _dragAndTargetBtn("1", AppTheme.actionPoints, "add_pts_1", baseSize, feedSize, sf), + _dragAndTargetBtn("1", AppTheme.actionPoints, "sub_pts_1", baseSize, feedSize, sf, isX: true), + _dragAndTargetBtn("STL", AppTheme.actionSteal, "add_stl", baseSize, feedSize, sf), + ], gap), + SizedBox(width: gap), + _columnBtn([ + _dragAndTargetBtn("M2", AppTheme.actionMiss, "miss_2", baseSize, feedSize, sf), + _dragAndTargetBtn("2", AppTheme.actionPoints, "add_pts_2", baseSize, feedSize, sf), + _dragAndTargetBtn("2", AppTheme.actionPoints, "sub_pts_2", baseSize, feedSize, sf, isX: true), + _dragAndTargetBtn("AST", AppTheme.actionAssist, "add_ast", baseSize, feedSize, sf), + ], gap), + SizedBox(width: gap), + _columnBtn([ + _dragAndTargetBtn("M3", AppTheme.actionMiss, "miss_3", baseSize, feedSize, sf), + _dragAndTargetBtn("3", AppTheme.actionPoints, "add_pts_3", baseSize, feedSize, sf), + _dragAndTargetBtn("3", AppTheme.actionPoints, "sub_pts_3", baseSize, feedSize, sf, isX: true), + _dragAndTargetBtn("TOV", AppTheme.actionMiss, "add_tov", baseSize, feedSize, sf), + ], gap), + SizedBox(width: gap), + _columnBtn([ + _dragAndTargetBtn("O", AppTheme.actionRebound, "add_orb", baseSize, feedSize, sf), + _dragAndTargetBtn("D", AppTheme.actionRebound, "add_drb", baseSize, feedSize, sf), + _dragAndTargetBtn("BLK", AppTheme.actionBlock, "add_blk", baseSize, feedSize, sf), + ], gap), + ], + ), + ); + } + + // ... (o resto dos teus métodos como _columnBtn, _dragAndTargetBtn, etc., mantêm-se iguais) + Widget _columnBtn(List 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( + 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), + ), + child: DragTarget( + 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), + ), + ); + }), + ); + } + + Widget _basketball(Color color, double size) { + return Stack( + alignment: Alignment.center, children: [ - _columnBtn([ - _dragAndTargetBtn("M1", AppTheme.actionMiss, "miss_1", baseSize, feedSize, sf), - _dragAndTargetBtn("1", AppTheme.actionPoints, "add_pts_1", baseSize, feedSize, sf), - _dragAndTargetBtn("1", AppTheme.actionPoints, "sub_pts_1", baseSize, feedSize, sf, isX: true), - _dragAndTargetBtn("STL", AppTheme.actionSteal, "add_stl", baseSize, feedSize, sf), - ], gap), - SizedBox(width: gap * 1), - _columnBtn([ - _dragAndTargetBtn("M2", AppTheme.actionMiss, "miss_2", baseSize, feedSize, sf), - _dragAndTargetBtn("2", AppTheme.actionPoints, "add_pts_2", baseSize, feedSize, sf), - _dragAndTargetBtn("2", AppTheme.actionPoints, "sub_pts_2", baseSize, feedSize, sf, isX: true), - _dragAndTargetBtn("AST", AppTheme.actionAssist, "add_ast", baseSize, feedSize, sf), - ], gap), - SizedBox(width: gap * 1), - _columnBtn([ - _dragAndTargetBtn("M3", AppTheme.actionMiss, "miss_3", baseSize, feedSize, sf), - _dragAndTargetBtn("3", AppTheme.actionPoints, "add_pts_3", baseSize, feedSize, sf), - _dragAndTargetBtn("3", AppTheme.actionPoints, "sub_pts_3", baseSize, feedSize, sf, isX: true), - _dragAndTargetBtn("TOV", AppTheme.actionMiss, "add_tov", baseSize, feedSize, sf), - ], gap), - SizedBox(width: gap * 1), - _columnBtn([ - _dragAndTargetBtn("O", AppTheme.actionRebound, "add_orb", baseSize, feedSize, sf), - _dragAndTargetBtn("D", AppTheme.actionRebound, "add_drb", baseSize, feedSize, sf), - _dragAndTargetBtn("BLK", AppTheme.actionBlock, "add_blk", baseSize, feedSize, sf), - ], gap), + Container( + width: size * 0.78, + height: size * 0.78, + decoration: const BoxDecoration(color: Colors.black, shape: BoxShape.circle), + ), + Icon(Icons.sports_basketball, color: color, size: size), ], ); } - Widget _columnBtn(List 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( - 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) - ), - child: DragTarget( - 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) - ), - ); - } - ), - ); - } - - Widget _circle(String label, Color color, IconData? icon, bool isFeed, double baseSize, double feedSize, double sf, {bool isX = false}) { + 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 == "M1" || label == "M2" || label == "M3"; bool isRebBtn = label == "O" || label == "D"; bool isBlkBtn = label == "BLK"; - - // Identificadores para as imagens bool isStlBtn = label == "STL"; bool isAstBtn = label == "AST"; bool isTovBtn = label == "TOV"; @@ -98,115 +119,197 @@ class ActionButtonsPanel extends StatelessWidget { content = Stack( alignment: Alignment.center, children: [ - Container(width: size * 0.75, height: size * 0.75, decoration: const BoxDecoration(color: Colors.black, shape: BoxShape.circle)), - Icon(Icons.sports_basketball, color: color, size: size * 0.9), + _basketball(color, size * 0.9), Stack( children: [ - Text(label, style: TextStyle(fontSize: size * 0.38, fontWeight: FontWeight.w900, foreground: Paint()..style = PaintingStyle.stroke..strokeWidth = size * 0.05..color = Colors.white, decoration: TextDecoration.none)), - Text(label, style: TextStyle(fontSize: size * 0.38, fontWeight: FontWeight.w900, color: Colors.black, decoration: TextDecoration.none)), + Text(label, + style: TextStyle( + fontSize: size * 0.38, + fontWeight: FontWeight.w900, + foreground: Paint() + ..style = PaintingStyle.stroke + ..strokeWidth = size * 0.05 + ..color = Colors.white, + decoration: TextDecoration.none)), + Text(label, + style: TextStyle( + fontSize: size * 0.38, + fontWeight: FontWeight.w900, + color: Colors.black, + decoration: TextDecoration.none)), ], ), ], ); - } - else if (isRebBtn) { + } else if (isRebBtn) { content = Stack( children: [ Center( child: SizedBox( - width: size * 0.75, + width: size * 0.75, height: size * 0.75, child: CustomPaint(painter: HoopIconPainter()), ), ), Positioned( - top: size * -0.05, - right: size * 0.05, + top: size * -0.05, + right: size * 0.05, child: Stack( children: [ - Text(label, style: TextStyle( - fontSize: size * 0.48, - fontWeight: FontWeight.w900, - foreground: Paint()..style = PaintingStyle.stroke..strokeWidth = size * 0.07..color = Colors.black, - decoration: TextDecoration.none - )), - Text(label, style: TextStyle( - fontSize: size * 0.48, - fontWeight: FontWeight.w900, - color: Colors.white, - decoration: TextDecoration.none - )), + Text(label, + style: TextStyle( + fontSize: size * 0.48, + fontWeight: FontWeight.w900, + foreground: Paint() + ..style = PaintingStyle.stroke + ..strokeWidth = size * 0.07 + ..color = Colors.black, + decoration: TextDecoration.none)), + Text(label, + style: TextStyle( + fontSize: size * 0.48, + fontWeight: FontWeight.w900, + color: Colors.white, + decoration: TextDecoration.none)), ], ), ), ], ); - } - else if (isBlkBtn) { + } else if (isBlkBtn) { content = Stack( alignment: Alignment.center, children: [ - Icon(Icons.front_hand, color: const Color.fromARGB(207, 56, 52, 52), size: size * 0.75), + 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)), + 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)), ], ), ], ); - } - // Botão de Roubo de Bola (Steal) - else if (isStlBtn) { - content = Center( - child: Image.asset( - 'assets/stl.png', - width: size * 1, - - ), + } else if (isStlBtn) { + content = Stack( + alignment: Alignment.center, + children: [ + Positioned(top: size * 0.05, child: _basketball(color, size * 0.60)), + Positioned(bottom: size * 0.10, child: Icon(Icons.pan_tool, color: color, size: size * 0.50)), + ], ); - } - // Botão de Assistência (Assist) - else if (isAstBtn) { - content = Center( - child: Image.asset( - 'assets/assit.png', - width: size * 1, - - ), + } else if (isAstBtn) { + content = Stack( + alignment: Alignment.center, + children: [ + Positioned(top: size * 0.05, child: _basketball(color, size * 0.60)), + Positioned( + bottom: size * 0.08, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Transform( + alignment: Alignment.center, + transform: Matrix4.rotationY(3.14159), + child: Icon(Icons.back_hand, color: color, size: size * 0.46)), + SizedBox(width: size * 0.04), + Icon(Icons.back_hand, color: color, size: size * 0.46), + ], + ), + ), + ], ); - } - // Botão de Turnover (Bola com X) - else if (isTovBtn) { - content = Center( - child: Image.asset( - 'assets/tov.png', - width: size * 1, - - ), + } else if (isTovBtn) { + content = Stack( + alignment: Alignment.center, + children: [ + Positioned(top: size * 0.05, child: _basketball(color, size * 0.60)), + Positioned(bottom: size * 0.10, child: Icon(Icons.swap_horiz_rounded, color: color, size: size * 0.55)), + ], ); - } - else { - content = Text(label, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: size * 0.35, decoration: TextDecoration.none)); + } else { + content = Text(label, + style: TextStyle( + color: Colors.white, fontWeight: FontWeight.bold, fontSize: size * 0.35, decoration: TextDecoration.none)); } return Stack( - clipBehavior: Clip.none, + clipBehavior: Clip.none, alignment: Alignment.bottomRight, children: [ Container( - width: size, height: size, - decoration: (isPointBtn || isBlkBtn || isRebBtn || isStlBtn || isAstBtn || isTovBtn) - ? 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, + width: size, + height: size, + decoration: (isPointBtn || isBlkBtn || isRebBtn || isStlBtn || isAstBtn || isTovBtn) + ? 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, ), - 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))), + Positioned( + bottom: size * -0.04, + left: size * -0.04, + child: Container( + padding: EdgeInsets.symmetric(horizontal: size * 0.09, vertical: size * 0.02), + decoration: BoxDecoration( + color: Colors.grey.shade600, + borderRadius: BorderRadius.circular(size * 0.07), + boxShadow: [BoxShadow(color: Colors.black45, blurRadius: 2, offset: const Offset(0, 1))], + ), + child: Text( + _badgeLabel(label), + style: TextStyle( + color: Colors.white, + fontSize: size * 0.16, + fontWeight: FontWeight.w900, + decoration: TextDecoration.none, + letterSpacing: 0.2, + ), + ), + ), + ), + 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))), ], ); } + + 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 { @@ -223,29 +326,16 @@ class HoopIconPainter extends CustomPainter { ..strokeJoin = StrokeJoin.round; canvas.drawRRect( - RRect.fromRectAndRadius( - Rect.fromLTRB(w * 0.02, h * 0.02, w * 0.98, h * 0.70), - Radius.circular(w * 0.05) - ), - paint - ); - - canvas.drawRect( - Rect.fromLTRB(w * 0.28, h * 0.30, w * 0.72, h * 0.70), - paint - ); + RRect.fromRectAndRadius(Rect.fromLTRB(w * 0.02, h * 0.02, w * 0.98, h * 0.70), Radius.circular(w * 0.05)), paint); + canvas.drawRect(Rect.fromLTRB(w * 0.28, h * 0.30, w * 0.72, h * 0.70), paint); final Paint rimPaint = Paint() ..color = Colors.orange ..style = PaintingStyle.stroke ..strokeWidth = w * 0.09 ..strokeCap = StrokeCap.round; - - canvas.drawLine( - Offset(w * 0.20, h * 0.75), - Offset(w * 0.80, h * 0.75), - rimPaint - ); + + canvas.drawLine(Offset(w * 0.20, h * 0.75), Offset(w * 0.80, h * 0.75), rimPaint); final Paint netPaint = Paint() ..color = Colors.black diff --git a/pubspec.lock b/pubspec.lock index 0daf6be..d5e3b37 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -109,10 +109,10 @@ packages: dependency: transitive description: name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.4.1" clock: dependency: transitive description: @@ -468,18 +468,18 @@ packages: dependency: transitive description: name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6" url: "https://pub.dev" source: hosted - version: "0.12.17" + version: "0.12.18" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.13.0" meta: dependency: transitive description: @@ -873,10 +873,10 @@ packages: dependency: transitive description: name: test_api - sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 + sha256: "93167629bfc610f71560ab9312acdda4959de4df6fac7492c89ff0d3886f6636" url: "https://pub.dev" source: hosted - version: "0.7.7" + version: "0.7.9" typed_data: dependency: transitive description: