senatorialkillers/lib/quiz.dart

62 lines
1.4 KiB
Dart
Raw Normal View History

2022-08-01 12:13:50 +00:00
import 'package:flutter/material.dart';
2022-08-01 13:29:45 +00:00
import './person.dart';
2022-08-01 12:13:50 +00:00
class Quiz extends StatefulWidget {
2022-08-01 13:29:45 +00:00
const Quiz({required this.fullPeopleList, Key? key}) : super(key: key);
final List<Person> fullPeopleList;
2022-08-01 12:13:50 +00:00
@override
State<Quiz> createState() => _QuizState();
}
class _QuizState extends State<Quiz> {
2022-08-01 13:29:45 +00:00
late List<Person> people;
2022-08-01 12:13:50 +00:00
@override
Widget build(BuildContext context) {
2022-08-01 14:59:57 +00:00
people = widget.fullPeopleList;
people.shuffle();
2022-08-01 13:29:45 +00:00
people = widget.fullPeopleList;
2022-08-01 12:32:42 +00:00
return Column(
children: [
2022-08-01 14:59:57 +00:00
Image.network(people[0].img),
2022-08-01 12:32:42 +00:00
const AnswerButtons(),
],
);
}
}
class AnswerButtons extends StatelessWidget {
const AnswerButtons({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Row(
2022-08-01 13:29:45 +00:00
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
2022-08-01 12:32:42 +00:00
children: [
TextButton.icon(
onPressed: null,
2022-08-01 13:29:45 +00:00
icon: const Icon(
Icons.how_to_vote,
size: 64,
),
label: Text(
"US Senator",
style: Theme.of(context).textTheme.displaySmall,
),
2022-08-01 12:32:42 +00:00
),
TextButton.icon(
onPressed: null,
2022-08-01 13:29:45 +00:00
icon: const Icon(
Icons.gavel,
size: 64,
),
label: Text(
"Serial Killer",
style: Theme.of(context).textTheme.displaySmall,
),
2022-08-01 12:32:42 +00:00
)
],
);
2022-08-01 12:13:50 +00:00
}
}