Add more entries, add dex entry display to datagen tool

This commit is contained in:
zontreck 2025-06-02 14:16:33 -07:00
parent b7a9eb6400
commit c22423fa35
6 changed files with 598 additions and 25 deletions

View file

@ -7,6 +7,7 @@ import 'package:libacflutter/Constants.dart';
import 'package:pokedex/Consts.dart';
import 'package:pokedex/Session.dart';
import 'package:pokedex/pokemon.dart';
import 'package:pokedex/pokemonHelpers.dart';
import 'package:wakelock_plus/wakelock_plus.dart';
Future<int> main(List<String> args) async {
@ -48,6 +49,7 @@ class _main extends State<MainGen> {
StringBuilder sb = StringBuilder();
int index = 0;
Generation? currentGen;
Pokemon? currentPokemon;
int maxTasks = 5;
int total = 0;
@ -128,10 +130,12 @@ class _main extends State<MainGen> {
}
var pokemon = Pokemon.values[iterNumber];
currentPokemon = pokemon;
if (currentGen != pokemon.generation) {
if (total > 0 && completed != total && completed > 0)
if (total > 0 && completed != total && completed > 0) {
sb.append("\n- Completed $completed/$total\n");
}
sb.append("\n# Generation ${pokemon.generation.name}\n\n");
currentGen = pokemon.generation;
@ -189,8 +193,11 @@ class _main extends State<MainGen> {
} else if (state - index == 6) {
// Task - write file
if (completed != total && completed > 0)
currentPokemon = null;
if (completed != total && completed > 0) {
sb.append("\n- Completed $completed/$total\n");
}
maxTasks += 3;
statusMessage = "Saving to COMPLETED.md";
@ -220,6 +227,65 @@ class _main extends State<MainGen> {
super.didChangeDependencies();
}
Widget dexEntry() {
if (currentPokemon == null) {
return Text("");
} else {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(currentPokemon!.toDexPath()),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Type: ", style: TextStyle(fontSize: 24)),
PokemonHelpers.getTypeWidgets(currentPokemon!),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"First Seen in Generation ${currentPokemon!.generation.name}",
style: TextStyle(fontSize: 24),
),
],
),
if (currentPokemon!.extraVariants.isNotEmpty)
Text("Extra Variations: ", style: TextStyle(fontSize: 24)),
if (currentPokemon!.extraVariants.isNotEmpty)
PokemonHelpers.getVariations(currentPokemon!),
SizedBox(height: 32),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: PokemonHelpers.getEvolutions(0, currentPokemon!),
),
),
if (SessionData.enableDescription &&
currentPokemon!.dexEntries.isNotEmpty)
Text("Description: ", style: TextStyle(fontSize: 24)),
if (SessionData.enableDescription &&
currentPokemon!.dexEntries.isNotEmpty)
PokemonHelpers.printDescription(currentPokemon!),
SizedBox(height: 50),
if (currentPokemon!.locations.isNotEmpty)
Text("Where to find:", style: TextStyle(fontSize: 24)),
if (currentPokemon!.locations.isNotEmpty)
PokemonHelpers.printLocations(currentPokemon!),
],
);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -229,22 +295,26 @@ class _main extends State<MainGen> {
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"PokeDex Version: ${Constants.VERSION}",
style: TextStyle(fontSize: 24),
),
SizedBox(height: 50),
Text("Status: $statusMessage", style: TextStyle(fontSize: 24)),
Text(
"Progress: ${progress * 100}%",
style: TextStyle(fontSize: 24),
),
Text("Task $state/$maxTasks", style: TextStyle(fontSize: 24)),
LinearProgressIndicator(value: progress, minHeight: 30),
],
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"PokeDex Version: ${Constants.VERSION}",
style: TextStyle(fontSize: 24),
),
SizedBox(height: 50),
Text("Status: $statusMessage", style: TextStyle(fontSize: 24)),
Text(
"Progress: ${progress * 100}%",
style: TextStyle(fontSize: 24),
),
Text("Task $state/$maxTasks", style: TextStyle(fontSize: 24)),
LinearProgressIndicator(value: progress, minHeight: 30),
SizedBox(height: 10),
dexEntry(),
],
),
),
),
);