fix(mobile-app): 修复火柴人超出屏幕边界问题

- 重新计算火柴人水平位置,预留终点区域和火柴人宽度
- 使用 clamp 确保火柴人不会超出右边界
- 当进度达到100%时,火柴人停在终点红旗旁边

🤖 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-23 03:25:33 -08:00
parent b04dd1f234
commit fd9df5d065
1 changed files with 6 additions and 1 deletions

View File

@ -238,8 +238,13 @@ class _StickmanRaceWidgetState extends State<StickmanRaceWidget>
//
final bounce = _bounceController.value * 3;
// - (20) - (80) - (60)
final containerWidth = MediaQuery.of(context).size.width - 32; //
final availableWidth = containerWidth - 20 - 80 - 60; // - -
final leftPosition = 20 + availableWidth * horizontalProgress;
return Positioned(
left: 20 + (MediaQuery.of(context).size.width - 120) * horizontalProgress,
left: leftPosition.clamp(20.0, containerWidth - 80), //
top: verticalPosition - bounce,
child: Column(
mainAxisSize: MainAxisSize.min,