cor e nomes dos botoes

This commit is contained in:
2026-04-23 00:28:31 +01:00
parent e1d1babb07
commit 59927521f1
2 changed files with 245 additions and 155 deletions

View File

@@ -17,79 +17,100 @@ class ActionButtonsPanel extends StatelessWidget {
final double feedSize = 73 * sf; final double feedSize = 73 * sf;
final double gap = 5 * sf; final double gap = 5 * sf;
return Row( return Padding(
mainAxisAlignment: MainAxisAlignment.center, // 👇 AJUSTA ESTE VALOR (ex: 30, 50, 80) PARA SUBIR MAIS OU MENOS
crossAxisAlignment: CrossAxisAlignment.end, padding: EdgeInsets.only(bottom: 12 * sf),
children: [ child: Row(
_columnBtn([ mainAxisAlignment: MainAxisAlignment.center,
_dragAndTargetBtn("M1", AppTheme.actionMiss, "miss_1", baseSize, feedSize, sf), crossAxisAlignment: CrossAxisAlignment.end,
_dragAndTargetBtn("1", AppTheme.actionPoints, "add_pts_1", baseSize, feedSize, sf), children: [
_dragAndTargetBtn("1", AppTheme.actionPoints, "sub_pts_1", baseSize, feedSize, sf, isX: true), _columnBtn([
_dragAndTargetBtn("STL", AppTheme.actionSteal, "add_stl", baseSize, feedSize, sf), _dragAndTargetBtn("M1", AppTheme.actionMiss, "miss_1", baseSize, feedSize, sf),
], gap), _dragAndTargetBtn("1", AppTheme.actionPoints, "add_pts_1", baseSize, feedSize, sf),
SizedBox(width: gap * 1), _dragAndTargetBtn("1", AppTheme.actionPoints, "sub_pts_1", baseSize, feedSize, sf, isX: true),
_columnBtn([ _dragAndTargetBtn("STL", AppTheme.actionSteal, "add_stl", baseSize, feedSize, sf),
_dragAndTargetBtn("M2", AppTheme.actionMiss, "miss_2", baseSize, feedSize, sf), ], gap),
_dragAndTargetBtn("2", AppTheme.actionPoints, "add_pts_2", baseSize, feedSize, sf), SizedBox(width: gap),
_dragAndTargetBtn("2", AppTheme.actionPoints, "sub_pts_2", baseSize, feedSize, sf, isX: true), _columnBtn([
_dragAndTargetBtn("AST", AppTheme.actionAssist, "add_ast", baseSize, feedSize, sf), _dragAndTargetBtn("M2", AppTheme.actionMiss, "miss_2", baseSize, feedSize, sf),
], gap), _dragAndTargetBtn("2", AppTheme.actionPoints, "add_pts_2", baseSize, feedSize, sf),
SizedBox(width: gap * 1), _dragAndTargetBtn("2", AppTheme.actionPoints, "sub_pts_2", baseSize, feedSize, sf, isX: true),
_columnBtn([ _dragAndTargetBtn("AST", AppTheme.actionAssist, "add_ast", baseSize, feedSize, sf),
_dragAndTargetBtn("M3", AppTheme.actionMiss, "miss_3", baseSize, feedSize, sf), ], gap),
_dragAndTargetBtn("3", AppTheme.actionPoints, "add_pts_3", baseSize, feedSize, sf), SizedBox(width: gap),
_dragAndTargetBtn("3", AppTheme.actionPoints, "sub_pts_3", baseSize, feedSize, sf, isX: true), _columnBtn([
_dragAndTargetBtn("TOV", AppTheme.actionMiss, "add_tov", baseSize, feedSize, sf), _dragAndTargetBtn("M3", AppTheme.actionMiss, "miss_3", baseSize, feedSize, sf),
], gap), _dragAndTargetBtn("3", AppTheme.actionPoints, "add_pts_3", baseSize, feedSize, sf),
SizedBox(width: gap * 1), _dragAndTargetBtn("3", AppTheme.actionPoints, "sub_pts_3", baseSize, feedSize, sf, isX: true),
_columnBtn([ _dragAndTargetBtn("TOV", AppTheme.actionMiss, "add_tov", baseSize, feedSize, sf),
_dragAndTargetBtn("O", AppTheme.actionRebound, "add_orb", baseSize, feedSize, sf), ], gap),
_dragAndTargetBtn("D", AppTheme.actionRebound, "add_drb", baseSize, feedSize, sf), SizedBox(width: gap),
_dragAndTargetBtn("BLK", AppTheme.actionBlock, "add_blk", baseSize, feedSize, sf), _columnBtn([
], gap), _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<Widget> children, double gap) { Widget _columnBtn(List<Widget> children, double gap) {
return Column( return Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: children.map((c) => Padding(padding: EdgeInsets.only(bottom: gap), child: c)).toList() 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}) { Widget _dragAndTargetBtn(String label, Color color, String actionData, double baseSize, double feedSize, double sf,
{IconData? icon, bool isX = false}) {
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),
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),
), ),
child: DragTarget<String>( child: DragTarget<String>(
onAcceptWithDetails: (details) {}, onAcceptWithDetails: (details) {},
builder: (context, candidateData, rejectedData) { builder: (context, candidateData, rejectedData) {
bool isHovered = candidateData.any((data) => data != null && data.startsWith("player_")); bool isHovered = candidateData.any((data) => data != null && data.startsWith("player_"));
return Transform.scale( return Transform.scale(
scale: isHovered ? 1.15 : 1.0, scale: isHovered ? 1.15 : 1.0,
child: Container( child: Container(
decoration: isHovered ? BoxDecoration(shape: BoxShape.circle, boxShadow: [BoxShadow(color: Colors.white, blurRadius: 10 * sf, spreadRadius: 3 * sf)]) : null, decoration: isHovered
child: _circle(label, color, icon, false, baseSize, feedSize, sf, isX: isX) ? 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 _basketball(Color color, double size) {
return Stack(
alignment: Alignment.center,
children: [
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 _circle(String label, Color color, IconData? icon, bool isFeed, double baseSize, double feedSize, double sf,
{bool isX = false}) {
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 == "M1" || label == "M2" || label == "M3";
bool isRebBtn = label == "O" || label == "D"; bool isRebBtn = label == "O" || label == "D";
bool isBlkBtn = label == "BLK"; bool isBlkBtn = label == "BLK";
// Identificadores para as imagens
bool isStlBtn = label == "STL"; bool isStlBtn = label == "STL";
bool isAstBtn = label == "AST"; bool isAstBtn = label == "AST";
bool isTovBtn = label == "TOV"; bool isTovBtn = label == "TOV";
@@ -98,18 +119,29 @@ class ActionButtonsPanel extends StatelessWidget {
content = Stack( content = Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
Container(width: size * 0.75, height: size * 0.75, decoration: const BoxDecoration(color: Colors.black, shape: BoxShape.circle)), _basketball(color, size * 0.9),
Icon(Icons.sports_basketball, color: color, size: size * 0.9),
Stack( Stack(
children: [ 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,
Text(label, style: TextStyle(fontSize: size * 0.38, fontWeight: FontWeight.w900, color: Colors.black, decoration: TextDecoration.none)), 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( content = Stack(
children: [ children: [
Center( Center(
@@ -124,71 +156,94 @@ class ActionButtonsPanel extends StatelessWidget {
right: size * 0.05, right: size * 0.05,
child: Stack( child: Stack(
children: [ children: [
Text(label, style: TextStyle( Text(label,
fontSize: size * 0.48, style: TextStyle(
fontWeight: FontWeight.w900, fontSize: size * 0.48,
foreground: Paint()..style = PaintingStyle.stroke..strokeWidth = size * 0.07..color = Colors.black, fontWeight: FontWeight.w900,
decoration: TextDecoration.none foreground: Paint()
)), ..style = PaintingStyle.stroke
Text(label, style: TextStyle( ..strokeWidth = size * 0.07
fontSize: size * 0.48, ..color = Colors.black,
fontWeight: FontWeight.w900, decoration: TextDecoration.none)),
color: Colors.white, Text(label,
decoration: TextDecoration.none style: TextStyle(
)), fontSize: size * 0.48,
fontWeight: FontWeight.w900,
color: Colors.white,
decoration: TextDecoration.none)),
], ],
), ),
), ),
], ],
); );
} } else if (isBlkBtn) {
else if (isBlkBtn) {
content = Stack( content = Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ 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( Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ 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,
Text(label, style: TextStyle(fontSize: size * 0.28, fontWeight: FontWeight.w900, color: Colors.white, decoration: TextDecoration.none)), 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) {
// Botão de Roubo de Bola (Steal) content = Stack(
else if (isStlBtn) { alignment: Alignment.center,
content = Center( children: [
child: Image.asset( Positioned(top: size * 0.05, child: _basketball(color, size * 0.60)),
'assets/stl.png', Positioned(bottom: size * 0.10, child: Icon(Icons.pan_tool, color: color, size: size * 0.50)),
width: size * 1, ],
),
); );
} } else if (isAstBtn) {
// Botão de Assistência (Assist) content = Stack(
else if (isAstBtn) { alignment: Alignment.center,
content = Center( children: [
child: Image.asset( Positioned(top: size * 0.05, child: _basketball(color, size * 0.60)),
'assets/assit.png', Positioned(
width: size * 1, 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),
],
),
),
],
); );
} } else if (isTovBtn) {
// Botão de Turnover (Bola com X) content = Stack(
else if (isTovBtn) { alignment: Alignment.center,
content = Center( children: [
child: Image.asset( Positioned(top: size * 0.05, child: _basketball(color, size * 0.60)),
'assets/tov.png', Positioned(bottom: size * 0.10, child: Icon(Icons.swap_horiz_rounded, color: color, size: size * 0.55)),
width: size * 1, ],
),
); );
} } else {
else { content = Text(label,
content = Text(label, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: size * 0.35, decoration: TextDecoration.none)); style: TextStyle(
color: Colors.white, fontWeight: FontWeight.bold, fontSize: size * 0.35, decoration: TextDecoration.none));
} }
return Stack( return Stack(
@@ -196,17 +251,65 @@ class ActionButtonsPanel extends StatelessWidget {
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,
children: [ children: [
Container( Container(
width: size, height: size, width: size,
height: size,
decoration: (isPointBtn || isBlkBtn || isRebBtn || isStlBtn || isAstBtn || isTovBtn) decoration: (isPointBtn || isBlkBtn || isRebBtn || isStlBtn || isAstBtn || isTovBtn)
? const BoxDecoration(color: Colors.transparent) ? 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))]), : 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, alignment: Alignment.center,
child: content, 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 { class HoopIconPainter extends CustomPainter {
@@ -223,17 +326,8 @@ class HoopIconPainter extends CustomPainter {
..strokeJoin = StrokeJoin.round; ..strokeJoin = StrokeJoin.round;
canvas.drawRRect( canvas.drawRRect(
RRect.fromRectAndRadius( RRect.fromRectAndRadius(Rect.fromLTRB(w * 0.02, h * 0.02, w * 0.98, h * 0.70), Radius.circular(w * 0.05)), paint);
Rect.fromLTRB(w * 0.02, h * 0.02, w * 0.98, h * 0.70), canvas.drawRect(Rect.fromLTRB(w * 0.28, h * 0.30, w * 0.72, h * 0.70), paint);
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() final Paint rimPaint = Paint()
..color = Colors.orange ..color = Colors.orange
@@ -241,11 +335,7 @@ class HoopIconPainter extends CustomPainter {
..strokeWidth = w * 0.09 ..strokeWidth = w * 0.09
..strokeCap = StrokeCap.round; ..strokeCap = StrokeCap.round;
canvas.drawLine( canvas.drawLine(Offset(w * 0.20, h * 0.75), Offset(w * 0.80, h * 0.75), rimPaint);
Offset(w * 0.20, h * 0.75),
Offset(w * 0.80, h * 0.75),
rimPaint
);
final Paint netPaint = Paint() final Paint netPaint = Paint()
..color = Colors.black ..color = Colors.black

View File

@@ -109,10 +109,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.4.0" version: "1.4.1"
clock: clock:
dependency: transitive dependency: transitive
description: description:
@@ -468,18 +468,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.12.17" version: "0.12.18"
material_color_utilities: material_color_utilities:
dependency: transitive dependency: transitive
description: description:
name: material_color_utilities name: material_color_utilities
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.11.1" version: "0.13.0"
meta: meta:
dependency: transitive dependency: transitive
description: description:
@@ -873,10 +873,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 sha256: "93167629bfc610f71560ab9312acdda4959de4df6fac7492c89ff0d3886f6636"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.7.7" version: "0.7.9"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description: