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:
hailin 2025-12-24 03:32:22 -08:00
parent ba3e96c606
commit 1cd4b352a4
2 changed files with 18 additions and 2 deletions

View File

@ -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:824+
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: [

View File

@ -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: [
//