senatorialkillers/lib/quiz.dart

62 lines
1.4 KiB
Dart

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