From 25214d22a22d5eddef6cfc8ca32ee9b5c811499d Mon Sep 17 00:00:00 2001 From: Miller Adulu Date: Wed, 18 Sep 2024 20:38:27 +0300 Subject: [PATCH] Refactor search functionality to move closer to the usage area --- lib/bootstrap.dart | 2 +- lib/{search => features/home}/cubit/search_cubit.dart | 2 +- lib/{search => features/home}/cubit/search_state.dart | 1 + lib/features/home/ui/home_screen.dart | 2 +- lib/{search/ui => features/home}/widgets/search_bar.dart | 4 ++-- 5 files changed, 6 insertions(+), 5 deletions(-) rename lib/{search => features/home}/cubit/search_cubit.dart (96%) rename lib/{search => features/home}/cubit/search_state.dart (99%) rename lib/{search/ui => features/home}/widgets/search_bar.dart (97%) diff --git a/lib/bootstrap.dart b/lib/bootstrap.dart index 88051e5..349f0f8 100644 --- a/lib/bootstrap.dart +++ b/lib/bootstrap.dart @@ -21,10 +21,10 @@ import 'package:fluttercon/features/feed/cubit/share_feed_post_cubit.dart'; import 'package:fluttercon/features/feedback/cubit/send_feedback_cubit.dart'; import 'package:fluttercon/features/home/cubit/fetch_sessions_cubit.dart'; import 'package:fluttercon/features/home/cubit/home_cubits.dart'; +import 'package:fluttercon/features/home/cubit/search_cubit.dart'; import 'package:fluttercon/features/sessions/cubit/bookmark_session_cubit.dart'; import 'package:fluttercon/features/sessions/cubit/fetch_grouped_sessions_cubit.dart'; import 'package:fluttercon/firebase_options.dart'; -import 'package:fluttercon/search/cubit/search_cubit.dart'; class AppBlocObserver extends BlocObserver { const AppBlocObserver(); diff --git a/lib/search/cubit/search_cubit.dart b/lib/features/home/cubit/search_cubit.dart similarity index 96% rename from lib/search/cubit/search_cubit.dart rename to lib/features/home/cubit/search_cubit.dart index 726e65b..c7dcdac 100644 --- a/lib/search/cubit/search_cubit.dart +++ b/lib/features/home/cubit/search_cubit.dart @@ -3,7 +3,7 @@ import 'package:fluttercon/common/data/enums/search_result_type.dart'; import 'package:fluttercon/common/data/models/failure.dart'; import 'package:fluttercon/common/data/models/search_result.dart'; import 'package:fluttercon/common/repository/db_repository.dart'; -import 'package:fluttercon/search/cubit/search_state.dart'; +import 'package:fluttercon/features/home/cubit/search_state.dart'; class SearchCubit extends Cubit { SearchCubit({ diff --git a/lib/search/cubit/search_state.dart b/lib/features/home/cubit/search_state.dart similarity index 99% rename from lib/search/cubit/search_state.dart rename to lib/features/home/cubit/search_state.dart index 0a76f4d..e9bb8e0 100644 --- a/lib/search/cubit/search_state.dart +++ b/lib/features/home/cubit/search_state.dart @@ -1,5 +1,6 @@ import 'package:fluttercon/common/data/models/search_result.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; + part 'search_state.freezed.dart'; @freezed diff --git a/lib/features/home/ui/home_screen.dart b/lib/features/home/ui/home_screen.dart index 84f24eb..2d2feb6 100644 --- a/lib/features/home/ui/home_screen.dart +++ b/lib/features/home/ui/home_screen.dart @@ -3,11 +3,11 @@ import 'package:fluttercon/common/utils/constants/app_assets.dart'; import 'package:fluttercon/common/utils/misc.dart'; import 'package:fluttercon/common/widgets/app_bar/app_bar.dart'; import 'package:fluttercon/features/home/widgets/organizers_card.dart'; +import 'package:fluttercon/features/home/widgets/search_bar.dart'; import 'package:fluttercon/features/home/widgets/sessions_card.dart'; import 'package:fluttercon/features/home/widgets/speaker_home_card.dart'; import 'package:fluttercon/features/home/widgets/sponsors_card.dart'; import 'package:fluttercon/l10n/l10n.dart'; -import 'package:fluttercon/search/ui/widgets/search_bar.dart'; class HomeScreen extends StatefulWidget { const HomeScreen({super.key, this.switchTab}); diff --git a/lib/search/ui/widgets/search_bar.dart b/lib/features/home/widgets/search_bar.dart similarity index 97% rename from lib/search/ui/widgets/search_bar.dart rename to lib/features/home/widgets/search_bar.dart index e561fb0..3172067 100644 --- a/lib/search/ui/widgets/search_bar.dart +++ b/lib/features/home/widgets/search_bar.dart @@ -9,9 +9,9 @@ import 'package:fluttercon/common/utils/misc.dart'; import 'package:fluttercon/common/utils/router.dart'; import 'package:fluttercon/common/widgets/resolved_image.dart'; import 'package:fluttercon/core/theme/theme_colors.dart'; +import 'package:fluttercon/features/home/cubit/search_cubit.dart'; +import 'package:fluttercon/features/home/cubit/search_state.dart'; import 'package:fluttercon/l10n/l10n.dart'; -import 'package:fluttercon/search/cubit/search_cubit.dart'; -import 'package:fluttercon/search/cubit/search_state.dart'; import 'package:go_router/go_router.dart'; class SearchBarWidget extends StatefulWidget {