From e55b9b4bb279d1ce2950859b0e8ca11fba6799d5 Mon Sep 17 00:00:00 2001 From: mohamed3ly1997 Date: Sun, 26 May 2024 13:46:53 +0300 Subject: [PATCH] refactor --- lib/features/home/presentation/screens/home.dart | 5 ++--- .../domain/repositories/random_recipe_repository.dart | 0 .../domain/use_cases/random_recipe_usecase.dart | 3 +-- .../data_sources/random_recipe_data_source.dart | 2 +- .../data_sources/random_recipe_data_source_impl.dart | 3 +-- .../infrastructure/dto/recipe_model.dart | 0 .../infrastructure/dto/recipe_model.freezed.dart | 0 .../infrastructure/dto/recipe_model.g.dart | 0 .../repositories/random_recipe_repository_impl.dart | 2 +- .../presentation/providers/random_recipe_provider.dart | 2 +- .../presentation/widgets/recipe_item.dart | 0 lib/features/search/data_sources/search_data_source.dart | 0 .../search/data_sources/search_data_source_impl.dart | 0 13 files changed, 7 insertions(+), 10 deletions(-) rename lib/features/{recipe => random_drink}/domain/repositories/random_recipe_repository.dart (100%) rename lib/features/{recipe => random_drink}/domain/use_cases/random_recipe_usecase.dart (86%) rename lib/features/{recipe => random_drink}/infrastructure/data_sources/random_recipe_data_source.dart (76%) rename lib/features/{recipe => random_drink}/infrastructure/data_sources/random_recipe_data_source_impl.dart (81%) rename lib/features/{recipe => random_drink}/infrastructure/dto/recipe_model.dart (100%) rename lib/features/{recipe => random_drink}/infrastructure/dto/recipe_model.freezed.dart (100%) rename lib/features/{recipe => random_drink}/infrastructure/dto/recipe_model.g.dart (100%) rename lib/features/{recipe => random_drink}/infrastructure/repositories/random_recipe_repository_impl.dart (87%) rename lib/features/{recipe => random_drink}/presentation/providers/random_recipe_provider.dart (84%) rename lib/features/{recipe => random_drink}/presentation/widgets/recipe_item.dart (100%) create mode 100644 lib/features/search/data_sources/search_data_source.dart create mode 100644 lib/features/search/data_sources/search_data_source_impl.dart diff --git a/lib/features/home/presentation/screens/home.dart b/lib/features/home/presentation/screens/home.dart index 365bd85..33f6fa3 100644 --- a/lib/features/home/presentation/screens/home.dart +++ b/lib/features/home/presentation/screens/home.dart @@ -13,11 +13,10 @@ import 'package:recipes/features/drinks/presentation/screens/drinks_by_category. import 'package:recipes/features/home/presentation/widgets/common_row.dart'; import 'package:recipes/features/home/presentation/widgets/custom_app_bar.dart'; import 'package:recipes/features/home/presentation/widgets/custom_textfield.dart'; -import 'package:recipes/features/recipe/presentation/providers/random_recipe_provider.dart'; -import 'package:recipes/features/recipe/presentation/widgets/recipe_item.dart'; - import '../../../drinks/presentation/riverpod/drink_details/selected_drink_provider.dart'; import '../../../drinks/presentation/screens/drinkDetails.dart'; +import '../../../random_drink/presentation/providers/random_recipe_provider.dart'; +import '../../../random_drink/presentation/widgets/recipe_item.dart'; class HomeScreen extends ConsumerWidget { const HomeScreen({super.key}); diff --git a/lib/features/recipe/domain/repositories/random_recipe_repository.dart b/lib/features/random_drink/domain/repositories/random_recipe_repository.dart similarity index 100% rename from lib/features/recipe/domain/repositories/random_recipe_repository.dart rename to lib/features/random_drink/domain/repositories/random_recipe_repository.dart diff --git a/lib/features/recipe/domain/use_cases/random_recipe_usecase.dart b/lib/features/random_drink/domain/use_cases/random_recipe_usecase.dart similarity index 86% rename from lib/features/recipe/domain/use_cases/random_recipe_usecase.dart rename to lib/features/random_drink/domain/use_cases/random_recipe_usecase.dart index 7ae44dc..a833b24 100644 --- a/lib/features/recipe/domain/use_cases/random_recipe_usecase.dart +++ b/lib/features/random_drink/domain/use_cases/random_recipe_usecase.dart @@ -1,9 +1,8 @@ import 'package:dartz/dartz.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:recipes/features/recipe/domain/repositories/random_recipe_repository.dart'; - import '../../../../core/network/error_model.dart'; import '../../infrastructure/dto/recipe_model.dart'; +import '../repositories/random_recipe_repository.dart'; final randomRecipeUseCaseProvider = Provider( (ref) => RandomRecipeUseCase( diff --git a/lib/features/recipe/infrastructure/data_sources/random_recipe_data_source.dart b/lib/features/random_drink/infrastructure/data_sources/random_recipe_data_source.dart similarity index 76% rename from lib/features/recipe/infrastructure/data_sources/random_recipe_data_source.dart rename to lib/features/random_drink/infrastructure/data_sources/random_recipe_data_source.dart index c731f3d..2512002 100644 --- a/lib/features/recipe/infrastructure/data_sources/random_recipe_data_source.dart +++ b/lib/features/random_drink/infrastructure/data_sources/random_recipe_data_source.dart @@ -1,6 +1,6 @@ import 'package:dio/dio.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:recipes/features/recipe/infrastructure/data_sources/random_recipe_data_source_impl.dart'; +import 'package:recipes/features/random_drink/infrastructure/data_sources/random_recipe_data_source_impl.dart'; import '../../../../core/network/network.dart'; diff --git a/lib/features/recipe/infrastructure/data_sources/random_recipe_data_source_impl.dart b/lib/features/random_drink/infrastructure/data_sources/random_recipe_data_source_impl.dart similarity index 81% rename from lib/features/recipe/infrastructure/data_sources/random_recipe_data_source_impl.dart rename to lib/features/random_drink/infrastructure/data_sources/random_recipe_data_source_impl.dart index 380a91d..c735336 100644 --- a/lib/features/recipe/infrastructure/data_sources/random_recipe_data_source_impl.dart +++ b/lib/features/random_drink/infrastructure/data_sources/random_recipe_data_source_impl.dart @@ -1,6 +1,5 @@ import 'package:dio/dio.dart'; -import 'package:recipes/features/recipe/infrastructure/data_sources/random_recipe_data_source.dart'; - +import 'package:recipes/features/random_drink/infrastructure/data_sources/random_recipe_data_source.dart'; import '../../../../core/network/endpoints.dart'; import '../../../../core/network/rest_client.dart'; diff --git a/lib/features/recipe/infrastructure/dto/recipe_model.dart b/lib/features/random_drink/infrastructure/dto/recipe_model.dart similarity index 100% rename from lib/features/recipe/infrastructure/dto/recipe_model.dart rename to lib/features/random_drink/infrastructure/dto/recipe_model.dart diff --git a/lib/features/recipe/infrastructure/dto/recipe_model.freezed.dart b/lib/features/random_drink/infrastructure/dto/recipe_model.freezed.dart similarity index 100% rename from lib/features/recipe/infrastructure/dto/recipe_model.freezed.dart rename to lib/features/random_drink/infrastructure/dto/recipe_model.freezed.dart diff --git a/lib/features/recipe/infrastructure/dto/recipe_model.g.dart b/lib/features/random_drink/infrastructure/dto/recipe_model.g.dart similarity index 100% rename from lib/features/recipe/infrastructure/dto/recipe_model.g.dart rename to lib/features/random_drink/infrastructure/dto/recipe_model.g.dart diff --git a/lib/features/recipe/infrastructure/repositories/random_recipe_repository_impl.dart b/lib/features/random_drink/infrastructure/repositories/random_recipe_repository_impl.dart similarity index 87% rename from lib/features/recipe/infrastructure/repositories/random_recipe_repository_impl.dart rename to lib/features/random_drink/infrastructure/repositories/random_recipe_repository_impl.dart index fc3e8a3..289ce38 100644 --- a/lib/features/recipe/infrastructure/repositories/random_recipe_repository_impl.dart +++ b/lib/features/random_drink/infrastructure/repositories/random_recipe_repository_impl.dart @@ -1,6 +1,6 @@ import 'package:dartz/dartz.dart'; import 'package:recipes/core/core.dart'; -import 'package:recipes/features/recipe/domain/repositories/random_recipe_repository.dart'; +import '../../domain/repositories/random_recipe_repository.dart'; import '../data_sources/random_recipe_data_source.dart'; import '../dto/recipe_model.dart'; diff --git a/lib/features/recipe/presentation/providers/random_recipe_provider.dart b/lib/features/random_drink/presentation/providers/random_recipe_provider.dart similarity index 84% rename from lib/features/recipe/presentation/providers/random_recipe_provider.dart rename to lib/features/random_drink/presentation/providers/random_recipe_provider.dart index ae92dfe..3722440 100644 --- a/lib/features/recipe/presentation/providers/random_recipe_provider.dart +++ b/lib/features/random_drink/presentation/providers/random_recipe_provider.dart @@ -1,6 +1,6 @@ import 'dart:developer'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:recipes/features/recipe/domain/use_cases/random_recipe_usecase.dart'; +import '../../domain/use_cases/random_recipe_usecase.dart'; import '../../infrastructure/dto/recipe_model.dart'; final randomRecipeProvider = FutureProvider>( diff --git a/lib/features/recipe/presentation/widgets/recipe_item.dart b/lib/features/random_drink/presentation/widgets/recipe_item.dart similarity index 100% rename from lib/features/recipe/presentation/widgets/recipe_item.dart rename to lib/features/random_drink/presentation/widgets/recipe_item.dart diff --git a/lib/features/search/data_sources/search_data_source.dart b/lib/features/search/data_sources/search_data_source.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/features/search/data_sources/search_data_source_impl.dart b/lib/features/search/data_sources/search_data_source_impl.dart new file mode 100644 index 0000000..e69de29