From 1cd4b352a46e6d91291f12f47142d9ce23b8acf2 Mon Sep 17 00:00:00 2001 From: hailin Date: Wed, 24 Dec 2025 03:32:22 -0800 Subject: [PATCH] =?UTF-8?q?debug(mobile):=20=E6=B7=BB=E5=8A=A0=E7=81=AB?= =?UTF-8?q?=E6=9F=B4=E4=BA=BA=E7=BB=84=E4=BB=B6=E8=B0=83=E8=AF=95=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 记录宽度计算的各个参数 - 添加clamp保护防止负值宽度 - 打印排名数据详情 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../presentation/widgets/stickman_race_widget.dart | 11 +++++++++-- .../profile/presentation/pages/profile_page.dart | 9 +++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/frontend/mobile-app/lib/features/authorization/presentation/widgets/stickman_race_widget.dart b/frontend/mobile-app/lib/features/authorization/presentation/widgets/stickman_race_widget.dart index e3b1d424..7990ec3e 100644 --- a/frontend/mobile-app/lib/features/authorization/presentation/widgets/stickman_race_widget.dart +++ b/frontend/mobile-app/lib/features/authorization/presentation/widgets/stickman_race_widget.dart @@ -228,6 +228,8 @@ class _StickmanRaceWidgetState extends State 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 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 ), // 火柴人和数量标签 SizedBox( - width: leftPosition - nicknameAreaWidth + stickmanHalfWidth * 2, + width: stickmanBoxWidth.clamp(60.0, double.infinity), child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ diff --git a/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart b/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart index 9462f804..14ba1e20 100644 --- a/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart +++ b/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart @@ -1528,6 +1528,15 @@ class _ProfilePageState extends ConsumerState { ); } + 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: [ // 省公司排名赛跑