Refactor in support for branching evolutions

This commit is contained in:
zontreck 2025-03-23 18:14:32 -07:00
parent 8633d8952e
commit e0e926562b
6 changed files with 176 additions and 76 deletions

View file

@ -5,6 +5,8 @@ import 'package:pokedex/Session.dart';
import 'package:pokedex/pokemon.dart';
class MainApp extends StatefulWidget {
const MainApp({super.key});
@override
_MainAppState createState() => _MainAppState();
}
@ -32,7 +34,7 @@ class _MainAppState extends State<MainApp> {
class Home extends StatefulWidget {
final VoidCallback toggleTheme;
Home({required this.toggleTheme});
const Home({super.key, required this.toggleTheme});
@override
_HomeState createState() => _HomeState();
@ -128,6 +130,8 @@ class _HomeState extends State<Home> {
}
class DexEntry extends StatefulWidget {
const DexEntry({super.key});
@override
_DexEntryState createState() => _DexEntryState();
}
@ -184,11 +188,18 @@ class _DexEntryState extends State<DexEntry> {
SizedBox(height: 32),
if (_pkmn.hasEvolutions)
if (Constants.isMobile)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: _pkmn.getEvolutions(0),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: _pkmn.getEvolutions(0),
),
),
if (!Constants.isMobile) Row(children: _pkmn.getEvolutions(0)),
if (!Constants.isMobile)
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(children: _pkmn.getEvolutions(0)),
),
],
),
),