You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.8 KiB
Dart
84 lines
2.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
|
|
class QuestionsSummary extends StatelessWidget {
|
|
const QuestionsSummary(this.summaryData, {super.key});
|
|
|
|
final List<Map<String, Object>> summaryData;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(
|
|
height: 300,
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
children: summaryData.map(
|
|
(data) {
|
|
return Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
CircleAvatar(
|
|
radius: 15,
|
|
backgroundColor:
|
|
(data['correct_answer'] == data['user_answer'])
|
|
? Colors.green
|
|
: Colors.red,
|
|
child: Center(
|
|
child: Text(
|
|
((data['question_index'] as int) + 1).toString(),
|
|
style: const TextStyle(
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 20,
|
|
),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
data['question'] as String,
|
|
style: GoogleFonts.lato(
|
|
color: Colors.white,
|
|
fontSize: 14,
|
|
),
|
|
textAlign: TextAlign.left,
|
|
),
|
|
const SizedBox(
|
|
height: 5,
|
|
),
|
|
Text(
|
|
data['user_answer'] as String,
|
|
style: GoogleFonts.lato(
|
|
color: Color.fromARGB(255, 201, 153, 251),
|
|
fontSize: 14,
|
|
),
|
|
textAlign: TextAlign.left,
|
|
),
|
|
Text(
|
|
data['correct_answer'] as String,
|
|
style: GoogleFonts.lato(
|
|
color:
|
|
(data['correct_answer'] == data['user_answer'])
|
|
? Colors.green
|
|
: Colors.red,
|
|
fontSize: 14,
|
|
),
|
|
textAlign: TextAlign.left,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
);
|
|
},
|
|
).toList(),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|