Skip to content

Commit

Permalink
fix: stat information when pokemon is mega
Browse files Browse the repository at this point in the history
  • Loading branch information
brunogabriel committed Oct 31, 2024
1 parent 4dd0a95 commit e8d60e2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
9 changes: 6 additions & 3 deletions pokedex/lib/design/components/stat_line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ class StatLine extends StatelessWidget {
children: [
Expanded(
flex: 2,
child: Text(
title,
style: textTheme.labelMedium?.copyWith(fontWeight: FontWeight.bold),
child: FittedBox(
child: Text(
title,
style:
textTheme.labelMedium?.copyWith(fontWeight: FontWeight.bold),
),
),
),
Expanded(
Expand Down
2 changes: 0 additions & 2 deletions pokedex/lib/feature/stats/domain/entities/stats_entity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ import 'stats_value_entity.dart';
class StatsEntity {
StatsEntity({
required this.pokemon,
required this.pokemonSpecies,
required this.multiplers,
required this.statsMap,
required this.minStat,
required this.summation,
});

final List<Pair<String, double>> multiplers;
final PokemonSpecies pokemonSpecies;
final Pokemon pokemon;

final Map<String, StatsValueEntity?> statsMap;
Expand Down
3 changes: 1 addition & 2 deletions pokedex/lib/feature/stats/domain/stats_use_case.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class StatsUseCaseImpl implements StatsUseCase {

@override
Future<StatsEntity> getStats(Pokemon pokemon) async {
final pokemonSpecies = await _pokedex.pokemonSpecies.get(id: pokemon.id);
final typesResources = await _pokedex.types.getAll();
final allTypes = typesResources.results.map((e) => e.name);
final types = await Future.wait(pokemon.types
Expand Down Expand Up @@ -49,7 +48,7 @@ class StatsUseCaseImpl implements StatsUseCase {

return StatsEntity(
pokemon: pokemon,
pokemonSpecies: pokemonSpecies,
// pokemonSpecies: pokemonSpecies,
statsMap: entries,
minStat: entries.values.map((e) => e.minValue).maxOrNull ?? 0,
summation: entries.values.map((e) => e.value).sum,
Expand Down

0 comments on commit e8d60e2

Please sign in to comment.