Add more entries
This commit is contained in:
parent
670c23d264
commit
99452498a2
83 changed files with 410 additions and 21 deletions
|
@ -1,3 +1,7 @@
|
|||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:pokedex/Consts.dart';
|
||||
import 'package:pokedex/filters.dart';
|
||||
import 'package:pokedex/pokemon.dart';
|
||||
|
||||
|
@ -5,12 +9,85 @@ class SessionData {
|
|||
static bool darkMode = false;
|
||||
static int highest = 9;
|
||||
static int _cachedHighest = -1;
|
||||
static final List<String> ALPHABET = [
|
||||
"A",
|
||||
"B",
|
||||
"C",
|
||||
"D",
|
||||
"E",
|
||||
"F",
|
||||
"G",
|
||||
"H",
|
||||
"I",
|
||||
"J",
|
||||
"K",
|
||||
"L",
|
||||
"M",
|
||||
"N",
|
||||
"O",
|
||||
"P",
|
||||
"Q",
|
||||
"R",
|
||||
"S",
|
||||
"T",
|
||||
"U",
|
||||
"V",
|
||||
"W",
|
||||
"X",
|
||||
"Y",
|
||||
"Z",
|
||||
"EM",
|
||||
"QM",
|
||||
];
|
||||
|
||||
static int _lastMaxID = 0;
|
||||
|
||||
static void resetHighestGenCache() {
|
||||
_cachedHighest = -1;
|
||||
}
|
||||
|
||||
static String getRandomUnownSprite() {
|
||||
int index = Random().nextInt(ALPHABET.length);
|
||||
var digit = ALPHABET[index];
|
||||
|
||||
return "assets/sprites/unown-${digit.toLowerCase()}.png";
|
||||
}
|
||||
|
||||
static Widget PrintUnown() {
|
||||
List<Widget> widgets = [];
|
||||
List<Widget> tmpWidgets = [];
|
||||
|
||||
int i = 0;
|
||||
int end = Constants.isMobile ? 3 : 4;
|
||||
for (var digit in ALPHABET) {
|
||||
tmpWidgets.add(
|
||||
Image.asset("assets/sprites/unown-${digit.toLowerCase()}.png"),
|
||||
);
|
||||
|
||||
i++;
|
||||
if (i >= end) {
|
||||
widgets.add(
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: tmpWidgets,
|
||||
),
|
||||
);
|
||||
i = 0;
|
||||
tmpWidgets = [];
|
||||
}
|
||||
}
|
||||
widgets.add(
|
||||
Row(crossAxisAlignment: CrossAxisAlignment.start, children: tmpWidgets),
|
||||
);
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: widgets,
|
||||
);
|
||||
}
|
||||
|
||||
static int highestGenID() {
|
||||
if (_lastMaxID != Pokemon.values.length) resetHighestGenCache();
|
||||
if (_cachedHighest != -1) return _cachedHighest;
|
||||
List<Generation> gens = [];
|
||||
|
||||
|
@ -33,6 +110,7 @@ class SessionData {
|
|||
}
|
||||
|
||||
_cachedHighest = max;
|
||||
_lastMaxID = Pokemon.values.length;
|
||||
|
||||
return max;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue