diff --git a/lib/questions_summary.dart b/lib/questions_summary.dart index 606b63a..d9f0d28 100644 --- a/lib/questions_summary.dart +++ b/lib/questions_summary.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; class QuestionSummary extends StatelessWidget { - const QuestionSummary(this.summaryData, {super.key}); final List> summaryData; @@ -12,27 +11,40 @@ class QuestionSummary extends StatelessWidget { height: 300, child: SingleChildScrollView( child: Column( - children: - summaryData.map((data) { - return Row( - children: [ - Text(((data['question_index'] as int) +1).toString()), - Expanded( - child: Column( - children: [ - Text(data['question'] as String), - const SizedBox(height: 5,), - Text(data['user_answer'] as String), - Text(data['correct_answer'] as String), - ], - ), + children: summaryData.map((data) { + bool isCorrect = data['user_answer'] == data['correct_answer']; + return Row( + crossAxisAlignment: CrossAxisAlignment.baseline, // Add this + textBaseline: TextBaseline.alphabetic, // Add this + children: [ + Container( + width: 30, + height: 30, + decoration: BoxDecoration( + color: isCorrect ? Colors.green : Colors.red, + borderRadius: BorderRadius.circular(15), + ), + child: Center( + child: Text(((data['question_index'] as int) + 1).toString()), + ), + ), + const SizedBox(width: 10,), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(data['question'] as String), + const SizedBox(height: 5,), + Text('Your answer: ${data['user_answer']}'), + Text('Correct answer: ${data['correct_answer']}'), + ], ), - ], - ); - }).toList(), + ), + ], + ); + }).toList(), ), ), ); - } } \ No newline at end of file diff --git a/lib/results-screen.dart b/lib/results-screen.dart index 71b2919..dff9656 100644 --- a/lib/results-screen.dart +++ b/lib/results-screen.dart @@ -52,13 +52,20 @@ class ResultScreen extends StatelessWidget { const SizedBox( height: 20, ), - TextButton( + Center( + child: TextButton( onPressed: () {}, - child: const Text('Restart Quiz!', - style: TextStyle(color: Colors.black))) + child: Row( + children: [ + Icon(Icons.replay), + const Text('Restart Quiz!', style: TextStyle(color: Colors.black)), + ], + ), + ), + ) ], ), ), ); } -} +} \ No newline at end of file