debug(mobile): 添加火柴人组件调试日志
- 记录宽度计算的各个参数 - 添加clamp保护防止负值宽度 - 打印排名数据详情 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ba3e96c606
commit
1cd4b352a4
|
|
@ -228,6 +228,8 @@ class _StickmanRaceWidgetState extends State<StickmanRaceWidget>
|
|||
final trackHeight = usableHeight / total;
|
||||
final verticalPosition = rank * trackHeight + 10;
|
||||
|
||||
debugPrint('[StickmanRace] _buildStickman() - rank=$rank, total=$total, progress=$horizontalProgress');
|
||||
|
||||
return AnimatedBuilder(
|
||||
animation: _bounceController,
|
||||
builder: (context, child) {
|
||||
|
|
@ -241,8 +243,13 @@ class _StickmanRaceWidgetState extends State<StickmanRaceWidget>
|
|||
final stickmanHalfWidth = 30.0; // 火柴人宽度的一半,用于居中对齐
|
||||
final flagAreaWidth = 40.0; // 红旗区域宽度(红旗在right:8位置,图标24+边距)
|
||||
final nicknameAreaWidth = 65.0; // 昵称区域宽度
|
||||
final availableWidth = containerWidth - flagAreaWidth - stickmanHalfWidth - nicknameAreaWidth;
|
||||
// 确保可用宽度不为负数
|
||||
final rawAvailableWidth = containerWidth - flagAreaWidth - stickmanHalfWidth - nicknameAreaWidth;
|
||||
final availableWidth = rawAvailableWidth.clamp(60.0, double.infinity);
|
||||
final leftPosition = nicknameAreaWidth + availableWidth * horizontalProgress;
|
||||
final stickmanBoxWidth = leftPosition - nicknameAreaWidth + stickmanHalfWidth * 2;
|
||||
|
||||
debugPrint('[StickmanRace] Layout: screenWidth=$screenWidth, containerWidth=$containerWidth, rawAvailableWidth=$rawAvailableWidth, availableWidth=$availableWidth, leftPosition=$leftPosition, stickmanBoxWidth=$stickmanBoxWidth');
|
||||
|
||||
return Positioned(
|
||||
left: 0,
|
||||
|
|
@ -283,7 +290,7 @@ class _StickmanRaceWidgetState extends State<StickmanRaceWidget>
|
|||
),
|
||||
// 火柴人和数量标签
|
||||
SizedBox(
|
||||
width: leftPosition - nicknameAreaWidth + stickmanHalfWidth * 2,
|
||||
width: stickmanBoxWidth.clamp(60.0, double.infinity),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
|
|
|
|||
|
|
@ -1528,6 +1528,15 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
|||
);
|
||||
}
|
||||
|
||||
debugPrint('[ProfilePage] _buildStickmanRaceSection() - 开始构建火柴人区域');
|
||||
debugPrint('[ProfilePage] _provinceRankings.length=${_provinceRankings.length}, _cityRankings.length=${_cityRankings.length}');
|
||||
for (var r in _provinceRankings) {
|
||||
debugPrint('[ProfilePage] Province ranking: nickname=${r.nickname}, completedCount=${r.completedCount}, targetCount=${r.targetCount}, progress=${r.progress}');
|
||||
}
|
||||
for (var r in _cityRankings) {
|
||||
debugPrint('[ProfilePage] City ranking: nickname=${r.nickname}, completedCount=${r.completedCount}, targetCount=${r.targetCount}, progress=${r.progress}');
|
||||
}
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
// 省公司排名赛跑
|
||||
|
|
|
|||
Loading…
Reference in New Issue