Make the evolution layout more readable

This commit is contained in:
zontreck 2025-03-24 02:22:46 -07:00
parent 32ae4f3e41
commit 03246aad71
3 changed files with 81 additions and 63 deletions

View file

@ -1,7 +1,7 @@
import 'dart:io'; import 'dart:io';
class Constants { class Constants {
static const VERSION = "1.0.032425+0156"; static const VERSION = "1.0.032425+0222";
static bool get isMobile => Platform.isAndroid || Platform.isIOS; static bool get isMobile => Platform.isAndroid || Platform.isIOS;
} }

View file

@ -134,32 +134,45 @@ class SingleEvolution extends Evolution {
} }
Pokemon pkmn = Pokemon.values.where((x) => x.id == to).first; Pokemon pkmn = Pokemon.values.where((x) => x.id == to).first;
var arrow = Column( List<Widget> cardRow = [];
crossAxisAlignment: CrossAxisAlignment.start,
cardRow.add(
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Icon( Icon(
Constants.isMobile ? Icons.arrow_downward : Icons.arrow_forward, Constants.isMobile ? Icons.arrow_downward : Icons.arrow_forward,
size: 48, size: 48,
), ),
Text(printEvolution(), style: TextStyle(fontSize: 24)), Card(
], elevation: 50,
); child: SizedBox(
width: 256,
height: 256,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
Column col = Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(printEvolution(), style: TextStyle(fontSize: 16)),
Image.asset( Image.asset(
pkmn.toDexPath(), pkmn.toDexPath(),
width: Constants.isMobile ? 64 : 128, width: Constants.isMobile ? 64 : 128,
height: Constants.isMobile ? 64 : 128, height: Constants.isMobile ? 64 : 128,
), ),
Text(pkmn.pokemonName, style: TextStyle(fontSize: 24)),
pkmn.getTypeWidgets(), pkmn.getTypeWidgets(),
], ],
),
),
),
],
),
); );
Column rw = Column( Column rw = Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [arrow, col], children: [Row(children: cardRow)],
); );
return rw; return rw;
@ -184,7 +197,7 @@ class BranchedEvolution extends Evolution {
sRet += "Level ${level}"; sRet += "Level ${level}";
} }
for (var condition in conds) { for (var condition in conds) {
sRet += condition.name; sRet += condition.name + " ";
} }
return sRet; return sRet;
} }
@ -192,11 +205,8 @@ class BranchedEvolution extends Evolution {
@override @override
Widget getEvolution() { Widget getEvolution() {
// This is a branched evolution. So first, we print the arrows, and conditions. // This is a branched evolution. So first, we print the arrows, and conditions.
Row arrowRow;
List<Widget> arrows = [];
List<Widget> pkmnRow = []; List<Widget> cardRow = [];
Row rowPkmn;
for (var pkmn in alternates) { for (var pkmn in alternates) {
int index = alternates.indexOf(pkmn); int index = alternates.indexOf(pkmn);
@ -208,51 +218,47 @@ class BranchedEvolution extends Evolution {
Pokemon _pkmn = Pokemon.values.where((x) => x.id == pkmn).first; Pokemon _pkmn = Pokemon.values.where((x) => x.id == pkmn).first;
arrows.add( cardRow.add(
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Icon( Icon(
Constants.isMobile ? Icons.arrow_downward : Icons.arrow_forward, Constants.isMobile ? Icons.arrow_downward : Icons.arrow_forward,
size: 48, size: 48,
), ),
Card(
elevation: 50,
child: SizedBox(
width: 256,
height: 256,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text( Text(
_prntEV(conditions[index], levels[index]), _prntEV(conditions[index], levels[index]),
style: TextStyle(fontSize: 24), style: TextStyle(fontSize: 16),
), ),
//Text(printEvolution(), style: TextStyle(fontSize: 24)),
],
),
);
pkmnRow.add(
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset( Image.asset(
_pkmn.toDexPath(), _pkmn.toDexPath(),
width: Constants.isMobile ? 64 : 128, width: Constants.isMobile ? 64 : 128,
height: Constants.isMobile ? 64 : 128, height: Constants.isMobile ? 64 : 128,
), ),
Text(_pkmn.pokemonName, style: TextStyle(fontSize: 24)),
_pkmn.getTypeWidgets(), _pkmn.getTypeWidgets(),
], ],
), ),
),
),
],
),
); );
} }
arrowRow = Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: arrows,
);
rowPkmn = Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: pkmnRow,
);
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [arrowRow, rowPkmn], children: [Row(children: cardRow)],
); );
} }
} }
@ -1338,13 +1344,25 @@ enum Pokemon {
if (subID == 0) { if (subID == 0) {
sprites.add(Text("Evolutions: ", style: TextStyle(fontSize: 24))); sprites.add(Text("Evolutions: ", style: TextStyle(fontSize: 24)));
sprites.add( sprites.add(
Card(
elevation: 50,
child: SizedBox(
width: 256,
height: 256,
child: Column(
children: [
Image.asset( Image.asset(
toDexPath(), toDexPath(),
width: Constants.isMobile ? 64 : 128, width: Constants.isMobile ? 64 : 128,
height: Constants.isMobile ? 64 : 128, height: Constants.isMobile ? 64 : 128,
), ),
Text(pokemonName, style: TextStyle(fontSize: 24)),
getTypeWidgets(),
],
),
),
),
); );
sprites.add(getTypeWidgets());
sprites.add(evolution!.getEvolution()); sprites.add(evolution!.getEvolution());
//print("Main page EV."); //print("Main page EV.");
} else { } else {

View file

@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 1.0.032425+0156 version: 1.0.032425+0222
environment: environment:
sdk: ^3.7.0 sdk: ^3.7.0