show images

This commit is contained in:
zoe 2022-08-01 16:59:57 +02:00
parent 7214524543
commit 373fd0484c
4 changed files with 32 additions and 5 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");
},
child: const Icon(Icons.question_mark),
);
}
}

View File

@ -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<Person> 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(

View File

@ -15,16 +15,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);
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(),
],
);