git lixo 2
This commit is contained in:
@@ -7,70 +7,104 @@ import 'package:playmaker/zone_map_dialog.dart';
|
||||
// ============================================================================
|
||||
class TopScoreboard extends StatelessWidget {
|
||||
final PlacarController controller;
|
||||
const TopScoreboard({super.key, required this.controller});
|
||||
final double sf;
|
||||
|
||||
const TopScoreboard({super.key, required this.controller, required this.sf});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 30),
|
||||
padding: EdgeInsets.symmetric(vertical: 10 * sf, horizontal: 35 * sf),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF16202C),
|
||||
borderRadius: const BorderRadius.only(bottomLeft: Radius.circular(15), bottomRight: Radius.circular(15)),
|
||||
border: Border.all(color: Colors.white, width: 2),
|
||||
color: const Color(0xFF16202C),
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(22 * sf),
|
||||
bottomRight: Radius.circular(22 * sf)
|
||||
),
|
||||
border: Border.all(color: Colors.white, width: 2.5 * sf),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_buildTeamSection(controller.myTeam, controller.myScore, controller.myFouls, controller.myTimeoutsUsed, const Color(0xFF1E5BB2), false),
|
||||
const SizedBox(width: 25),
|
||||
_buildTeamSection(controller.myTeam, controller.myScore, controller.myFouls, controller.myTimeoutsUsed, const Color(0xFF1E5BB2), false, sf),
|
||||
SizedBox(width: 30 * sf),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 6),
|
||||
decoration: BoxDecoration(color: const Color(0xFF2C3E50), borderRadius: BorderRadius.circular(6)),
|
||||
child: Text(controller.formatTime(), style: const TextStyle(color: Colors.white, fontSize: 24, fontWeight: FontWeight.bold, fontFamily: 'monospace')),
|
||||
padding: EdgeInsets.symmetric(horizontal: 18 * sf, vertical: 5 * sf),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF2C3E50),
|
||||
borderRadius: BorderRadius.circular(9 * sf)
|
||||
),
|
||||
child: Text(
|
||||
controller.formatTime(),
|
||||
style: TextStyle(color: Colors.white, fontSize: 28 * sf, fontWeight: FontWeight.w900, fontFamily: 'monospace', letterSpacing: 2 * sf)
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5 * sf),
|
||||
Text(
|
||||
"PERÍODO ${controller.currentQuarter}",
|
||||
style: TextStyle(color: Colors.orangeAccent, fontSize: 14 * sf, fontWeight: FontWeight.w900)
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text("PERÍODO ${controller.currentQuarter}", style: const TextStyle(color: Colors.orangeAccent, fontSize: 14, fontWeight: FontWeight.bold)),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 25),
|
||||
_buildTeamSection(controller.opponentTeam, controller.opponentScore, controller.opponentFouls, controller.opponentTimeoutsUsed, const Color(0xFFD92C2C), true),
|
||||
SizedBox(width: 30 * sf),
|
||||
_buildTeamSection(controller.opponentTeam, controller.opponentScore, controller.opponentFouls, controller.opponentTimeoutsUsed, const Color(0xFFD92C2C), true, sf),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTeamSection(String name, int score, int fouls, int timeouts, Color color, bool isOpp) {
|
||||
Widget _buildTeamSection(String name, int score, int fouls, int timeouts, Color color, bool isOpp, double sf) {
|
||||
int displayFouls = fouls > 5 ? 5 : fouls;
|
||||
|
||||
final timeoutIndicators = Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: List.generate(3, (index) => Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 3),
|
||||
width: 12, height: 12,
|
||||
decoration: BoxDecoration(shape: BoxShape.circle, color: index < timeouts ? Colors.yellow : Colors.grey.shade600, border: Border.all(color: Colors.black26)),
|
||||
margin: EdgeInsets.symmetric(horizontal: 3.5 * sf),
|
||||
width: 12 * sf, height: 12 * sf,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: index < timeouts ? Colors.yellow : Colors.grey.shade600,
|
||||
border: Border.all(color: Colors.white54, width: 1.5 * sf)
|
||||
),
|
||||
)),
|
||||
);
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: isOpp
|
||||
? [
|
||||
Column(children: [_scoreBox(score, color), const SizedBox(height: 4), Text("FALTAS: $fouls", style: TextStyle(color: fouls >= 5 ? Colors.red : Colors.yellowAccent, fontSize: 12, fontWeight: FontWeight.bold)), timeoutIndicators]),
|
||||
const SizedBox(width: 15),
|
||||
Text(name.toUpperCase(), style: const TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold))
|
||||
]
|
||||
: [
|
||||
Text(name.toUpperCase(), style: const TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(width: 15),
|
||||
Column(children: [_scoreBox(score, color), const SizedBox(height: 4), Text("FALTAS: $fouls", style: TextStyle(color: fouls >= 5 ? Colors.red : Colors.yellowAccent, fontSize: 12, fontWeight: FontWeight.bold)), timeoutIndicators])
|
||||
]
|
||||
);
|
||||
|
||||
List<Widget> content = [
|
||||
Column(
|
||||
children: [
|
||||
_scoreBox(score, color, sf),
|
||||
SizedBox(height: 7 * sf),
|
||||
timeoutIndicators
|
||||
]
|
||||
),
|
||||
SizedBox(width: 18 * sf),
|
||||
Column(
|
||||
crossAxisAlignment: isOpp ? CrossAxisAlignment.start : CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
name.toUpperCase(),
|
||||
style: TextStyle(color: Colors.white, fontSize: 20 * sf, fontWeight: FontWeight.w900, letterSpacing: 1.2 * sf)
|
||||
),
|
||||
SizedBox(height: 5 * sf),
|
||||
Text(
|
||||
"FALTAS: $displayFouls",
|
||||
style: TextStyle(color: displayFouls >= 5 ? Colors.redAccent : Colors.yellowAccent, fontSize: 13 * sf, fontWeight: FontWeight.bold)
|
||||
),
|
||||
],
|
||||
)
|
||||
];
|
||||
|
||||
return Row(crossAxisAlignment: CrossAxisAlignment.center, children: isOpp ? content : content.reversed.toList());
|
||||
}
|
||||
|
||||
Widget _scoreBox(int score, Color color) => Container(
|
||||
width: 50, height: 40,
|
||||
Widget _scoreBox(int score, Color color, double sf) => Container(
|
||||
width: 58 * sf, height: 45 * sf,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(color: color, borderRadius: BorderRadius.circular(6)),
|
||||
child: Text(score.toString(), style: const TextStyle(color: Colors.white, fontSize: 24, fontWeight: FontWeight.bold)),
|
||||
decoration: BoxDecoration(color: color, borderRadius: BorderRadius.circular(7 * sf)),
|
||||
child: Text(score.toString(), style: TextStyle(color: Colors.white, fontSize: 26 * sf, fontWeight: FontWeight.w900)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -80,7 +114,9 @@ class TopScoreboard extends StatelessWidget {
|
||||
class BenchPlayersList extends StatelessWidget {
|
||||
final PlacarController controller;
|
||||
final bool isOpponent;
|
||||
const BenchPlayersList({super.key, required this.controller, required this.isOpponent});
|
||||
final double sf;
|
||||
|
||||
const BenchPlayersList({super.key, required this.controller, required this.isOpponent, required this.sf});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -96,24 +132,45 @@ class BenchPlayersList extends StatelessWidget {
|
||||
final bool isFouledOut = fouls >= 5;
|
||||
|
||||
Widget avatarUI = Container(
|
||||
margin: const EdgeInsets.only(bottom: 5),
|
||||
margin: EdgeInsets.only(bottom: 7 * sf),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: Colors.white, width: 1.8 * sf),
|
||||
boxShadow: [BoxShadow(color: Colors.black45, blurRadius: 5 * sf, offset: Offset(0, 2.5 * sf))]
|
||||
),
|
||||
child: CircleAvatar(
|
||||
backgroundColor: isFouledOut ? Colors.grey.shade700 : teamColor,
|
||||
child: Text(num, style: TextStyle(color: isFouledOut ? Colors.red.shade300 : Colors.white, fontSize: 14, decoration: isFouledOut ? TextDecoration.lineThrough : TextDecoration.none)),
|
||||
radius: 22 * sf,
|
||||
backgroundColor: isFouledOut ? Colors.grey.shade800 : teamColor,
|
||||
child: Text(
|
||||
num,
|
||||
style: TextStyle(
|
||||
color: isFouledOut ? Colors.red.shade300 : Colors.white,
|
||||
fontSize: 16 * sf,
|
||||
fontWeight: FontWeight.bold,
|
||||
decoration: isFouledOut ? TextDecoration.lineThrough : TextDecoration.none
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
if (isFouledOut) {
|
||||
return GestureDetector(
|
||||
onTap: () => ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('🛑 $playerName não pode voltar (Expulso).'), backgroundColor: Colors.red)),
|
||||
child: avatarUI,
|
||||
onTap: () => ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('🛑 $playerName não pode voltar (Expulso).'), backgroundColor: Colors.red)),
|
||||
child: avatarUI
|
||||
);
|
||||
}
|
||||
|
||||
return Draggable<String>(
|
||||
data: "$prefix$playerName",
|
||||
feedback: Material(color: Colors.transparent, child: CircleAvatar(backgroundColor: teamColor, child: Text(num, style: const TextStyle(color: Colors.white)))),
|
||||
childWhenDragging: const Opacity(opacity: 0.5, child: SizedBox(width: 40, height: 40)),
|
||||
feedback: Material(
|
||||
color: Colors.transparent,
|
||||
child: CircleAvatar(
|
||||
radius: 28 * sf,
|
||||
backgroundColor: teamColor,
|
||||
child: Text(num, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 18 * sf))
|
||||
)
|
||||
),
|
||||
childWhenDragging: Opacity(opacity: 0.5, child: SizedBox(width: 45 * sf, height: 45 * sf)),
|
||||
child: avatarUI,
|
||||
);
|
||||
}).toList(),
|
||||
@@ -131,8 +188,9 @@ class PlayerCourtCard extends StatelessWidget {
|
||||
final PlacarController controller;
|
||||
final String name;
|
||||
final bool isOpponent;
|
||||
final double sf;
|
||||
|
||||
const PlayerCourtCard({super.key, required this.controller, required this.name, required this.isOpponent});
|
||||
const PlayerCourtCard({super.key, required this.controller, required this.name, required this.isOpponent, required this.sf});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -146,12 +204,12 @@ class PlayerCourtCard extends StatelessWidget {
|
||||
feedback: Material(
|
||||
color: Colors.transparent,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
decoration: BoxDecoration(color: teamColor.withOpacity(0.9), borderRadius: BorderRadius.circular(8)),
|
||||
child: Text(name, style: const TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
padding: EdgeInsets.symmetric(horizontal: 18 * sf, vertical: 11 * sf),
|
||||
decoration: BoxDecoration(color: teamColor.withOpacity(0.9), borderRadius: BorderRadius.circular(9 * sf)),
|
||||
child: Text(name, style: TextStyle(color: Colors.white, fontSize: 20 * sf, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
),
|
||||
childWhenDragging: Opacity(opacity: 0.5, child: _playerCardUI(number, name, stats, teamColor, false, false)),
|
||||
childWhenDragging: Opacity(opacity: 0.5, child: _playerCardUI(number, name, stats, teamColor, false, false, sf)),
|
||||
child: DragTarget<String>(
|
||||
onAcceptWithDetails: (details) {
|
||||
final action = details.data;
|
||||
@@ -177,30 +235,27 @@ class PlayerCourtCard extends StatelessWidget {
|
||||
// Se for 1 Ponto (Lance Livre), Falta, Ressalto ou Roubo, FAZ TUDO NORMAL!
|
||||
else if (action.startsWith("add_") || action.startsWith("sub_") || action.startsWith("miss_")) {
|
||||
controller.handleActionDrag(context, action, "$prefix$name");
|
||||
}
|
||||
else if (action.startsWith("bench_")) {
|
||||
} else if (action.startsWith("bench_")) {
|
||||
controller.handleSubbing(context, action, name, isOpponent);
|
||||
}
|
||||
},
|
||||
builder: (context, candidateData, rejectedData) {
|
||||
bool isSubbing = candidateData.any((data) => data != null && (data.startsWith("bench_my_") || data.startsWith("bench_opp_")));
|
||||
bool isActionHover = candidateData.any((data) => data != null && (data.startsWith("add_") || data.startsWith("sub_") || data.startsWith("miss_")));
|
||||
return _playerCardUI(number, name, stats, teamColor, isSubbing, isActionHover);
|
||||
return _playerCardUI(number, name, stats, teamColor, isSubbing, isActionHover, sf);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _playerCardUI(String number, String name, Map<String, int> stats, Color teamColor, bool isSubbing, bool isActionHover, double sf) {
|
||||
// ... (Mantém o teu código de design _playerCardUI que já tinhas aqui dentro, fica igualzinho!)
|
||||
bool isFouledOut = stats["fls"]! >= 5;
|
||||
Color bgColor = isFouledOut ? Colors.red.shade100 : Colors.white;
|
||||
Color bgColor = isFouledOut ? Colors.red.shade50 : Colors.white;
|
||||
Color borderColor = isFouledOut ? Colors.redAccent : Colors.transparent;
|
||||
|
||||
if (isSubbing) {
|
||||
bgColor = Colors.blue.shade50; borderColor = Colors.blue;
|
||||
} else if (isActionHover && !isFouledOut) {
|
||||
bgColor = Colors.orange.shade50; borderColor = Colors.orange;
|
||||
}
|
||||
if (isSubbing) { bgColor = Colors.blue.shade50; borderColor = Colors.blue; }
|
||||
else if (isActionHover && !isFouledOut) { bgColor = Colors.orange.shade50; borderColor = Colors.orange; }
|
||||
|
||||
int fgm = stats["fgm"]!;
|
||||
int fga = stats["fga"]!;
|
||||
@@ -208,10 +263,11 @@ class PlayerCourtCard extends StatelessWidget {
|
||||
String displayName = name.length > 12 ? "${name.substring(0, 10)}..." : name;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: bgColor, borderRadius: BorderRadius.circular(12), border: Border.all(color: borderColor, width: 2),
|
||||
boxShadow: const [BoxShadow(color: Colors.black26, blurRadius: 6, offset: Offset(0, 3))],
|
||||
color: bgColor,
|
||||
borderRadius: BorderRadius.circular(11 * sf),
|
||||
border: Border.all(color: borderColor, width: 1.8 * sf),
|
||||
boxShadow: [BoxShadow(color: Colors.black26, blurRadius: 5 * sf, offset: Offset(2 * sf, 3.5 * sf))],
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(9 * sf),
|
||||
@@ -232,19 +288,10 @@ class PlayerCourtCard extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
displayName,
|
||||
style: TextStyle(fontSize: 16 * sf, fontWeight: FontWeight.bold, color: isFouledOut ? Colors.red : Colors.black87, decoration: isFouledOut ? TextDecoration.lineThrough : TextDecoration.none)
|
||||
),
|
||||
Text(displayName, style: TextStyle(fontSize: 16 * sf, fontWeight: FontWeight.bold, color: isFouledOut ? Colors.red : Colors.black87, decoration: isFouledOut ? TextDecoration.lineThrough : TextDecoration.none)),
|
||||
SizedBox(height: 2.5 * sf),
|
||||
Text(
|
||||
"${stats["pts"]} Pts | FG: $fgm/$fga ($fgPercent%)",
|
||||
style: TextStyle(fontSize: 12 * sf, color: isFouledOut ? Colors.red : Colors.grey[700], fontWeight: FontWeight.w600)
|
||||
),
|
||||
Text(
|
||||
"${stats["ast"]} Ast | ${stats["orb"]! + stats["drb"]!} Rbs | ${stats["fls"]} Fls",
|
||||
style: TextStyle(fontSize: 12 * sf, color: isFouledOut ? Colors.red : Colors.grey[500], fontWeight: FontWeight.w600)
|
||||
),
|
||||
Text("${stats["pts"]} Pts | FG: $fgm/$fga ($fgPercent%)", style: TextStyle(fontSize: 12 * sf, color: isFouledOut ? Colors.red : Colors.grey[700], fontWeight: FontWeight.w600)),
|
||||
Text("${stats["ast"]} Ast | ${stats["orb"]! + stats["drb"]!} Rbs | ${stats["fls"]} Fls", style: TextStyle(fontSize: 12 * sf, color: isFouledOut ? Colors.red : Colors.grey[500], fontWeight: FontWeight.w600)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -261,12 +308,14 @@ class PlayerCourtCard extends StatelessWidget {
|
||||
// ============================================================================
|
||||
class ActionButtonsPanel extends StatelessWidget {
|
||||
final PlacarController controller;
|
||||
const ActionButtonsPanel({super.key, required this.controller});
|
||||
final double sf;
|
||||
|
||||
const ActionButtonsPanel({super.key, required this.controller, required this.sf});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final double baseSize = 65 * sf; // Reduzido (Antes era 75)
|
||||
final double feedSize = 82 * sf; // Reduzido (Antes era 95)
|
||||
final double baseSize = 65 * sf;
|
||||
final double feedSize = 82 * sf;
|
||||
final double gap = 7 * sf;
|
||||
|
||||
return Row(
|
||||
@@ -274,116 +323,119 @@ class ActionButtonsPanel extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
_columnBtn([
|
||||
_actionBtn("T.O", const Color(0xFF1E5BB2), () => controller.useTimeout(false), labelSize: 20),
|
||||
_dragAndTargetBtn("1", Colors.orange, "add_pts_1"),
|
||||
_dragAndTargetBtn("1", Colors.orange, "sub_pts_1", isX: true),
|
||||
_dragAndTargetBtn("STL", Colors.green, "add_stl"),
|
||||
|
||||
]),
|
||||
const SizedBox(width: 15),
|
||||
_dragAndTargetBtn("M1", Colors.redAccent, "miss_1", baseSize, feedSize, sf),
|
||||
_dragAndTargetBtn("1", Colors.orange, "add_pts_1", baseSize, feedSize, sf),
|
||||
_dragAndTargetBtn("1", Colors.orange, "sub_pts_1", baseSize, feedSize, sf, isX: true),
|
||||
_dragAndTargetBtn("STL", Colors.green, "add_stl", baseSize, feedSize, sf),
|
||||
], gap),
|
||||
SizedBox(width: gap * 1),
|
||||
_columnBtn([
|
||||
_dragAndTargetBtn("M2", Colors.redAccent, "miss_2"),
|
||||
_dragAndTargetBtn("2", Colors.orange, "add_pts_2"),
|
||||
_dragAndTargetBtn("2", Colors.orange, "sub_pts_2", isX: true),
|
||||
_dragAndTargetBtn("AST", Colors.blueGrey, "add_ast"),
|
||||
]),
|
||||
const SizedBox(width: 15),
|
||||
_dragAndTargetBtn("M2", Colors.redAccent, "miss_2", baseSize, feedSize, sf),
|
||||
_dragAndTargetBtn("2", Colors.orange, "add_pts_2", baseSize, feedSize, sf),
|
||||
_dragAndTargetBtn("2", Colors.orange, "sub_pts_2", baseSize, feedSize, sf, isX: true),
|
||||
_dragAndTargetBtn("AST", Colors.blueGrey, "add_ast", baseSize, feedSize, sf),
|
||||
], gap),
|
||||
SizedBox(width: gap * 1),
|
||||
_columnBtn([
|
||||
_dragAndTargetBtn("M3", Colors.redAccent, "miss_3"),
|
||||
_dragAndTargetBtn("3", Colors.orange, "add_pts_3"),
|
||||
_dragAndTargetBtn("3", Colors.orange, "sub_pts_3", isX: true),
|
||||
_dragAndTargetBtn("TOV", Colors.redAccent, "add_tov"),
|
||||
]),
|
||||
const SizedBox(width: 15),
|
||||
_dragAndTargetBtn("M3", Colors.redAccent, "miss_3", baseSize, feedSize, sf),
|
||||
_dragAndTargetBtn("3", Colors.orange, "add_pts_3", baseSize, feedSize, sf),
|
||||
_dragAndTargetBtn("3", Colors.orange, "sub_pts_3", baseSize, feedSize, sf, isX: true),
|
||||
_dragAndTargetBtn("TOV", Colors.redAccent, "add_tov", baseSize, feedSize, sf),
|
||||
], gap),
|
||||
SizedBox(width: gap * 1),
|
||||
_columnBtn([
|
||||
_actionBtn("T.O", const Color(0xFFD92C2C), () => controller.useTimeout(true), labelSize: 20),
|
||||
_dragAndTargetBtn("ORB", const Color(0xFF1E2A38), "add_rbs", icon: Icons.sports_basketball),
|
||||
_dragAndTargetBtn("DRB", const Color(0xFF1E2A38), "add_rbs", icon: Icons.sports_basketball),
|
||||
|
||||
_dragAndTargetBtn("BLK", Colors.deepPurple, "add_blk", icon: Icons.front_hand),
|
||||
]),
|
||||
const SizedBox(width: 15),
|
||||
_columnBtn([
|
||||
])
|
||||
_dragAndTargetBtn("ORB", const Color(0xFF1E2A38), "add_orb", baseSize, feedSize, sf, icon: Icons.sports_basketball),
|
||||
_dragAndTargetBtn("DRB", const Color(0xFF1E2A38), "add_drb", baseSize, feedSize, sf, icon: Icons.sports_basketball),
|
||||
_dragAndTargetBtn("BLK", Colors.deepPurple, "add_blk", baseSize, feedSize, sf, icon: Icons.front_hand),
|
||||
], gap),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// Mantenha os métodos _columnBtn, _dragAndTargetBtn, _actionBtn e _circle exatamente como estão
|
||||
Widget _columnBtn(List<Widget> children) => Column(mainAxisSize: MainAxisSize.min, children: children.map((c) => Padding(padding: const EdgeInsets.only(bottom: 8), child: c)).toList());
|
||||
Widget _columnBtn(List<Widget> 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, {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>(
|
||||
data: actionData,
|
||||
feedback: _circle(label, color, icon, true, isX: isX),
|
||||
childWhenDragging: Opacity(opacity: 0.5, child: _circle(label, color, icon, false, isX: isX)),
|
||||
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<String>(
|
||||
onAcceptWithDetails: (details) {},
|
||||
onAcceptWithDetails: (details) {}, // O PlayerCourtCard é que processa a ação!
|
||||
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: const [BoxShadow(color: Colors.white, blurRadius: 10, spreadRadius: 3)]) : null, child: _circle(label, color, icon, false, isX: isX)),
|
||||
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 _actionBtn(String label, Color color, VoidCallback onTap, {IconData? icon, bool isX = false, double labelSize = 24}) {
|
||||
return GestureDetector(onTap: onTap, child: _circle(label, color, icon, false, fontSize: labelSize, isX: isX));
|
||||
}
|
||||
|
||||
Widget _circle(String label, Color color, IconData? icon, bool isFeed, {double fontSize = 20, 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 == "M2" || label == "M3";
|
||||
bool isPointBtn = label == "1" || label == "2" || label == "3" || label == "M1" || label == "M2" || label == "M3";
|
||||
bool isBlkBtn = label == "BLK";
|
||||
|
||||
if (isPointBtn) {
|
||||
content = Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Container(width: isFeed ? 55 : 45, height: isFeed ? 55 : 45, decoration: const BoxDecoration(color: Colors.black, shape: BoxShape.circle)),
|
||||
Icon(Icons.sports_basketball, color: color, size: isFeed ? 65 : 55),
|
||||
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),
|
||||
Stack(
|
||||
children: [
|
||||
Text(label, style: TextStyle(fontSize: isFeed ? 26 : 22, fontWeight: FontWeight.w900, foreground: Paint()..style = PaintingStyle.stroke..strokeWidth = 3..color = Colors.white, decoration: TextDecoration.none)),
|
||||
Text(label, style: TextStyle(fontSize: isFeed ? 26 : 22, 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 (isBlkBtn) {
|
||||
} else if (isBlkBtn) {
|
||||
content = Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Icon(Icons.front_hand, color: const Color.fromARGB(207, 56, 52, 52), size: isFeed ? 55 : 45),
|
||||
Icon(Icons.front_hand, color: const Color.fromARGB(207, 56, 52, 52), size: size * 0.75),
|
||||
Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Text(label, style: TextStyle(fontSize: isFeed ? 18 : 16, fontWeight: FontWeight.w900, foreground: Paint()..style = PaintingStyle.stroke..strokeWidth = 3..color = Colors.black, decoration: TextDecoration.none)),
|
||||
Text(label, style: TextStyle(fontSize: isFeed ? 18 : 16, 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)),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
} else if (icon != null) {
|
||||
content = Icon(icon, color: Colors.white, size: 30);
|
||||
content = Icon(icon, color: Colors.white, size: size * 0.5);
|
||||
} else {
|
||||
content = Text(label, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: fontSize, decoration: TextDecoration.none));
|
||||
content = Text(label, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: size * 0.35, decoration: TextDecoration.none));
|
||||
}
|
||||
|
||||
return Stack(
|
||||
clipBehavior: Clip.none, alignment: Alignment.bottomRight,
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.bottomRight,
|
||||
children: [
|
||||
Container(
|
||||
width: size, height: size,
|
||||
decoration: (isPointBtn || isBlkBtn) ? 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))]),
|
||||
decoration: (isPointBtn || isBlkBtn)
|
||||
? 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: isFeed ? 28 : 24))),
|
||||
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))),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user