diff --git a/lib/about.dart b/lib/about.dart index e69de29..5418f6d 100644 --- a/lib/about.dart +++ b/lib/about.dart @@ -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"); + }, + child: const Icon(Icons.question_mark), + ); + } +} diff --git a/lib/main.dart b/lib/main.dart index 103b171..c33dbcc 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import './quiz.dart'; import './heading.dart'; import './person.dart'; +import './about.dart'; void main() async { List people = await getPeopleList(); @@ -17,6 +18,7 @@ class Senatorialkillers extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( home: Scaffold( + floatingActionButton: const AboutButton(), body: SingleChildScrollView( child: Center( child: Column( diff --git a/lib/person.dart b/lib/person.dart index c8ad151..8c58bb6 100644 --- a/lib/person.dart +++ b/lib/person.dart @@ -15,16 +15,16 @@ class Person { }); Person.fromJson(Map json) { - img = json['img']; + img = json['image']; name = json['name']; - senator = json['senator']; + senator = json['senator'] == true.toString(); description = json['description']; } } Future> getPeopleList() async { String data = await File("assets/data.json").readAsString(); - Map map = jsonDecode(data); + List map = jsonDecode(data)["people"]; List people = []; for (int i = 0; i < map.length - 1; i++) { people.add(Person.fromJson(map[i])); diff --git a/lib/quiz.dart b/lib/quiz.dart index 625e3a2..5e9c9b4 100644 --- a/lib/quiz.dart +++ b/lib/quiz.dart @@ -13,11 +13,12 @@ class _QuizState extends State { late List 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(), ], );