diff --git a/lib/data/default_deck.dart b/lib/data/default_deck.dart index 39288eb..557a045 100644 --- a/lib/data/default_deck.dart +++ b/lib/data/default_deck.dart @@ -262,43 +262,43 @@ class DefaultDeck { totalCorrectAttempts: 4, totalAttempts: 4, ), - // Question 6 - Progress (2 consecutive correct, not yet known) + // Question 6 - Known Question( id: 'gk_6', prompt: 'In which year did World War II end?', answers: ['1943', '1944', '1945', '1946'], correctAnswerIndices: [2], - consecutiveCorrect: 2, - isKnown: false, + consecutiveCorrect: 3, + isKnown: true, priorityPoints: 0, lastAttemptIndex: 3, - totalCorrectAttempts: 3, + totalCorrectAttempts: 4, totalAttempts: 4, ), - // Question 7 - Progress (1 consecutive correct) + // Question 7 - Known Question( id: 'gk_7', prompt: 'What is the smallest prime number?', answers: ['0', '1', '2', '3'], correctAnswerIndices: [2], - consecutiveCorrect: 1, - isKnown: false, + consecutiveCorrect: 3, + isKnown: true, priorityPoints: 0, lastAttemptIndex: 3, - totalCorrectAttempts: 2, + totalCorrectAttempts: 4, totalAttempts: 4, ), - // Question 8 - Some mistakes (has priority points from incorrect answers) + // Question 8 - Known Question( id: 'gk_8', prompt: 'Which gas makes up approximately 78% of Earth\'s atmosphere?', answers: ['Oxygen', 'Carbon Dioxide', 'Nitrogen', 'Argon'], correctAnswerIndices: [2], - consecutiveCorrect: 0, - isKnown: false, - priorityPoints: 5, - lastAttemptIndex: 2, - totalCorrectAttempts: 2, + consecutiveCorrect: 3, + isKnown: true, + priorityPoints: 0, + lastAttemptIndex: 3, + totalCorrectAttempts: 4, totalAttempts: 4, ), // Question 9 - Known @@ -327,17 +327,17 @@ class DefaultDeck { totalCorrectAttempts: 4, totalAttempts: 4, ), - // Question 11 - Progress + // Question 11 - Known Question( id: 'gk_11', prompt: 'What is the speed of light in a vacuum (approximately)?', answers: ['300,000 km/s', '150,000 km/s', '450,000 km/s', '600,000 km/s'], correctAnswerIndices: [0], - consecutiveCorrect: 2, - isKnown: false, + consecutiveCorrect: 3, + isKnown: true, priorityPoints: 0, lastAttemptIndex: 3, - totalCorrectAttempts: 3, + totalCorrectAttempts: 4, totalAttempts: 4, ), // Question 12 - Known @@ -353,30 +353,30 @@ class DefaultDeck { totalCorrectAttempts: 4, totalAttempts: 4, ), - // Question 13 - Some mistakes + // Question 13 - Known Question( id: 'gk_13', prompt: 'What is the hardest natural substance on Earth?', answers: ['Gold', 'Diamond', 'Platinum', 'Titanium'], correctAnswerIndices: [1], - consecutiveCorrect: 0, - isKnown: false, - priorityPoints: 3, - lastAttemptIndex: 1, - totalCorrectAttempts: 1, + consecutiveCorrect: 3, + isKnown: true, + priorityPoints: 0, + lastAttemptIndex: 3, + totalCorrectAttempts: 4, totalAttempts: 4, ), - // Question 14 - Progress + // Question 14 - Known Question( id: 'gk_14', prompt: 'How many continents are there on Earth?', answers: ['5', '6', '7', '8'], correctAnswerIndices: [2], - consecutiveCorrect: 1, - isKnown: false, + consecutiveCorrect: 3, + isKnown: true, priorityPoints: 0, lastAttemptIndex: 3, - totalCorrectAttempts: 2, + totalCorrectAttempts: 4, totalAttempts: 4, ), // Question 15 - Known @@ -418,43 +418,43 @@ class DefaultDeck { totalCorrectAttempts: 4, totalAttempts: 4, ), - // Question 18 - Progress + // Question 18 - Known Question( id: 'gk_18', prompt: 'Which element has the atomic number 1?', answers: ['Helium', 'Hydrogen', 'Lithium', 'Carbon'], correctAnswerIndices: [1], - consecutiveCorrect: 2, - isKnown: false, + consecutiveCorrect: 3, + isKnown: true, priorityPoints: 0, lastAttemptIndex: 3, - totalCorrectAttempts: 3, + totalCorrectAttempts: 4, totalAttempts: 4, ), - // Question 19 - Some mistakes + // Question 19 - Known Question( id: 'gk_19', prompt: 'What is the largest desert in the world?', answers: ['Gobi Desert', 'Sahara Desert', 'Antarctic Desert', 'Arabian Desert'], correctAnswerIndices: [2], - consecutiveCorrect: 0, - isKnown: false, - priorityPoints: 5, - lastAttemptIndex: 0, - totalCorrectAttempts: 1, + consecutiveCorrect: 3, + isKnown: true, + priorityPoints: 0, + lastAttemptIndex: 3, + totalCorrectAttempts: 4, totalAttempts: 4, ), - // Question 20 - Progress + // Question 20 - Not yet known (only one left!) Question( id: 'gk_20', prompt: 'Who invented the telephone?', answers: ['Thomas Edison', 'Alexander Graham Bell', 'Nikola Tesla', 'Guglielmo Marconi'], correctAnswerIndices: [1], - consecutiveCorrect: 1, + consecutiveCorrect: 2, isKnown: false, priorityPoints: 0, lastAttemptIndex: 3, - totalCorrectAttempts: 2, + totalCorrectAttempts: 3, totalAttempts: 4, ), ]; diff --git a/lib/screens/attempt_result_screen.dart b/lib/screens/attempt_result_screen.dart index a361067..5bdadc5 100644 --- a/lib/screens/attempt_result_screen.dart +++ b/lib/screens/attempt_result_screen.dart @@ -99,6 +99,42 @@ class _AttemptResultScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ + // 100% Completion Celebration + if (_deck != null && _deck!.knownCount == _deck!.numberOfQuestions && _deck!.numberOfQuestions > 0) ...[ + Card( + color: Theme.of(context).colorScheme.primaryContainer, + child: Padding( + padding: const EdgeInsets.all(24), + child: Column( + children: [ + Icon( + Icons.celebration, + size: 64, + color: Theme.of(context).colorScheme.onPrimaryContainer, + ), + const SizedBox(height: 16), + Text( + 'Deck Completed!', + style: Theme.of(context).textTheme.headlineMedium?.copyWith( + fontWeight: FontWeight.bold, + color: Theme.of(context).colorScheme.onPrimaryContainer, + ), + ), + const SizedBox(height: 8), + Text( + 'Congratulations! You\'ve mastered all ${_deck!.numberOfQuestions} questions in this deck!', + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.bodyLarge?.copyWith( + color: Theme.of(context).colorScheme.onPrimaryContainer.withValues(alpha: 0.9), + ), + ), + ], + ), + ), + ), + const SizedBox(height: 24), + ], + // Summary Card Card( child: Padding( @@ -126,6 +162,26 @@ class _AttemptResultScreenState extends State { '${_result!.correctCount} of ${_result!.totalQuestions} correct', style: Theme.of(context).textTheme.titleMedium, ), + // Show deck progress if available + if (_deck != null && _deck!.numberOfQuestions > 0) ...[ + const SizedBox(height: 16), + Divider(), + const SizedBox(height: 16), + Text( + 'Deck Progress', + style: Theme.of(context).textTheme.titleSmall, + ), + const SizedBox(height: 8), + Text( + '${_deck!.knownCount} of ${_deck!.numberOfQuestions} questions known', + style: Theme.of(context).textTheme.titleMedium?.copyWith( + fontWeight: FontWeight.bold, + color: _deck!.knownCount == _deck!.numberOfQuestions + ? Colors.green + : null, + ), + ), + ], const SizedBox(height: 24), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, diff --git a/lib/screens/deck_list_screen.dart b/lib/screens/deck_list_screen.dart index 901d11c..1c720bc 100644 --- a/lib/screens/deck_list_screen.dart +++ b/lib/screens/deck_list_screen.dart @@ -353,8 +353,10 @@ class _DeckListScreenState extends State { itemCount: _decks.length, itemBuilder: (context, index) { final deck = _decks[index]; + final isCompleted = deck.knownCount == deck.numberOfQuestions && deck.numberOfQuestions > 0; return Card( margin: const EdgeInsets.only(bottom: 12), + child: InkWell( onTap: () => _openDeck(deck), borderRadius: BorderRadius.circular(12), @@ -369,11 +371,45 @@ class _DeckListScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - deck.title, - style: Theme.of(context).textTheme.titleMedium?.copyWith( - fontWeight: FontWeight.bold, + Row( + children: [ + Expanded( + child: Text( + deck.title, + style: Theme.of(context).textTheme.titleMedium?.copyWith( + fontWeight: FontWeight.bold, + ), + ), + ), + if (isCompleted) ...[ + const SizedBox(width: 8), + Container( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), + decoration: BoxDecoration( + color: Colors.green.shade700, + borderRadius: BorderRadius.circular(12), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.check_circle, + size: 16, + color: Colors.white, + ), + const SizedBox(width: 4), + Text( + 'Completed', + style: Theme.of(context).textTheme.labelSmall?.copyWith( + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ], + ), ), + ], + ], ), if (deck.description.isNotEmpty) ...[ const SizedBox(height: 4), @@ -384,6 +420,7 @@ class _DeckListScreenState extends State { overflow: TextOverflow.ellipsis, ), ], + ], ), ),