diff --git a/l10n/app_ru.arb b/l10n/app_ru.arb index 906e27c..72ee9e2 100644 --- a/l10n/app_ru.arb +++ b/l10n/app_ru.arb @@ -1,8 +1,8 @@ { "@@locale": "ru", - "cardLiked": "Сладость добавлена в понравившиеся :)", - "cardDisliked": "Сладость удалена из понравившегося :(", + "cardLiked": "Конфета добавлена в понравившиеся :)", + "cardDisliked": "Конфета удалена из понравившегося :(", "searchInputPlaceholder": "Поиск ..", "titleCard" : "Название", diff --git a/lib/data/dtos/candies_dto.dart b/lib/data/dtos/candies_dto.dart index 8f6036b..24ae4a2 100644 --- a/lib/data/dtos/candies_dto.dart +++ b/lib/data/dtos/candies_dto.dart @@ -23,36 +23,22 @@ class CandiesResponseDto { @JsonSerializable(createToJson: false) class CandyItemDto { @JsonKey(name: "beanId") - final int? candyId; - - @JsonKey(name: "groupName") - final List? manufacturer; - final List? ingredients; + final int? id; @JsonKey(name: "flavorName") final String? name; final String? description; - final String? colorGroup; - final String? backgroundColor; final String? imageUrl; - final bool? glutenFree; - final bool? sugarFree; - final bool? seasonal; - final bool? kosher; + + @JsonKey(name: "groupName") + final List? manufacturer; const CandyItemDto( - {this.candyId, - this.manufacturer, - this.ingredients, + {this.id, this.name, this.description, - this.colorGroup, - this.backgroundColor, this.imageUrl, - this.glutenFree, - this.sugarFree, - this.seasonal, - this.kosher}); + this.manufacturer}); factory CandyItemDto.fromJson(Map json) => _$CandyItemDtoFromJson(json); } diff --git a/lib/data/mapper/candies_mapper.dart b/lib/data/mapper/candies_mapper.dart index 2621501..4df23c5 100644 --- a/lib/data/mapper/candies_mapper.dart +++ b/lib/data/mapper/candies_mapper.dart @@ -9,7 +9,7 @@ extension CandyItemDtoToModel on CandyItemDto { "https://upload.wikimedia.org/wikipedia/commons/a/a2/Person_Image_Placeholder.png", description: description ?? "UNKNOWN", manufacturer: manufacturer ?? ["UNKNOWN"], - candyId: candyId); + id: id); } extension CandiesDtoToModel on CandiesResponseDto { diff --git a/lib/models/card_data.dart b/lib/models/card_data.dart index 1d5d6b7..cbfb2e6 100644 --- a/lib/models/card_data.dart +++ b/lib/models/card_data.dart @@ -3,12 +3,12 @@ class CardData { final String imageUrl; final String description; final List manufacturer; - final int? candyId; + final int? id; const CardData( {required this.name, required this.imageUrl, required this.description, required this.manufacturer, - required this.candyId}); + required this.id}); } diff --git a/lib/presentation/pages/home_page/candy_page.dart b/lib/presentation/pages/home_page/candy_page.dart index e84bb37..c59a4c6 100644 --- a/lib/presentation/pages/home_page/candy_page.dart +++ b/lib/presentation/pages/home_page/candy_page.dart @@ -167,7 +167,7 @@ class _MyCandyPageState extends State { : Card.fromData( data, isLiked: - likeState.likedIds?.contains(data.candyId) == true, + likeState.likedIds?.contains(data.id) == true, onLike: (int? id, String text, bool isLiked) => _onLike(id, text, isLiked), onTap: () => _navigateToDetailsPage(context, data), diff --git a/lib/presentation/pages/home_page/card.dart b/lib/presentation/pages/home_page/card.dart index baf9dc1..38401db 100644 --- a/lib/presentation/pages/home_page/card.dart +++ b/lib/presentation/pages/home_page/card.dart @@ -27,7 +27,7 @@ class Card extends StatelessWidget { VoidCallback? onTap, bool isLiked = false}) => Card( - id: data.candyId, + id: data.id, name: data.name, description: data.description, image: data.imageUrl, @@ -81,16 +81,22 @@ class Card extends StatelessWidget { ), const SizedBox(height: 20, width: 150), Center( + child: ConstrainedBox( + constraints: const BoxConstraints( + maxWidth: 270, // Максимальная ширина изображения + ), child: AspectRatio( - aspectRatio: 4 / 3, // Соотношение сторон (4:3) - child: ClipRRect( - borderRadius: BorderRadius.circular(20.0), - child: Image.network( - image, - fit: BoxFit.cover, + aspectRatio: 6 / 4, // Соотношение сторон (4:3) + child: ClipRRect( + borderRadius: BorderRadius.circular(20.0), + child: Image.network( + image, + fit: BoxFit.cover, + ), + ), ), ), - )), + ), Padding( padding: const EdgeInsets.only(top: 50), child: Column( @@ -98,7 +104,7 @@ class Card extends StatelessWidget { children: [ Text(name, style: const TextStyle(fontSize: 24)), Text( - "${context.locale.price}: ${(((id ?? 1) % 10 + 1) * (Random().nextDouble() * 0.6 + 0.1)).toStringAsFixed(2)} \$", + "${context.locale.price}: ${(((id ?? 1) % 10 + 1) * (pi * 0.2 + 0.1)).toStringAsFixed(2)} \$", style: const TextStyle(fontSize: 18)), ], ))