Skip to content

Commit

Permalink
visual improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
NachtaktiverHalbaffe committed Feb 16, 2024
1 parent 0194ea2 commit 921d353
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/src/presentation/screens/pokedex_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PokedexScreen extends ConsumerWidget {

final CancellationToken cancellationToken = CancellationToken();
final List<PokemonDto> pokemons = List.empty(growable: true);
int currentIndex = 0;
final SwiperController _controller = SwiperController();

@override
Widget build(BuildContext context, WidgetRef ref) {
Expand All @@ -38,9 +38,10 @@ class PokedexScreen extends ConsumerWidget {
),
child: Column(
children: [
SizedBox(height: MediaQuery.of(context).size.height * 0.075),
SizedBox(height: MediaQuery.of(context).size.height * 0.05),
pokemons.isNotEmpty
? Swiper(
controller: _controller,
itemWidth: MediaQuery.of(context).size.width * 0.9,
itemHeight: MediaQuery.of(context).size.height * 0.8,
itemCount: pokemons.length,
Expand All @@ -49,22 +50,22 @@ class PokedexScreen extends ConsumerWidget {
autoplay: true,
autoplayDisableOnInteraction: true,
itemBuilder: (context, index) {
currentIndex = index;
// _controller.index = index;
return _card(context, pokemons[index]);
},
onIndexChanged: (value) => currentIndex = value,
onTap: (index) {
Navigator.push<PokedexEntryScreen>(
context,
MaterialPageRoute(
builder: (_) => PokedexEntryScreen(
pokemonDto: pokemons[index])));
},
onIndexChanged: (value) => _controller.index = value,
)
: Center(),
SizedBox(height: 12),
AutoSizeText(
"$currentIndex/${pokemons.length}",
"${_controller.index}/${pokemons.length}",
style: const TextStyle(
fontWeight: FontWeight.bold, color: Colors.white),
)
Expand Down

0 comments on commit 921d353

Please sign in to comment.