Compare commits
4 Commits
b4b61ec2f6
...
8fee9dc59a
Author | SHA1 | Date |
---|---|---|
zoe | 8fee9dc59a | |
zoe | caef071425 | |
zoe | 5fb7ff92f5 | |
zoe | 373fd0484c |
|
@ -0,0 +1,24 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class AboutButton extends StatelessWidget {
|
||||||
|
const AboutButton({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return FloatingActionButton.small(
|
||||||
|
onPressed: () {
|
||||||
|
showAboutDialog(
|
||||||
|
context: context,
|
||||||
|
applicationName: "Senator or Serial Killer",
|
||||||
|
applicationVersion: "0.0.0",
|
||||||
|
children: [
|
||||||
|
const Text(
|
||||||
|
"THE MOST FUN YOU CAN POSSIBLY HAVE WHILE LOOKING AT A WEBSITE! PRESS THE BUTTONS TO WIN!")
|
||||||
|
],
|
||||||
|
applicationLegalese:
|
||||||
|
"this application is licensed under the \"you will be eaten by ants if you do something i dont like\" license. the name is self explanatory, THIS WEBSITE IS ILLEGAL TO USE OR EVEN LOOK AT, SORRY");
|
||||||
|
},
|
||||||
|
child: const Icon(Icons.question_mark),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,8 +2,11 @@ import 'package:flutter/material.dart';
|
||||||
import './quiz.dart';
|
import './quiz.dart';
|
||||||
import './heading.dart';
|
import './heading.dart';
|
||||||
import './person.dart';
|
import './person.dart';
|
||||||
|
import './about.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
|
// refuses to do anything in browser unless this is called
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
List<Person> people = await getPeopleList();
|
List<Person> people = await getPeopleList();
|
||||||
runApp(Senatorialkillers(
|
runApp(Senatorialkillers(
|
||||||
people: people,
|
people: people,
|
||||||
|
@ -17,6 +20,7 @@ class Senatorialkillers extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
|
floatingActionButton: const AboutButton(),
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
class Person {
|
class Person {
|
||||||
late String img;
|
late String img;
|
||||||
late String name;
|
late String name;
|
||||||
|
@ -15,16 +17,16 @@ class Person {
|
||||||
});
|
});
|
||||||
|
|
||||||
Person.fromJson(Map<String, dynamic> json) {
|
Person.fromJson(Map<String, dynamic> json) {
|
||||||
img = json['img'];
|
img = json['image'];
|
||||||
name = json['name'];
|
name = json['name'];
|
||||||
senator = json['senator'];
|
senator = json['senator'] == true.toString();
|
||||||
description = json['description'];
|
description = json['description'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Person>> getPeopleList() async {
|
Future<List<Person>> getPeopleList() async {
|
||||||
String data = await File("assets/data.json").readAsString();
|
String data = await rootBundle.loadString('assets/data.json');
|
||||||
Map<String, dynamic> map = jsonDecode(data);
|
List<dynamic> map = jsonDecode(data)["people"];
|
||||||
List<Person> people = [];
|
List<Person> people = [];
|
||||||
for (int i = 0; i < map.length - 1; i++) {
|
for (int i = 0; i < map.length - 1; i++) {
|
||||||
people.add(Person.fromJson(map[i]));
|
people.add(Person.fromJson(map[i]));
|
||||||
|
|
|
@ -13,11 +13,12 @@ class _QuizState extends State<Quiz> {
|
||||||
late List<Person> people;
|
late List<Person> people;
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
people = widget.fullPeopleList;
|
||||||
|
people.shuffle();
|
||||||
people = widget.fullPeopleList;
|
people = widget.fullPeopleList;
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Image.network(
|
Image.network(people[0].img),
|
||||||
"https://upload.wikimedia.org/wikipedia/commons/thumb/c/c1/Variegated_golden_frog_%28Mantella_baroni%29_Ranomafana.jpg/800px-Variegated_golden_frog_%28Mantella_baroni%29_Ranomafana.jpg"),
|
|
||||||
const AnswerButtons(),
|
const AnswerButtons(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue