From 03246aad716da403d7e6c11757d0f97065b8ae1a Mon Sep 17 00:00:00 2001 From: zontreck Date: Mon, 24 Mar 2025 02:22:46 -0700 Subject: [PATCH] Make the evolution layout more readable --- lib/Consts.dart | 2 +- lib/pokemon.dart | 140 ++++++++++++++++++++++++++--------------------- pubspec.yaml | 2 +- 3 files changed, 81 insertions(+), 63 deletions(-) diff --git a/lib/Consts.dart b/lib/Consts.dart index 1f32c4e..37951bb 100644 --- a/lib/Consts.dart +++ b/lib/Consts.dart @@ -1,7 +1,7 @@ import 'dart:io'; class Constants { - static const VERSION = "1.0.032425+0156"; + static const VERSION = "1.0.032425+0222"; static bool get isMobile => Platform.isAndroid || Platform.isIOS; } diff --git a/lib/pokemon.dart b/lib/pokemon.dart index baa5910..f8a18e8 100644 --- a/lib/pokemon.dart +++ b/lib/pokemon.dart @@ -134,32 +134,45 @@ class SingleEvolution extends Evolution { } Pokemon pkmn = Pokemon.values.where((x) => x.id == to).first; - var arrow = Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Icon( - Constants.isMobile ? Icons.arrow_downward : Icons.arrow_forward, - size: 48, - ), - Text(printEvolution(), style: TextStyle(fontSize: 24)), - ], - ); + List cardRow = []; - Column col = Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - pkmn.toDexPath(), - width: Constants.isMobile ? 64 : 128, - height: Constants.isMobile ? 64 : 128, - ), - pkmn.getTypeWidgets(), - ], + cardRow.add( + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Constants.isMobile ? Icons.arrow_downward : Icons.arrow_forward, + size: 48, + ), + Card( + elevation: 50, + child: SizedBox( + width: 256, + height: 256, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + + children: [ + Text(printEvolution(), style: TextStyle(fontSize: 16)), + + Image.asset( + pkmn.toDexPath(), + width: Constants.isMobile ? 64 : 128, + height: Constants.isMobile ? 64 : 128, + ), + Text(pkmn.pokemonName, style: TextStyle(fontSize: 24)), + pkmn.getTypeWidgets(), + ], + ), + ), + ), + ], + ), ); Column rw = Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [arrow, col], + children: [Row(children: cardRow)], ); return rw; @@ -184,7 +197,7 @@ class BranchedEvolution extends Evolution { sRet += "Level ${level}"; } for (var condition in conds) { - sRet += condition.name; + sRet += condition.name + " "; } return sRet; } @@ -192,11 +205,8 @@ class BranchedEvolution extends Evolution { @override Widget getEvolution() { // This is a branched evolution. So first, we print the arrows, and conditions. - Row arrowRow; - List arrows = []; - List pkmnRow = []; - Row rowPkmn; + List cardRow = []; for (var pkmn in alternates) { int index = alternates.indexOf(pkmn); @@ -208,51 +218,47 @@ class BranchedEvolution extends Evolution { Pokemon _pkmn = Pokemon.values.where((x) => x.id == pkmn).first; - arrows.add( + cardRow.add( Column( - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( Constants.isMobile ? Icons.arrow_downward : Icons.arrow_forward, size: 48, ), - Text( - _prntEV(conditions[index], levels[index]), - style: TextStyle(fontSize: 24), - ), - //Text(printEvolution(), style: TextStyle(fontSize: 24)), - ], - ), - ); + Card( + elevation: 50, + child: SizedBox( + width: 256, + height: 256, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, - pkmnRow.add( - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - _pkmn.toDexPath(), - width: Constants.isMobile ? 64 : 128, - height: Constants.isMobile ? 64 : 128, + children: [ + Text( + _prntEV(conditions[index], levels[index]), + style: TextStyle(fontSize: 16), + ), + + Image.asset( + _pkmn.toDexPath(), + width: 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( crossAxisAlignment: CrossAxisAlignment.start, - children: [arrowRow, rowPkmn], + children: [Row(children: cardRow)], ); } } @@ -1338,13 +1344,25 @@ enum Pokemon { if (subID == 0) { sprites.add(Text("Evolutions: ", style: TextStyle(fontSize: 24))); sprites.add( - Image.asset( - toDexPath(), - width: Constants.isMobile ? 64 : 128, - height: Constants.isMobile ? 64 : 128, + Card( + elevation: 50, + child: SizedBox( + width: 256, + height: 256, + child: Column( + children: [ + Image.asset( + toDexPath(), + width: Constants.isMobile ? 64 : 128, + height: Constants.isMobile ? 64 : 128, + ), + Text(pokemonName, style: TextStyle(fontSize: 24)), + getTypeWidgets(), + ], + ), + ), ), ); - sprites.add(getTypeWidgets()); sprites.add(evolution!.getEvolution()); //print("Main page EV."); } else { diff --git a/pubspec.yaml b/pubspec.yaml index bb0e014..0637bca 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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 # 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. -version: 1.0.032425+0156 +version: 1.0.032425+0222 environment: sdk: ^3.7.0