From 10b1bf3f800a86454ec658eea8f606bd68b0b725 Mon Sep 17 00:00:00 2001 From: Mikkeli Matlock Date: Sat, 23 Aug 2025 23:00:37 +0900 Subject: [PATCH] Clear active state on arrow count switch and simplify dialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- lib/presentation/pages/scoring_page.dart | 27 +++++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/lib/presentation/pages/scoring_page.dart b/lib/presentation/pages/scoring_page.dart index d561bd1..e90429d 100644 --- a/lib/presentation/pages/scoring_page.dart +++ b/lib/presentation/pages/scoring_page.dart @@ -88,20 +88,15 @@ class _ScoringPageState extends State with SingleTickerProviderStat context: context, builder: (BuildContext context) { return AlertDialog( - title: const Text('Keep current 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', - ), + title: const Text('Keep scores?'), actions: [ TextButton( onPressed: () => Navigator.of(context).pop(false), - child: const Text('No - Clear scores'), + child: const Text('No'), ), TextButton( onPressed: () => Navigator.of(context).pop(true), - child: const Text('Yes - Keep scores'), + child: const Text('Yes'), ), ], ); @@ -127,6 +122,9 @@ class _ScoringPageState extends State with SingleTickerProviderStat _initializeScores(); } + // Clear active state and retract keypad + _disarmActiveState(); + // Notify parent of changes widget.onArrowsPerEndChanged(arrows); widget.onScoresUpdated(scores); @@ -139,6 +137,9 @@ class _ScoringPageState extends State with SingleTickerProviderStat endsPerSet = arrows == 3 ? 10 : 6; _initializeScores(); + // Clear active state and retract keypad + _disarmActiveState(); + // Notify parent of changes widget.onArrowsPerEndChanged(arrows); widget.onScoresUpdated(scores); @@ -281,6 +282,16 @@ class _ScoringPageState extends State with SingleTickerProviderStat }); } + void _disarmActiveState() { + if (isKeypadVisible) { + _animationController.reverse(); + } + isKeypadVisible = false; + activeEndIndex = null; + selectedRow = -1; + selectedColumn = -1; + } + void _onBackgroundTapped() { if (isKeypadVisible) { _animationController.reverse().then((_) {