diff --git a/l10n/app_en.arb b/l10n/app_en.arb index a01051c..b182259 100644 --- a/l10n/app_en.arb +++ b/l10n/app_en.arb @@ -4,6 +4,8 @@ "search": "Search", "liked": "liked!", "disliked": "disliked :(", + "location": "Location", + "species": "Species", "arbEnding": "Чтобы не забыть про отсутствие запятой :)" } \ No newline at end of file diff --git a/l10n/app_ru.arb b/l10n/app_ru.arb index c00dd02..7aec6be 100644 --- a/l10n/app_ru.arb +++ b/l10n/app_ru.arb @@ -4,6 +4,8 @@ "search": "Поиск", "liked": "Добавлено в понравившиеся :)", "disliked": "Удалено из понравившегося :(", + "location": "Местоположение", + "species": "Вид", "arbEnding": "Чтобы не забыть про отсутствие запятой :)" } \ No newline at end of file diff --git a/lib/components/locale/l10n/app_locale.dart b/lib/components/locale/l10n/app_locale.dart index bb28342..dc004b6 100644 --- a/lib/components/locale/l10n/app_locale.dart +++ b/lib/components/locale/l10n/app_locale.dart @@ -113,6 +113,18 @@ abstract class AppLocale { /// **'Удалено из понравившегося :('** String get disliked; + /// No description provided for @location. + /// + /// In ru, this message translates to: + /// **'Местоположение'** + String get location; + + /// No description provided for @species. + /// + /// In ru, this message translates to: + /// **'Вид'** + String get species; + /// No description provided for @arbEnding. /// /// In ru, this message translates to: diff --git a/lib/components/locale/l10n/app_locale_en.dart b/lib/components/locale/l10n/app_locale_en.dart index 599548c..309e9df 100644 --- a/lib/components/locale/l10n/app_locale_en.dart +++ b/lib/components/locale/l10n/app_locale_en.dart @@ -15,6 +15,12 @@ class AppLocaleEn extends AppLocale { @override String get disliked => 'disliked :('; + @override + String get location => 'Location'; + + @override + String get species => 'Species'; + @override String get arbEnding => 'Чтобы не забыть про отсутствие запятой :)'; } diff --git a/lib/components/locale/l10n/app_locale_ru.dart b/lib/components/locale/l10n/app_locale_ru.dart index fbd2661..8c0b4d3 100644 --- a/lib/components/locale/l10n/app_locale_ru.dart +++ b/lib/components/locale/l10n/app_locale_ru.dart @@ -15,6 +15,12 @@ class AppLocaleRu extends AppLocale { @override String get disliked => 'Удалено из понравившегося :('; + @override + String get location => 'Местоположение'; + + @override + String get species => 'Вид'; + @override String get arbEnding => 'Чтобы не забыть про отсутствие запятой :)'; } diff --git a/lib/data/mappers/characters_mapper.dart b/lib/data/mappers/characters_mapper.dart index 7661378..59bbf05 100644 --- a/lib/data/mappers/characters_mapper.dart +++ b/lib/data/mappers/characters_mapper.dart @@ -17,6 +17,8 @@ extension CharacterDataDtoToModel on CharacterDataDto { attributes?.name ?? 'UNKNOWN', imageUrl: attributes?.image ?? _imagePlaceholder, descriptionText: _makeDescriptionText(attributes?.born, attributes?.died), + speciesText: '', + locationText: '', ); String _makeDescriptionText(String? born, String? died) { diff --git a/lib/data/mappers/r&m_characters_mapper.dart b/lib/data/mappers/r&m_characters_mapper.dart index c32d691..09c8d76 100644 --- a/lib/data/mappers/r&m_characters_mapper.dart +++ b/lib/data/mappers/r&m_characters_mapper.dart @@ -9,9 +9,10 @@ extension RandMCharacterDataDtoMapper on RandMCharacterDataDto { CardData toDomain() => CardData( name ?? 'UNKNOWN', imageUrl: image ?? _imagePlaceholder, - descriptionText: - 'Местоположение:\n${location?.name ?? 'unknown'}\n\nВид:\n${species ?? 'unknown'}', + descriptionText: '', id: id, + speciesText: species ?? 'unknown', + locationText: location?.name ?? 'unknown', ); } diff --git a/lib/domain/models/card.dart b/lib/domain/models/card.dart index 7b4bf1d..0cab566 100644 --- a/lib/domain/models/card.dart +++ b/lib/domain/models/card.dart @@ -4,6 +4,8 @@ class CardData { final String text; final IconData icon; final String descriptionText; + final String locationText; + final String speciesText; final String? imageUrl; final int? id; @@ -11,6 +13,8 @@ class CardData { this.text, { this.icon = Icons.bookmark_border, required this.descriptionText, + required this.locationText, + required this.speciesText, this.imageUrl, this.id, }); diff --git a/lib/presentation/details_page/details_page.dart b/lib/presentation/details_page/details_page.dart index 82f33af..dcf6017 100644 --- a/lib/presentation/details_page/details_page.dart +++ b/lib/presentation/details_page/details_page.dart @@ -1,3 +1,4 @@ +import 'package:app/components/extensions/context_x.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:app/domain/models/card.dart'; @@ -34,7 +35,8 @@ class DetailsPage extends StatelessWidget { Padding( padding: const EdgeInsets.all(9.0), child: Text( - data.descriptionText, + '${context.locale.location}:\n${data.locationText}\n\n' + '${context.locale.species}:\n${data.speciesText}', style: Theme.of(context).textTheme.bodyLarge, ), ) diff --git a/lib/presentation/home_page/card.dart b/lib/presentation/home_page/card.dart index d900907..d920b7e 100644 --- a/lib/presentation/home_page/card.dart +++ b/lib/presentation/home_page/card.dart @@ -6,6 +6,8 @@ class _Card extends StatelessWidget { final String text; final IconData icon; final String descriptionText; + final String locationText; + final String speciesText; final String? imageUrl; final OnLikeCallBack onLike; final VoidCallback? onTap; @@ -15,6 +17,8 @@ class _Card extends StatelessWidget { const _Card(this.text, { this.icon = Icons.bookmark_border, required this.descriptionText, + required this.locationText, + required this.speciesText, this.imageUrl, this.onLike, this.onTap, @@ -30,6 +34,8 @@ class _Card extends StatelessWidget { _Card( data.text, descriptionText: data.descriptionText, + locationText: data.locationText, + speciesText: data.speciesText, icon: data.icon, imageUrl: data.imageUrl, onLike: onLike, @@ -88,6 +94,11 @@ class _Card extends StatelessWidget { .textTheme .headlineSmall, ), + Text( + '${context.locale.location}:\n${locationText}\n\n' + '${context.locale.species}: ${speciesText}', + style: Theme.of(context).textTheme.bodyMedium, + ) ], ), ), diff --git a/lib/presentation/home_page/home_page.dart b/lib/presentation/home_page/home_page.dart index 46d2b45..dd1cac5 100644 --- a/lib/presentation/home_page/home_page.dart +++ b/lib/presentation/home_page/home_page.dart @@ -61,7 +61,7 @@ class _BodyState extends State
{ } void _onNextPageListener() { - if (scrollController.offset > scrollController.position.maxScrollExtent) { + if (scrollController.offset >= scrollController.position.maxScrollExtent) { final bloc = context.read