This commit is contained in:
revengel66 2024-12-17 17:19:10 +04:00
parent d2237434ee
commit 386c3087b0
4 changed files with 9 additions and 9 deletions

View File

@ -7,7 +7,7 @@ const _imagePlaceholder = 'https://cdn-icons-png.flaticon.com/512/4054/4054617.p
extension CharacterDataDtoToModel on CharactersDataDto {
CardData toDomain() => CardData(
attributes?.name ?? 'UNKNOWN',
imgUrl: attributes?.image ?? _imagePlaceholder,
img: attributes?.image ?? _imagePlaceholder,
description: _makeDescription(attributes?.born, attributes?.died),
id: id,
);

View File

@ -1,13 +1,13 @@
class CardData {
final String text;
final String name;
final String description;
final String? imgUrl;
final String? img;
final String? id;
CardData(
this.text, {
this.name, {
required this.description,
this.imgUrl,
this.img,
this.id,
});
}

View File

@ -16,13 +16,13 @@ class DetailsPage extends StatelessWidget {
Padding(
padding: const EdgeInsets.only(bottom: 16),
child: Image.network(
data.imgUrl ?? '',
data.img ?? '',
),
),
Padding(
padding: const EdgeInsets.only(bottom: 4),
child: Text(
data.text,
data.name,
style: Theme.of(context).textTheme.headlineLarge,
),
),

View File

@ -28,9 +28,9 @@ class _Card extends StatelessWidget {
bool isLiked = false,
}) =>
_Card(
data.text,
data.name,
description: data.description,
imgUrl: data.imgUrl,
imgUrl: data.img,
onLike: onLike,
onTap: onTap,
isLiked: isLiked,