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: [ // 省公司排名赛跑