Clear active state on arrow count switch and simplify dialog

- Adds _disarmActiveState() to clear selection and retract keypad after mode switch
- Simplifies 'Keep scores?' dialog to just title and Yes/No buttons
- Prevents confusing active end highlighting after rule changes

Note: Hardcoded strings identified for future localization setup

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Mikkeli Matlock
2025-08-23 23:00:37 +09:00
parent 22d2e99400
commit 10b1bf3f80
+19 -8
View File
@@ -88,20 +88,15 @@ class _ScoringPageState extends State<ScoringPage> with SingleTickerProviderStat
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: const Text('Keep current scores?'), title: const Text('Keep scores?'),
content: const Text(
'You have existing scores on the scorecard. Do you want to keep them when switching arrow count modes?\n\n'
'• Yes: Existing scores will be preserved\n'
'• No: All scores will be cleared',
),
actions: [ actions: [
TextButton( TextButton(
onPressed: () => Navigator.of(context).pop(false), onPressed: () => Navigator.of(context).pop(false),
child: const Text('No - Clear scores'), child: const Text('No'),
), ),
TextButton( TextButton(
onPressed: () => Navigator.of(context).pop(true), onPressed: () => Navigator.of(context).pop(true),
child: const Text('Yes - Keep scores'), child: const Text('Yes'),
), ),
], ],
); );
@@ -127,6 +122,9 @@ class _ScoringPageState extends State<ScoringPage> with SingleTickerProviderStat
_initializeScores(); _initializeScores();
} }
// Clear active state and retract keypad
_disarmActiveState();
// Notify parent of changes // Notify parent of changes
widget.onArrowsPerEndChanged(arrows); widget.onArrowsPerEndChanged(arrows);
widget.onScoresUpdated(scores); widget.onScoresUpdated(scores);
@@ -139,6 +137,9 @@ class _ScoringPageState extends State<ScoringPage> with SingleTickerProviderStat
endsPerSet = arrows == 3 ? 10 : 6; endsPerSet = arrows == 3 ? 10 : 6;
_initializeScores(); _initializeScores();
// Clear active state and retract keypad
_disarmActiveState();
// Notify parent of changes // Notify parent of changes
widget.onArrowsPerEndChanged(arrows); widget.onArrowsPerEndChanged(arrows);
widget.onScoresUpdated(scores); widget.onScoresUpdated(scores);
@@ -281,6 +282,16 @@ class _ScoringPageState extends State<ScoringPage> with SingleTickerProviderStat
}); });
} }
void _disarmActiveState() {
if (isKeypadVisible) {
_animationController.reverse();
}
isKeypadVisible = false;
activeEndIndex = null;
selectedRow = -1;
selectedColumn = -1;
}
void _onBackgroundTapped() { void _onBackgroundTapped() {
if (isKeypadVisible) { if (isKeypadVisible) {
_animationController.reverse().then((_) { _animationController.reverse().then((_) {