Compare commits

...

4 Commits

Author SHA1 Message Date
zoe 8fee9dc59a Merge branch 'main' of git.kittycat.homes:BatHeartTiger/senatorialkillers 2022-08-03 18:16:42 +02:00
zoe caef071425 change tos 2022-08-03 18:16:32 +02:00
zoe 5fb7ff92f5 runs in browser now 2022-08-01 17:24:29 +02:00
zoe 373fd0484c show images 2022-08-01 16:59:57 +02:00
4 changed files with 37 additions and 6 deletions

View File

@ -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),
);
}
}

View File

@ -2,8 +2,11 @@ import 'package:flutter/material.dart';
import './quiz.dart';
import './heading.dart';
import './person.dart';
import './about.dart';
void main() async {
// refuses to do anything in browser unless this is called
WidgetsFlutterBinding.ensureInitialized();
List<Person> people = await getPeopleList();
runApp(Senatorialkillers(
people: people,
@ -17,6 +20,7 @@ class Senatorialkillers extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
floatingActionButton: const AboutButton(),
body: SingleChildScrollView(
child: Center(
child: Column(

View File

@ -1,6 +1,8 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter/services.dart';
class Person {
late String img;
late String name;
@ -15,16 +17,16 @@ class Person {
});
Person.fromJson(Map<String, dynamic> json) {
img = json['img'];
img = json['image'];
name = json['name'];
senator = json['senator'];
senator = json['senator'] == true.toString();
description = json['description'];
}
}
Future<List<Person>> getPeopleList() async {
String data = await File("assets/data.json").readAsString();
Map<String, dynamic> map = jsonDecode(data);
String data = await rootBundle.loadString('assets/data.json');
List<dynamic> map = jsonDecode(data)["people"];
List<Person> people = [];
for (int i = 0; i < map.length - 1; i++) {
people.add(Person.fromJson(map[i]));

View File

@ -13,11 +13,12 @@ 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(
"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"),
Image.network(people[0].img),
const AnswerButtons(),
],
);