щас я буду все ломать
This commit is contained in:
parent
9c16de318d
commit
a631adb572
@ -23,6 +23,7 @@ class PokemonDataDto {
|
||||
final List<String>? evolvesTo;
|
||||
final List<PokemonAbilityDto>? abilities;
|
||||
final PokemonImagesDto? images;
|
||||
final String? artist;
|
||||
|
||||
const PokemonDataDto({
|
||||
this.id,
|
||||
@ -31,6 +32,7 @@ class PokemonDataDto {
|
||||
this.evolvesTo,
|
||||
this.abilities,
|
||||
this.images,
|
||||
this.artist,
|
||||
});
|
||||
|
||||
factory PokemonDataDto.fromJson(Map<String, dynamic> json) => _$PokemonDataDtoFromJson(json);
|
||||
|
@ -30,6 +30,7 @@ PokemonDataDto _$PokemonDataDtoFromJson(Map<String, dynamic> json) =>
|
||||
images: json['images'] == null
|
||||
? null
|
||||
: PokemonImagesDto.fromJson(json['images'] as Map<String, dynamic>),
|
||||
artist: json['artist'] as String?,
|
||||
);
|
||||
|
||||
PokemonAbilityDto _$PokemonAbilityDtoFromJson(Map<String, dynamic> json) =>
|
||||
|
@ -17,7 +17,7 @@ extension PokemonDataDtoToModel on PokemonDataDto {
|
||||
CardData toDomain() => CardData(
|
||||
name ?? 'UNKNOWN',
|
||||
imageUrl: images?.large ?? _imagePlaceholder,
|
||||
descriptionText: _makeDescriptionText(types, evolvesTo, abilities),
|
||||
descriptionText: _makeDescriptionText(types, evolvesTo, abilities, artist),
|
||||
id: id,
|
||||
);
|
||||
|
||||
@ -25,15 +25,18 @@ extension PokemonDataDtoToModel on PokemonDataDto {
|
||||
List<String>? types,
|
||||
List<String>? evolvesTo,
|
||||
List<PokemonAbilityDto>? abilities,
|
||||
String? artist,
|
||||
) {
|
||||
final typeText = types != null && types.isNotEmpty ? 'Types: ${types.join(", ")}' : '';
|
||||
final evolvesToText = evolvesTo != null && evolvesTo.isNotEmpty ? 'Evolves To: ${evolvesTo.join(", ")}' : '';
|
||||
final abilitiesText = abilities != null && abilities.isNotEmpty ? 'Abilities: ${abilities.map((a) => a.name).join(", ")}' : '';
|
||||
final artistText = artist != null ? 'Artist: $artist' : '';
|
||||
|
||||
return [
|
||||
typeText,
|
||||
evolvesToText,
|
||||
abilitiesText,
|
||||
artistText,
|
||||
].where((text) => text.isNotEmpty).join('\n');
|
||||
}
|
||||
}
|
@ -30,7 +30,7 @@ class PokemonRepository extends ApiInterface {
|
||||
};
|
||||
|
||||
if (q != null) {
|
||||
queryParameters['q'] = 'name:$q*';
|
||||
queryParameters['q'] = 'name:*$q*';
|
||||
}
|
||||
|
||||
final Response<dynamic> response = await _dio.get<Map<dynamic, dynamic>>(
|
||||
|
Loading…
x
Reference in New Issue
Block a user