fix: defensive keys and overflow guard in result overlay

- Add ValueKey(i) to each TweenAnimationBuilder in the star animation loop
  to prevent Flutter from reusing widget state during rebuild cycles
- Add maxLines: 2 and overflow: TextOverflow.ellipsis to the almostThere
  Text widget to prevent overflow in the loss-state progress message

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 22:27:14 +09:00
parent 677a09f8cb
commit 944c5733c9
+3
View File
@@ -345,6 +345,7 @@ class _GameScreenState extends ConsumerState<GameScreen>
children: [ children: [
for (var i = 0; i < 3; i++) for (var i = 0; i < 3; i++)
TweenAnimationBuilder<double>( TweenAnimationBuilder<double>(
key: ValueKey(i),
tween: Tween(begin: 0, end: 1), tween: Tween(begin: 0, end: 1),
duration: Duration(milliseconds: 400 + i * 250), duration: Duration(milliseconds: 400 + i * 250),
curve: Interval(i * 0.22, 1, curve: Curves.elasticOut), curve: Interval(i * 0.22, 1, curve: Curves.elasticOut),
@@ -377,6 +378,8 @@ class _GameScreenState extends ConsumerState<GameScreen>
child: Text( child: Text(
l10n.almostThere((view.objectiveProgress * 100).round()), l10n.almostThere((view.objectiveProgress * 100).round()),
textAlign: TextAlign.center, textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.labelSmall, style: theme.textTheme.labelSmall,
), ),
), ),