-
Notifications
You must be signed in to change notification settings - Fork 0
/
result.dart
34 lines (31 loc) · 918 Bytes
/
result.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
import 'package:flutter/material.dart';
class Result extends StatelessWidget {
const Result({required this.buttonHandler, required this.score, super.key});
final VoidCallback buttonHandler;
final int score;
@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
"You reached the end of the quiz!",
style: TextStyle(fontSize: 16),
),
const SizedBox(height: 20.0),
Text(
"Your score is: $score",
style: TextStyle(
color: score == 0 ? Colors.red : Colors.green, fontSize: 20),
),
const SizedBox(height: 20.0),
ElevatedButton(
onPressed: buttonHandler,
child: const Text("Restart Quiz"),
),
],
),
);
}
}