Fix android UX

This commit is contained in:
zontreck 2025-03-22 19:56:49 -07:00
parent c62a39edcb
commit 2ade0cca22
2 changed files with 37 additions and 29 deletions

View file

@ -94,16 +94,16 @@ class _HomeState extends State<Home> {
children: [
Image.asset(
Pokemon.values[index].toDexPath(),
width: 198,
height: 198,
width: 64,
height: 64,
),
Text(
Pokemon.values[index].name,
style: TextStyle(fontSize: 32, color: Colors.black),
style: TextStyle(fontSize: 16, color: Colors.black),
),
Text(
"#${Pokemon.values[index].id}",
style: TextStyle(fontSize: 24, color: Colors.black),
style: TextStyle(fontSize: 16, color: Colors.black),
),
],
),
@ -113,7 +113,7 @@ class _HomeState extends State<Home> {
},
itemCount: Pokemon.values.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
crossAxisCount: 3,
),
),
),
@ -148,27 +148,29 @@ class _DexEntryState extends State<DexEntry> {
),
body: Padding(
padding: EdgeInsets.all(8),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(_pkmn.toDexPath()),
Center(child: Image.asset(_pkmn.toDexPath())),
Text("ID: ${_pkmn.id}", style: TextStyle(fontSize: 24)),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Type: ", style: TextStyle(fontSize: 24)),
_pkmn.getTypeWidgets(),
],
),
SizedBox(height: 24),
SizedBox(height: 32),
if (_pkmn.hasEvolutions)
Row(
children: [
Text("Evolutions: ", style: TextStyle(fontSize: 24)),
_pkmn.getEvolutions(0),
],
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: _pkmn.getEvolutions(0),
),
],
),
),
),
);
}
}

View file

@ -145,15 +145,16 @@ enum Pokemon {
backgroundColor: WidgetStatePropertyAll(type.backgroundColor),
foregroundColor: WidgetStatePropertyAll(type.textColor),
),
child: Text(type.name, style: TextStyle(fontSize: 24)),
child: Text(type.name, style: TextStyle(fontSize: 16)),
),
);
}
return Row(children: widgets);
}
Widget getEvolutions(int subID) {
if (!hasEvolutions) return Row(children: []);
List<Widget> getEvolutions(int subID) {
if (!hasEvolutions) return [];
Pokemon ev = Pokemon.values.where((x) => x.id == evolution!.to).first;
@ -162,16 +163,19 @@ enum Pokemon {
if (subID == 0) {
sprites.add(
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(toDexPath(), width: 96, height: 96),
Text("Evolutions: ", style: TextStyle(fontSize: 24)),
Image.asset(toDexPath(), width: 64, height: 64),
getTypeWidgets(),
],
),
);
sprites.add(
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(Icons.arrow_forward, size: 48),
Icon(Icons.arrow_downward, size: 48),
Text("Level ${evolution!.level}", style: TextStyle(fontSize: 24)),
],
),
@ -180,8 +184,9 @@ enum Pokemon {
sprites.add(
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(ev.toDexPath(), width: 96, height: 96),
Image.asset(ev.toDexPath(), width: 64, height: 64),
ev.getTypeWidgets(),
],
),
@ -190,8 +195,9 @@ enum Pokemon {
if (ev.hasEvolutions) {
sprites.add(
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(Icons.arrow_forward, size: 48),
Icon(Icons.arrow_downward, size: 48),
Text(
"Level ${ev.evolution!.level}",
style: TextStyle(fontSize: 24),
@ -200,9 +206,9 @@ enum Pokemon {
),
);
//sprites.add(Icon(Icons.arrow_forward, size: 48));
sprites.add(ev.getEvolutions(subID + 1));
sprites.addAll(ev.getEvolutions(subID + 1));
}
return Row(children: sprites);
return sprites;
}
}