-
Notifications
You must be signed in to change notification settings - Fork 939
/
Copy pathsummary_item.dart
58 lines (53 loc) · 1.72 KB
/
summary_item.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:adv_basics/questions_summary/question_identifier.dart';
class SummaryItem extends StatelessWidget {
const SummaryItem(this.itemData, {super.key});
final Map<String, Object> itemData;
@override
Widget build(BuildContext context) {
final isCorrectAnswer =
itemData['user_answer'] == itemData['correct_answer'];
return Padding(
padding: const EdgeInsets.symmetric(
vertical: 8,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
QuestionIdentifier(
isCorrectAnswer: isCorrectAnswer,
questionIndex: itemData['question_index'] as int,
),
const SizedBox(width: 20),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
itemData['question'] as String,
style: GoogleFonts.lato(
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 5,
),
Text(itemData['user_answer'] as String,
style: const TextStyle(
color: Color.fromARGB(255, 202, 171, 252),
)),
Text(itemData['correct_answer'] as String,
style: const TextStyle(
color: Color.fromARGB(255, 181, 254, 246),
)),
],
),
),
],
),
);
}
}