diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
index db77bb4..387209c 100644
Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
index 17987b7..514d142 100644
Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index 09d4391..9801130 100644
Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index d5f1c8d..7996cac 100644
Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index 4d6372e..5c4a94d 100644
Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/assets/house.jpg b/assets/house.jpg
new file mode 100644
index 0000000..e828e3d
Binary files /dev/null and b/assets/house.jpg differ
diff --git a/assets/svg/ru.svg b/assets/svg/ru.svg
new file mode 100644
index 0000000..ae12982
--- /dev/null
+++ b/assets/svg/ru.svg
@@ -0,0 +1,19 @@
+
+
+
\ No newline at end of file
diff --git a/assets/svg/uk.svg b/assets/svg/uk.svg
new file mode 100644
index 0000000..88e2211
--- /dev/null
+++ b/assets/svg/uk.svg
@@ -0,0 +1,23 @@
+
+
+
\ No newline at end of file
diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj
index 6d459c8..ee74416 100644
--- a/ios/Runner.xcodeproj/project.pbxproj
+++ b/ios/Runner.xcodeproj/project.pbxproj
@@ -427,7 +427,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
+ ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = AppIcon;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
@@ -484,7 +484,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
+ ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = AppIcon;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
index dc9ada4..a32d3f3 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
index 7353c41..6a6d521 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
index 797d452..14aefdc 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
index 6ed2d93..dc97fc2 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
index 4cd7b00..a0cd80b 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
index fe73094..60640d5 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
index 321773c..3698012 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
index 797d452..14aefdc 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
index 502f463..a45c882 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
index 0ec3034..d3534c5 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
index 0ec3034..d3534c5 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
index e9f5fea..a62d024 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
index 84ac32a..f85b087 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
index 8953cba..74ad29b 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
index 0467bf1..aae1151 100644
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ
diff --git a/l10n.yaml b/l10n.yaml
new file mode 100644
index 0000000..d26d702
--- /dev/null
+++ b/l10n.yaml
@@ -0,0 +1,6 @@
+arb-dir: l10n
+template-arb-file: app_ru.arb
+output-localization-file: app_locale.dart
+output-dir: lib/components/locale/l10n
+output-class: AppLocale
+synthetic-package: false
\ No newline at end of file
diff --git a/l10n/app_en.arb b/l10n/app_en.arb
new file mode 100644
index 0000000..6389d4f
--- /dev/null
+++ b/l10n/app_en.arb
@@ -0,0 +1,7 @@
+{
+ "@@locale": "en",
+
+ "cardLiked": "Card added to your favorite :)",
+ "cardDisliked": "Card deleted from favourite :(",
+ "searchInputPlaceholder": "Search .."
+}
\ No newline at end of file
diff --git a/l10n/app_ru.arb b/l10n/app_ru.arb
new file mode 100644
index 0000000..61019d3
--- /dev/null
+++ b/l10n/app_ru.arb
@@ -0,0 +1,7 @@
+{
+ "@@locale": "ru",
+
+ "cardLiked": "Добавлено в понравившиеся :)",
+ "cardDisliked": "Удалено из понравившегося :(",
+ "searchInputPlaceholder": "Поиск .."
+}
diff --git a/lib/components/extensions/local_context_x.dart b/lib/components/extensions/local_context_x.dart
new file mode 100644
index 0000000..8e4a7af
--- /dev/null
+++ b/lib/components/extensions/local_context_x.dart
@@ -0,0 +1,6 @@
+import 'package:flutter/widgets.dart';
+import '../locale/l10n/app_locale.dart';
+
+extension LocalContextX on BuildContext {
+ AppLocale get locale => AppLocale.of(this)!;
+}
diff --git a/lib/utils/debounce.dart b/lib/components/utils/debounce.dart
similarity index 88%
rename from lib/utils/debounce.dart
rename to lib/components/utils/debounce.dart
index 8e44e39..0ea5615 100644
--- a/lib/utils/debounce.dart
+++ b/lib/components/utils/debounce.dart
@@ -15,8 +15,7 @@ class Debounce {
// Статический метод, где action функция, совершающая действие, а delay совершает задержку)
static void run(
- {required VoidCallback action,
- Duration delay = const Duration(milliseconds: 500)}) {
+ {required VoidCallback action, Duration delay = const Duration(milliseconds: 500)}) {
_timer?.cancel();
_timer = Timer(delay, action);
}
diff --git a/lib/data/dtos/houses_dto.dart b/lib/data/dtos/houses_dto.dart
index 8584634..a3f5e2e 100644
--- a/lib/data/dtos/houses_dto.dart
+++ b/lib/data/dtos/houses_dto.dart
@@ -12,8 +12,7 @@ class HousesDto {
const HousesDto({this.data, this.meta});
- factory HousesDto.fromJson(Map json) =>
- _$HousesDtoFromJson(json);
+ factory HousesDto.fromJson(Map json) => _$HousesDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
@@ -22,8 +21,7 @@ class MetaDto {
const MetaDto({this.pagination});
- factory MetaDto.fromJson(Map json) =>
- _$MetaDtoFromJson(json);
+ factory MetaDto.fromJson(Map json) => _$MetaDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
@@ -34,8 +32,7 @@ class PaginationDto {
const PaginationDto({this.current, this.last, this.next});
- factory PaginationDto.fromJson(Map json) =>
- _$PaginationDtoFromJson(json);
+ factory PaginationDto.fromJson(Map json) => _$PaginationDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
@@ -45,8 +42,7 @@ class HouseDataDto {
const HouseDataDto(this.id, this.attributes);
- factory HouseDataDto.fromJson(Map json) =>
- _$HouseDataDtoFromJson(json);
+ factory HouseDataDto.fromJson(Map json) => _$HouseDataDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
@@ -56,8 +52,7 @@ class HouseAttributesDataDto {
final String? image;
final String? description;
- HouseAttributesDataDto(
- this.name, this.location, this.image, this.description);
+ HouseAttributesDataDto(this.name, this.location, this.image, this.description);
factory HouseAttributesDataDto.fromJson(Map json) =>
_$HouseAttributesDataDtoFromJson(json);
diff --git a/lib/data/mapper/house_mapper.dart b/lib/data/mapper/house_mapper.dart
index 8b2b4df..052f573 100644
--- a/lib/data/mapper/house_mapper.dart
+++ b/lib/data/mapper/house_mapper.dart
@@ -4,15 +4,15 @@ import 'package:pmd/models/card_data.dart';
extension HouseDataDtoToModel on HouseDataDto {
CardData toDomain() => CardData(
+ id: id,
name: attributes?.name ?? "UNKNOWN",
location: attributes?.location ?? "UNKNOWN", // Безопасный доступ к location
- image: attributes?.image ?? "https://upload.wikimedia.org/wikipedia/commons/a/a2/Person_Image_Placeholder.png",
- description: attributes?.description ?? "UNKNOWN"
- );
+ image: attributes?.image ??
+ "https://upload.wikimedia.org/wikipedia/commons/a/a2/Person_Image_Placeholder.png",
+ description: attributes?.description ?? "UNKNOWN");
}
extension HousesDtoToModel on HousesDto {
- HomeData toDomain() => HomeData(
- data: data?.map((e) => e.toDomain()).toList(),
- nextPage: meta?.pagination?.next);
-}
\ No newline at end of file
+ HomeData toDomain() =>
+ HomeData(data: data?.map((e) => e.toDomain()).toList(), nextPage: meta?.pagination?.next);
+}
diff --git a/lib/data/repositories/api_interface.dart b/lib/data/repositories/api_interface.dart
index cd3cdbd..28035a2 100644
--- a/lib/data/repositories/api_interface.dart
+++ b/lib/data/repositories/api_interface.dart
@@ -3,5 +3,5 @@ import 'package:pmd/models/home_data.dart';
typedef OnErrorCallback = void Function(String? error);
abstract class ApiInterface {
- Future loadData ({OnErrorCallback? onError});
-}
\ No newline at end of file
+ Future loadData({OnErrorCallback? onError});
+}
diff --git a/lib/data/repositories/mock_repository.dart b/lib/data/repositories/mock_repository.dart
index 56c51c6..0318e22 100644
--- a/lib/data/repositories/mock_repository.dart
+++ b/lib/data/repositories/mock_repository.dart
@@ -6,26 +6,31 @@ class MockRepository extends ApiInterface {
// Список всех данных
final List allData = [
const CardData(
+ id: "0",
name: "house 0",
image: "https://cdn0.youla.io/files/images/780_780/63/29/6329d9f543eedb62b7695786-1.jpg",
location: "Moscow",
description: "description null"),
const CardData(
+ id: "1",
name: "house 1",
image: "https://cdn0.youla.io/files/images/780_780/63/29/6329d9f543eedb62b7695786-1.jpg",
location: "Samara",
description: "null"),
const CardData(
+ id: "2",
name: "house 2",
image: "https://cdn0.youla.io/files/images/780_780/63/29/6329d9f543eedb62b7695786-1.jpg",
location: "Moscow",
description: "house good, very good"),
const CardData(
+ id: "3",
name: "house 3",
image: "https://cdn0.youla.io/files/images/780_780/63/29/6329d9f543eedb62b7695786-1.jpg",
location: "Kazan",
description: "house good"),
const CardData(
+ id: "4",
name: "house 4",
image: "https://cdn0.youla.io/files/images/780_780/63/29/6329d9f543eedb62b7695786-1.jpg",
location: "Moscow",
@@ -39,7 +44,7 @@ class MockRepository extends ApiInterface {
int pageSize = 2, // Количество элементов на странице
List? currentData, // Текущие данные для динамического обновления
OnErrorCallback? onError,
-}) async {
+ }) async {
try {
// Симуляция задержки сети для динамического обновления
await Future.delayed(const Duration(seconds: 1));
@@ -55,7 +60,8 @@ class MockRepository extends ApiInterface {
// Убедитесь, что индекс не выходит за пределы списка
if (startIndex >= filteredData.length) {
- return HomeData(data: currentData ?? []); // Возвращаем текущие данные, если больше нет данных
+ return HomeData(
+ data: currentData ?? []); // Возвращаем текущие данные, если больше нет данных
}
// Извлекаем нужную страницу данных
@@ -75,4 +81,4 @@ class MockRepository extends ApiInterface {
return null;
}
}
-}
\ No newline at end of file
+}
diff --git a/lib/data/repositories/potter_repository.dart b/lib/data/repositories/potter_repository.dart
index 7180d8a..bcfb214 100644
--- a/lib/data/repositories/potter_repository.dart
+++ b/lib/data/repositories/potter_repository.dart
@@ -8,34 +8,23 @@ import 'package:pmd/data/repositories/api_interface.dart';
import 'package:pretty_dio_logger/pretty_dio_logger.dart';
class PotterRepository extends ApiInterface {
- static final Dio _dio = Dio(
- BaseOptions(connectTimeout: const Duration(seconds: 10)))
- ..interceptors.add(
- PrettyDioLogger(request: true, requestHeader: true, requestBody: true));
+ static final Dio _dio = Dio(BaseOptions(connectTimeout: const Duration(seconds: 10)))
+ ..interceptors.add(PrettyDioLogger(request: true, requestHeader: true, requestBody: true));
- static const String _baseUrl =
- "https://api.potterdb.com/v1"; // https://api.realtor.com/v1
+ static const String _baseUrl = "https://api.potterdb.com/v1"; // https://api.realtor.com/v1
@override
Future loadData(
- {OnErrorCallback? onError,
- String? q,
- int page = 1,
- int pageSize = 10}) async {
+ {OnErrorCallback? onError, String? q, int page = 1, int pageSize = 10}) async {
try {
const String url = '$_baseUrl/characters';
final Response response = await _dio.get