melhorar os icon de jogo
This commit is contained in:
@@ -333,141 +333,6 @@ class PlayerCourtCard extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
return 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 * 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("ORB", AppTheme.actionRebound, "add_orb", baseSize, feedSize, sf, icon: Icons.sports_basketball),
|
||||
_dragAndTargetBtn("DRB", AppTheme.actionRebound, "add_drb", baseSize, feedSize, sf, icon: Icons.sports_basketball),
|
||||
_dragAndTargetBtn("BLK", AppTheme.actionBlock, "add_blk", baseSize, feedSize, sf, icon: Icons.front_hand),
|
||||
], gap),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
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, double baseSize, double feedSize, double sf, {IconData? icon, bool isX = false}) {
|
||||
return Draggable<String>(
|
||||
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<String>(
|
||||
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}) {
|
||||
double size = isFeed ? feedSize : baseSize;
|
||||
Widget content;
|
||||
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: 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: 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) {
|
||||
content = Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
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: 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: size * 0.5);
|
||||
} else {
|
||||
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,
|
||||
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))]),
|
||||
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))),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class HeatmapDialog extends StatefulWidget {
|
||||
final List<dynamic> shots;
|
||||
final String myTeamName;
|
||||
|
||||
Reference in New Issue
Block a user