Repository: Learnathon-By-Geeky-Solutions/nstu-codebreakers
Pull request #19: Feature/home: Create and Fetch projects on home screen done
Author: login: Mahbub-Hasan-Talukder
Created: 2025-04-19T06:28:07Z | Merged: 2025-04-19T07:00:56Z



Diff:
diff --git a/task_hive/lib/core/di/di.dart b/task_hive/lib/core/di/di.dart
index 8954b58..4834331 100644
--- a/task_hive/lib/core/di/di.dart
+++ b/task_hive/lib/core/di/di.dart
@@ -15,6 +15,7 @@ import '''
 package:task_hive/features/home/data/data_source/remote/home_remote.dart''';
 import '''
 package:task_hive/features/home/data/data_source/remote/home_remote_imp.dart''';
+import 'package:task_hive/features/home/presentation/cubits/create_project/create_project_cubit.dart';
 
 import '../../features/auth/data/data_source/local/auth_local_imp.dart';
 import '../../features/auth/data/repository_impl/auth_reposity_impl.dart';
@@ -57,6 +58,8 @@ void setupLocator() {
       () => FetchProjectsCubit(getIt.call()));
   getIt.registerCachedFactory<FetchUserCubit>(
       () => FetchUserCubit(getIt.call()));
+  getIt.registerCachedFactory<CreateProjectCubit>(
+      () => CreateProjectCubit(getIt.call()));
 
   ///Register UseCases
   getIt.registerLazySingleton<OnboardingUseCase>(
@@ -69,6 +72,8 @@ void setupLocator() {
       () => FetchProjectsUseCase(getIt.call()));
   getIt.registerLazySingleton<FetchUserUseCase>(
       () => FetchUserUseCase(getIt.call()));
+  getIt.registerLazySingleton<CreateProjectUseCase>(
+      () => CreateProjectUseCase(getIt.call()));
 
   /// Register Repositories
   getIt.registerLazySingleton<OnboardingRepository>(
diff --git a/task_hive/lib/core/navigation/router_config.dart b/task_hive/lib/core/navigation/router_config.dart
index 09924be..04b586a 100644
--- a/task_hive/lib/core/navigation/router_config.dart
+++ b/task_hive/lib/core/navigation/router_config.dart
@@ -7,6 +7,7 @@ import 'package:task_hive/features/auth/presentation/screens/sign_up_screen.dart
 import 'package:task_hive/features/auth/presentation/screens/signin_screen.dart';
 import 'package:task_hive/features/home/domain/entities/home_user_entity.dart';
 import 'package:task_hive/features/home/presentation/screens/home_screen.dart';
+import 'package:task_hive/features/home/presentation/screens/projects_screen.dart';
 import 'package:task_hive/features/onboarding/presentation/screens/onboard_screen_1.dart';
 import 'package:task_hive/features/onboarding/presentation/screens/onboard_screen_2.dart';
 import 'package:task_hive/features/profile/presentation/screens/profile_screen.dart';
@@ -52,7 +53,7 @@ class MyRouterConfig {
               GoRoute(
                 path: MyRoutes.home,
                 builder: (context, state) {
-                  return const HomePage();
+                  return const ProjectsScreen();
                 },
               ),
             ],
diff --git a/task_hive/lib/core/services/auth_service/supabase_impl.dart b/task_hive/lib/core/services/auth_service/supabase_impl.dart
index 4b5ffc0..b579e37 100644
--- a/task_hive/lib/core/services/auth_service/supabase_impl.dart
+++ b/task_hive/lib/core/services/auth_service/supabase_impl.dart
@@ -5,7 +5,7 @@ import 'package:task_hive/core/services/auth_service/auth_service.dart';
 import '../../logger/logger.dart';
 
 class SupabaseImpl implements AuthService {
-  late final _client;
+  late final SupabaseClient _client;
 
   @override
   Future<void> init() async {
diff --git a/task_hive/lib/features/home/data/data_source/remote/home_remote_imp.dart b/task_hive/lib/features/home/data/data_source/remote/home_remote_imp.dart
index 89f5275..707beb4 100644
--- a/task_hive/lib/features/home/data/data_source/remote/home_remote_imp.dart
+++ b/task_hive/lib/features/home/data/data_source/remote/home_remote_imp.dart
@@ -12,9 +12,13 @@ class HomeRemoteImpl implements HomeRemote {
             supabaseClient ?? getIt<AuthService>().getSupabaseClient();
 
   @override
-  Future<void> addProject(Map<String, dynamic> project) {
-    // TODO: implement addProject
-    throw UnimplementedError();
+  Future<void> addProject(Map<String, dynamic> project) async {
+    try {
+      final response = await supabaseClient.from('projects').insert(project);
+      return response;
+    } catch (e) {
+      throw Exception('Error adding project: ${e.toString()}');
+    }
   }
 
   @override
diff --git a/task_hive/lib/features/home/data/models/project_model.dart b/task_hive/lib/features/home/data/models/project_model.dart
index 7a87505..b29b832 100644
--- a/task_hive/lib/features/home/data/models/project_model.dart
+++ b/task_hive/lib/features/home/data/models/project_model.dart
@@ -30,8 +30,8 @@ class ProjectModel {
       id: id,
       name: name,
       description: description,
-      createdAt: createdAt,
-      updatedAt: updatedAt,
+      createdAt: DateTime.tryParse(createdAt ?? '') ?? DateTime.now(),
+      updatedAt: DateTime.tryParse(updatedAt ?? '') ?? DateTime.now(),
       createdBy: createdBy,
     );
   }
diff --git a/task_hive/lib/features/home/data/repository_imp/home_repo_imp.dart b/task_hive/lib/features/home/data/repository_imp/home_repo_imp.dart
index db20e73..4a39076 100644
--- a/task_hive/lib/features/home/data/repository_imp/home_repo_imp.dart
+++ b/task_hive/lib/features/home/data/repository_imp/home_repo_imp.dart
@@ -1,4 +1,6 @@
 import 'package:dartz/dartz.dart';
+import 'package:task_hive/core/io/failure.dart';
+import 'package:task_hive/core/io/success.dart';
 import 'package:task_hive/features/home/data/data_source/local/home_local.dart';
 import 'package:task_hive/features/home/domain/entities/home_user_entity.dart';
 
@@ -12,12 +14,6 @@ class HomeRepositoryImpl implements HomeRepository {
   final HomeLocal _homeLocalDataSource;
   HomeRepositoryImpl(this._homeRemoteDataSource, this._homeLocalDataSource);
 
-  @override
-  Future<void> addProject(Map<String, dynamic> project) {
-    // TODO: implement addProject
-    throw UnimplementedError();
-  }
-
   @override
   Future<void> deleteProject(String id) {
     // TODO: implement deleteProject
@@ -46,16 +42,23 @@ class HomeRepositoryImpl implements HomeRepository {
   @override
   Future<Either<HomePageUserEntity, String>> fetchUser() async {
     try {
-      print('dbg before fetchUser');
       final userId = await _homeLocalDataSource.getUserId();
-      print('dbg after fetchUser $userId');
-
       final response = await _homeRemoteDataSource.fetchUser(userId);
-      print('dbg after fetchUser response $response');
       final user = HomePageUserEntity.fromJson(response);
       return Left(user);
     } catch (e) {
       return Right(e.toString());
     }
   }
+
+  @override
+  Future<Either<Success, Failure>> createProject(ProjectEntity project) async {
+    try {
+      await _homeRemoteDataSource.addProject(project.toJson());
+
+      return Left(Success('Project created successfully'));
+    } catch (e) {
+      return Right(Failure(e.toString()));
+    }
+  }
 }
diff --git a/task_hive/lib/features/home/domain/entities/project_entity.dart b/task_hive/lib/features/home/domain/entities/project_entity.dart
index b190b06..9269e00 100644
--- a/task_hive/lib/features/home/domain/entities/project_entity.dart
+++ b/task_hive/lib/features/home/domain/entities/project_entity.dart
@@ -2,16 +2,24 @@ class ProjectEntity {
   int? id;
   String? name;
   String? description;
-  String? createdAt;
-  String? updatedAt;
+  DateTime? createdAt;
+  DateTime? updatedAt;
   int? createdBy;
 
   ProjectEntity({
-    required this.id,
-    required this.name,
-    required this.description,
-    required this.createdAt,
-    required this.updatedAt,
-    required this.createdBy,
+    this.id,
+    this.name,
+    this.description,
+    this.createdAt,
+    this.updatedAt,
+    this.createdBy,
   });
+
+  Map<String, dynamic> toJson() {
+    return {
+      'name': name,
+      'description': description,
+      'created_by': createdBy,
+    };
+  }
 }
diff --git a/task_hive/lib/features/home/domain/repository/home_repository.dart b/task_hive/lib/features/home/domain/repository/home_repository.dart
index b64b89b..fc9a622 100644
--- a/task_hive/lib/features/home/domain/repository/home_repository.dart
+++ b/task_hive/lib/features/home/domain/repository/home_repository.dart
@@ -1,12 +1,14 @@
 import 'package:dartz/dartz.dart';
 import 'package:task_hive/features/home/domain/entities/home_user_entity.dart';
 
+import '../../../../core/io/failure.dart';
+import '../../../../core/io/success.dart';
 import '../entities/project_entity.dart';
 
 abstract class HomeRepository {
   Future<Either<HomePageUserEntity, String>> fetchUser();
   Future<Either<List<ProjectEntity?>, String>> fetchProject(int userId);
-  Future<void> addProject(Map<String, dynamic> project);
+  Future<Either<Success, Failure>> createProject(ProjectEntity project);
   Future<void> deleteProject(String id);
   Future<void> updateProject(Map<String, dynamic> project);
 }
diff --git a/task_hive/lib/features/home/domain/use_cases/home_use_cases.dart b/task_hive/lib/features/home/domain/use_cases/home_use_cases.dart
index ac2462f..2e1e811 100644
--- a/task_hive/lib/features/home/domain/use_cases/home_use_cases.dart
+++ b/task_hive/lib/features/home/domain/use_cases/home_use_cases.dart
@@ -1,6 +1,8 @@
 import 'package:dartz/dartz.dart';
-import 'package:task_hive/features/home/domain/entities/home_user_entity.dart';
 
+import '../../../../core/io/failure.dart';
+import '../../../../core/io/success.dart';
+import '../entities/home_user_entity.dart';
 import '../../../../core/base/use_case/base_use_case.dart';
 import '../../../../core/io/no_input.dart';
 import '../entities/project_entity.dart';
@@ -27,3 +29,14 @@ class FetchUserUseCase
     return await _projectRepository.fetchUser();
   }
 }
+
+class CreateProjectUseCase
+    extends BaseUseCase<ProjectEntity, Success, Failure> {
+  final HomeRepository _projectRepository;
+  CreateProjectUseCase(this._projectRepository);
+
+  @override
+  Future<Either<Success, Failure>> call(ProjectEntity input) async {
+    return await _projectRepository.createProject(input);
+  }
+}
diff --git a/task_hive/lib/features/home/presentation/cubits/create_project/create_project_cubit.dart b/task_hive/lib/features/home/presentation/cubits/create_project/create_project_cubit.dart
new file mode 100644
index 0000000..6fdbea9
--- /dev/null
+++ b/task_hive/lib/features/home/presentation/cubits/create_project/create_project_cubit.dart
@@ -0,0 +1,24 @@
+import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:task_hive/core/io/failure.dart';
+import 'package:task_hive/features/home/domain/entities/project_entity.dart';
+import 'package:task_hive/features/home/domain/use_cases/home_use_cases.dart';
+
+import 'create_project_state.dart';
+
+class CreateProjectCubit extends Cubit<CreateProjectState> {
+  final CreateProjectUseCase _createProjectUseCase;
+  CreateProjectCubit(this._createProjectUseCase)
+      : super(CreateProjectInitial());
+  void createProject(ProjectEntity project) async {
+    emit(CreateProjectLoading());
+    try {
+      final res = await _createProjectUseCase.call(project);
+      res.fold(
+        (l) => emit(CreateProjectSuccess(success: l)),
+        (r) => emit(CreateProjectFailure(failure: r)),
+      );
+    } catch (e) {
+      emit(CreateProjectFailure(failure: Failure(e.toString())));
+    }
+  }
+}
diff --git a/task_hive/lib/features/home/presentation/cubits/create_project/create_project_state.dart b/task_hive/lib/features/home/presentation/cubits/create_project/create_project_state.dart
new file mode 100644
index 0000000..a6e1c3b
--- /dev/null
+++ b/task_hive/lib/features/home/presentation/cubits/create_project/create_project_state.dart
@@ -0,0 +1,27 @@
+import 'package:equatable/equatable.dart';
+
+import '../../../../../core/io/failure.dart';
+import '../../../../../core/io/success.dart';
+
+class CreateProjectState extends Equatable {
+  @override
+  List<Object?> get props => [];
+}
+
+class CreateProjectInitial extends CreateProjectState {}
+
+class CreateProjectLoading extends CreateProjectState {}
+
+class CreateProjectSuccess extends CreateProjectState {
+  final Success success;
+  CreateProjectSuccess({required this.success});
+  @override
+  List<Object?> get props => [success];
+}
+
+class CreateProjectFailure extends CreateProjectState {
+  final Failure failure;
+  CreateProjectFailure({required this.failure});
+  @override
+  List<Object?> get props => [failure];
+}
diff --git a/task_hive/lib/features/home/presentation/screens/dashboard_screen.dart b/task_hive/lib/features/home/presentation/screens/dashboard_screen.dart
index 12d03e4..df4a8c5 100644
--- a/task_hive/lib/features/home/presentation/screens/dashboard_screen.dart
+++ b/task_hive/lib/features/home/presentation/screens/dashboard_screen.dart
@@ -1,13 +1,14 @@
 import 'package:flutter/material.dart';
-import 'package:logger/logger.dart';
 import 'package:task_hive/features/home/presentation/widgets/priority_task_card.dart';
 import 'package:task_hive/features/home/presentation/widgets/upcoming_delivery_card.dart';
 
+import '../../domain/entities/project_entity.dart';
 import '../../domain/entity/project_info.dart';
 // import 'package:intl/intl.dart';
 
 class HomePage extends StatefulWidget {
-  const HomePage({super.key});
+  final ProjectEntity? projectEntity;
+  const HomePage({super.key, this.projectEntity});
 
   @override
   State<HomePage> createState() => _HomePageState();
diff --git a/task_hive/lib/features/home/presentation/screens/projects_screen.dart b/task_hive/lib/features/home/presentation/screens/projects_screen.dart
index 613446e..85f5fee 100644
--- a/task_hive/lib/features/home/presentation/screens/projects_screen.dart
+++ b/task_hive/lib/features/home/presentation/screens/projects_screen.dart
@@ -1,14 +1,75 @@
 import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:task_hive/core/extensions/app_extension.dart';
 
-class ProjectsScreen extends StatelessWidget {
+import '../../../../core/di/di.dart';
+import '../../domain/entities/home_user_entity.dart';
+import '../../domain/entities/project_entity.dart';
+import '../cubits/create_project/create_project_cubit.dart';
+import '../cubits/create_project/create_project_state.dart';
+import '../cubits/fetch_projects/fetch_projects_cubit.dart';
+import '../cubits/fetch_projects/fetch_projects_state.dart';
+import '../cubits/fetch_user/fetch_user_cubit.dart';
+import '../cubits/fetch_user/fetch_user_state.dart';
+
+class ProjectsScreen extends StatefulWidget {
   const ProjectsScreen({super.key});
 
+  @override
+  State<ProjectsScreen> createState() => _ProjectsScreenState();
+}
+
+class _ProjectsScreenState extends State<ProjectsScreen> {
+  final _fetchProjectCubit = getIt.get<FetchProjectsCubit>();
+  final _fetchUserCubit = getIt.get<FetchUserCubit>();
+  final _createProjectCubit = getIt.get<CreateProjectCubit>();
+
+  @override
+  void initState() {
+    _fetchUserCubit.fetchUser();
+    super.initState();
+  }
+
+  @override
+  void dispose() {
+    _fetchProjectCubit.close();
+    _fetchUserCubit.close();
+    _createProjectCubit.close();
+    super.dispose();
+  }
+
   @override
   Widget build(BuildContext context) {
     final colorScheme = Theme.of(context).colorScheme;
     final textTheme = Theme.of(context).textTheme;
+    HomePageUserEntity? _userData;
     return Scaffold(
-      backgroundColor: Colors.white,
+      floatingActionButton: SizedBox(
+        height: 60,
+        width: 60,
+        child: IconButton(
+          style: ButtonStyle(
+            backgroundColor: WidgetStatePropertyAll(colorScheme.primary),
+            shape: WidgetStatePropertyAll(
+              RoundedRectangleBorder(
+                borderRadius: BorderRadius.circular(16.0),
+              ),
+            ),
+          ),
+          onPressed: () {
+            showModalBottomSheet(
+              context: context,
+              isScrollControlled: true,
+              builder: (context) => CreateProjectBottomSheet(
+                createProjectCubit: _createProjectCubit,
+                userData: _userData,
+                fetchProjectsCubit: _fetchProjectCubit,
+              ),
+            );
+          },
+          icon: Icon(Icons.add, color: colorScheme.surface),
+        ),
+      ),
       body: SafeArea(
         child: Column(
           crossAxisAlignment: CrossAxisAlignment.start,
@@ -19,41 +80,79 @@ class ProjectsScreen extends StatelessWidget {
               child: Column(
                 crossAxisAlignment: CrossAxisAlignment.start,
                 children: [
+                  BlocBuilder<FetchUserCubit, FetchUserState>(
+                    bloc: _fetchUserCubit,
+                    builder: (context, state) {
+                      if (state is FetchUserLoading) {
+                        return const CircularProgressIndicator(
+                          color: Colors.blue,
+                        );
+                      } else if (state is FetchUserSuccess) {
+                        _fetchProjectCubit.fetchProjects(
+                            userId: state.userData.userId ?? 0);
+                        _userData = state.userData;
+                        // return Text(
+                        //   'Welcome ${state.userData.name}',
+                        //   style: textTheme.textxlRegular,
+                        // );
+                        return const SizedBox.shrink();
+                      } else if (state is FetchUserFailed) {
+                        return Text('Error: ${state.error}');
+                      }
+                      return const SizedBox.shrink();
+                    },
+                  ),
                   Text(
                     'Recent Projects',
-                    style: textTheme.titleMedium
-                        ?.copyWith(color: colorScheme.primary),
+                    style: textTheme.textxlMedium
+                        .copyWith(color: colorScheme.primary),
                   ),
-                  const SizedBox(height: 16),
-                  ListView.builder(
-                    shrinkWrap: true,
-                    physics: const NeverScrollableScrollPhysics(),
-                    itemCount: 5,
-                    // Replace with the actual number of recent projects
-                    itemBuilder: (context, index) {
-                      return const Column(
-                        children: [
-                          RecentProjectsCard(),
-                          SizedBox(height: 8),
-                        ],
-                      );
-                    },
+                  Divider(
+                    color: colorScheme.tertiary,
+                    height: 1,
                   ),
-                  const SizedBox(height: 20),
-                  Center(
-                    child: ElevatedButton(
-                      onPressed: () {
-                        // Add your button action here
-                        showModalBottomSheet(
-                          context: context,
-                          isScrollControlled: true,
-                          builder: (context) =>
-                              const CreateProjectBottomSheet(),
-                        );
-                      },
-                      child: const Text('Create New Project'),
+                  const SizedBox(height: 16),
+                  SingleChildScrollView(
+                    child: Column(
+                      children: [
+                        BlocBuilder<FetchProjectsCubit, FetchProjectsState>(
+                          bloc: _fetchProjectCubit,
+                          builder: (context, state) {
+                            if (state is FetchProjectsLoading) {
+                              return const Center(
+                                child: CircularProgressIndicator(
+                                  color: Colors.blue,
+                                ),
+                              );
+                            } else if (state is FetchProjectsSuccess) {
+                              if (state.projects.isEmpty) {
+                                return const Center(
+                                  child: Text('No projects found'),
+                                );
+                              }
+                              return ListView.builder(
+                                shrinkWrap: true,
+                                physics: const NeverScrollableScrollPhysics(),
+                                itemCount: state.projects.length,
+                                itemBuilder: (context, index) {
+                                  final project = state.projects[index];
+                                  return Padding(
+                                    padding: const EdgeInsets.symmetric(
+                                        vertical: 8.0),
+                                    child: RecentProjectsCard(project: project),
+                                  );
+                                },
+                              );
+                            } else if (state is FetchProjectsFailed) {
+                              return Text('Error: ${state.error}');
+                            }
+                            return const SizedBox.shrink();
+                          },
+                        ),
+                      ],
                     ),
                   ),
+                  const SizedBox(height: 20),
                 ],
               ),
             ),
@@ -65,7 +164,8 @@ class ProjectsScreen extends StatelessWidget {
 }
 
 class RecentProjectsCard extends StatelessWidget {
-  const RecentProjectsCard({super.key});
+  final ProjectEntity? project;
+  const RecentProjectsCard({super.key, required this.project});
 
   @override
   Widget build(BuildContext context) {
@@ -99,14 +199,14 @@ class RecentProjectsCard extends StatelessWidget {
               crossAxisAlignment: CrossAxisAlignment.start,
               children: [
                 Text(
-                  'Project Name',
+                  project?.name ?? 'N/A',
                   style: textTheme.titleMedium?.copyWith(
                     color: colorScheme.secondary,
                   ),
                 ),
                 const SizedBox(height: 2),
                 Text(
-                  'Project Description : Well done Phillip, you have completed all the tasks for',
+                  project?.description ?? 'N/A',
                   style: textTheme.bodyMedium?.copyWith(
                     color: colorScheme.onSurface.withOpacity(0.6),
                   ),
@@ -122,10 +222,19 @@ class RecentProjectsCard extends StatelessWidget {
 }
 
 class CreateProjectBottomSheet extends StatefulWidget {
-  const CreateProjectBottomSheet({super.key});
+  final CreateProjectCubit? createProjectCubit;
+  final FetchProjectsCubit? fetchProjectsCubit;
+  final HomePageUserEntity? userData;
+  const CreateProjectBottomSheet({
+    super.key,
+    this.createProjectCubit,
+    this.userData,
+    this.fetchProjectsCubit,
+  });
 
   @override
-  State<CreateProjectBottomSheet> createState() => _CreateProjectBottomSheetState();
+  State<CreateProjectBottomSheet> createState() =>
+      _CreateProjectBottomSheetState();
 }
 
 class _CreateProjectBottomSheetState extends State<CreateProjectBottomSheet> {
@@ -199,11 +308,35 @@ class _CreateProjectBottomSheetState extends State<CreateProjectBottomSheet> {
                   if (_formKey.currentState!.validate()) {
                     final title = titleController.text.trim();
                     final description = descriptionController.text.trim();
-                    print('Title: $title, Description: $description');
-                    Navigator.pop(context);
+                    widget.createProjectCubit?.createProject(
+                      ProjectEntity(
+                        name: title,
+                        description: description,
+                        createdBy: widget.userData?.userId ?? 0,
+                      ),
+                    );
                   }
                 },
-                child: const Text('Submit'),
+                child: BlocBuilder<CreateProjectCubit, CreateProjectState>(
+                  bloc: widget.createProjectCubit,
+                  builder: (context, state) {
+                    if (state is CreateProjectLoading) {
+                      return const CircularProgressIndicator(
+                        color: Colors.white,
+                      );
+                    } else if (state is CreateProjectSuccess) {
+                      widget.fetchProjectsCubit?.fetchProjects(
+                        userId: widget.userData?.userId ?? 0,
+                      );
+                      _showSnackBar(state.success.message);
+                      Navigator.pop(context);
+                    }
+                    if (state is CreateProjectFailure) {
+                      _showSnackBar(state.failure.message);
+                    }
+                    return const Text('Submit');
+                  },
+                ),
               ),
             ),
           ],
@@ -211,5 +344,16 @@ class _CreateProjectBottomSheetState extends State<CreateProjectBottomSheet> {
       ),
     );
   }
-}
 
+  ///show snackbar
+  void _showSnackBar(String message) {
+    WidgetsBinding.instance.addPostFrameCallback((_) {
+      ScaffoldMessenger.of(context).showSnackBar(
+        SnackBar(
+          content: Text(message),
+          duration: const Duration(seconds: 2),
+        ),
+      );
+    });
+  }
+}


Reviews:
user: login: coderabbitai[bot]
body: **Actionable comments posted: 7**

<details>
<summary>🔭 Outside diff range comments (1)</summary><blockquote>

<details>
<summary>task_hive/lib/features/home/presentation/screens/projects_screen.dart (1)</summary><blockquote>

`240-244`: _🛠️ Refactor suggestion_

**Beep‑boop: Dispose your `TextEditingController`s**

Un‑disposed controllers leak memory when the bottom sheet is closed.

```diff
class _CreateProjectBottomSheetState extends State<CreateProjectBottomSheet> {
   final TextEditingController titleController       = TextEditingController();
   final TextEditingController descriptionController = TextEditingController();
   final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
+
+  @override
+  void dispose() {
+    titleController.dispose();
+    descriptionController.dispose();
+    super.dispose();
+  }
```

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: ASSERTIVE**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between e796e4318561162fca2affb677d2da2a8714060b and 428f9e86b1a721199692afc18572878e6b32ef62.

</details>

<details>
<summary>📒 Files selected for processing (12)</summary>

* `task_hive/lib/core/di/di.dart` (3 hunks)
* `task_hive/lib/core/navigation/router_config.dart` (2 hunks)
* `task_hive/lib/core/services/auth_service/supabase_impl.dart` (1 hunks)
* `task_hive/lib/features/home/data/data_source/remote/home_remote_imp.dart` (1 hunks)
* `task_hive/lib/features/home/data/models/project_model.dart` (1 hunks)
* `task_hive/lib/features/home/data/repository_imp/home_repo_imp.dart` (2 hunks)
* `task_hive/lib/features/home/domain/entities/project_entity.dart` (1 hunks)
* `task_hive/lib/features/home/domain/repository/home_repository.dart` (1 hunks)
* `task_hive/lib/features/home/domain/use_cases/home_use_cases.dart` (2 hunks)
* `task_hive/lib/features/home/presentation/cubits/create_project/create_project_cubit.dart` (1 hunks)
* `task_hive/lib/features/home/presentation/cubits/create_project/create_project_state.dart` (1 hunks)
* `task_hive/lib/features/home/presentation/screens/projects_screen.dart` (6 hunks)

</details>

<details>
<summary>🔇 Additional comments (12)</summary><blockquote>

<details>
<summary>task_hive/lib/core/navigation/router_config.dart (1)</summary>

`10-10`: **ROUTE MODIFICATION DETECTED: ROUTING CONFIGURATION UPDATED**

ANALYSIS: HOME ROUTE NOW REDIRECTS TO PROJECTS-SCREEN INSTEAD OF PREVIOUS COMPONENT. THIS MODIFICATION ALIGNS WITH PRIMARY OBJECTIVE OF INTEGRATING PROJECT-CREATION-FUNCTIONALITY ON HOME-SCREEN.

CONCLUSION: CHANGE IS LOGICAL AND INTEGRATES CORRECTLY WITH NEW FEATURE SET.



Also applies to: 56-56

</details>
<details>
<summary>task_hive/lib/core/services/auth_service/supabase_impl.dart (1)</summary>

`8-8`: **TYPE ANNOTATION ADDED: IMPROVED CODE QUALITY DETECTED**

TYPE-SPECIFICATION FOR _client VARIABLE NOW EXPLICIT. EXPLICIT TYPE ANNOTATIONS = SUPERIOR CODE READABILITY + IMPROVED COMPILER TYPE-CHECKING.

RECOMMENDATION: CONTINUE ADDING EXPLICIT TYPE ANNOTATIONS THROUGHOUT CODEBASE.

</details>
<details>
<summary>task_hive/lib/features/home/data/models/project_model.dart (1)</summary>

`33-34`: **DATE CONVERSION LOGIC ENHANCED: TYPE SAFETY IMPROVED**

MODIFICATION TRANSFORMS STRING TIMESTAMPS INTO DATETIME OBJECTS WITH FALLBACK MECHANISM. UPGRADE PROVIDES:
1. STRUCTURED TYPE-SAFE DATE HANDLING
2. ROBUST NULL-VALUE PROTECTION
3. ALIGNMENT WITH DOMAIN ENTITY EXPECTATIONS

THIS CHANGE = CRITICAL FOR PROJECT-CREATION FEATURE FUNCTIONALITY.

</details>
<details>
<summary>task_hive/lib/features/home/domain/repository/home_repository.dart (1)</summary>

`4-5`: **REPOSITORY INTERFACE UPGRADED: DOMAIN-DRIVEN DESIGN PATTERN DETECTED**

FUNCTION SIGNATURE MODIFICATION PROVIDES CRITICAL ENHANCEMENTS:
1. MAP<STRING,DYNAMIC> REPLACED WITH STRONGLY-TYPED PROJECT-ENTITY
2. RETURN TYPE NOW USES EITHER<SUCCESS,FAILURE> FOR SUPERIOR ERROR HANDLING
3. IMPORTS ADDED TO SUPPORT NEW TYPE SYSTEM

THIS ARCHITECTURAL IMPROVEMENT SIGNIFICANTLY ENHANCES:
- TYPE SAFETY
- ERROR HANDLING
- CODE READABILITY
- TESTABILITY

OBSERVATION: CHANGE ALIGNS WITH FUNCTIONAL PROGRAMMING PRINCIPLES.



Also applies to: 11-11

</details>
<details>
<summary>task_hive/lib/core/di/di.dart (3)</summary>

`18-18`: **IMPORT DETECTED: CREATE-PROJECT-CUBIT IMPORTED SUCCESSFULLY**

IMPORT STATEMENT ADDED FOR NEW FUNCTIONALITY: CREATE-PROJECT-CUBIT. THIS SUPPORTS PROJECT CREATION WORKFLOW.

---

`61-62`: **REGISTERING CREATE-PROJECT-CUBIT: INITIALIZATION SEQUENCE ACTIVATED**

CACHED-FACTORY REGISTRATION PATTERN MATCHES OTHER CUBITS. APPROPRIATE DEPENDENCY INJECTION METHODOLOGY DETECTED.

---

`75-76`: **USE-CASE REGISTRATION: CREATE-PROJECT-USE-CASE INITIALIZED**

LAZY-SINGLETON PATTERN DETECTED. OPTIMAL MEMORY USAGE CONFIRMED.

</details>
<details>
<summary>task_hive/lib/features/home/domain/entities/project_entity.dart (3)</summary>

`5-6`: **TYPE IMPROVEMENT DETECTED: STRING TO DATETIME CONVERSION**

TIMESTAMP FIELDS NOW UTILIZE DATETIME TYPE. ENHANCED TYPE SAFETY ACHIEVED.

---

`10-16`: **CONSTRUCTOR PARAMETERS OPTIMIZATION DETECTED**

PARAMETERS CHANGED FROM REQUIRED TO OPTIONAL. FLEXIBILITY INCREASED FOR ENTITY INSTANTIATION.

---

`18-24`: **SERIALIZATION FUNCTION ADDED: TOJSON METHOD**

FUNCTION SERIALIZES SUBSET OF FIELDS FOR DATABASE INSERTION. ID, CREATEDAT, UPDATEDAT FIELDS EXCLUDED AS EXPECTED FOR SERVER-MANAGED FIELDS.

</details>
<details>
<summary>task_hive/lib/features/home/domain/use_cases/home_use_cases.dart (1)</summary>

`2-3`: **IMPORTS ADDED: FAILURE AND SUCCESS TYPE DEFINITIONS**

IMPORTS SUPPORT NEW USE-CASE ERROR HANDLING PATTERN. FOLLOWS FUNCTIONAL PROGRAMMING PARADIGM WITH EITHER TYPE.

</details>
<details>
<summary>task_hive/lib/features/home/presentation/cubits/create_project/create_project_state.dart (1)</summary>

`1-27`: **Beep‑boop: State file looks solid**

The equatable states are minimal and correct. No issues detected.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: NONE
submitted_at: 2025-04-19T06:30:51Z
user: login: coderabbitai[bot]
body: **Actionable comments posted: 2**

<details>
<summary>🔭 Outside diff range comments (2)</summary><blockquote>

<details>
<summary>task_hive/lib/features/home/presentation/screens/dashboard_screen.dart (2)</summary><blockquote>

`56-166`: _🛠️ Refactor suggestion_

**BUILD METHOD REQUIRES UPDATES.**

BUILD METHOD DOES NOT UTILIZE NEWLY ADDED PROJECTENTITY PARAMETER. RECOMMEND IMPLEMENTING CONDITIONAL RENDERING BASED ON PROJECT DATA.

```diff
  @override
  Widget build(BuildContext context) {
    final now = DateTime.now();
    final colorScheme = Theme.of(context).colorScheme;
    final textTheme = Theme.of(context).textTheme;
    final formattedDate = _formatDate(now);

+   // Display project-specific information if available
+   final projectTitle = widget.projectEntity?.name ?? 'Welcome Phillip';
+   final projectDescription = widget.projectEntity?.description ?? 'Have a nice day!';

    return Scaffold(
        body: SafeArea(
      child: Padding(
        padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            // Date and notification
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text(
                  formattedDate,
                  style: TextStyle(
                    color: Colors.grey[600],
                    fontSize: 14,
                  ),
                ),
                const Icon(
                  Icons.notifications,
                  color: Colors.blue,
                  size: 24,
                ),
              ],
            ),
            const SizedBox(height: 20),

            // Welcome message
-           Text('Welcome Phillip',
+           Text(projectTitle,
                style: textTheme.displaySmall
                    ?.copyWith(color: colorScheme.onSurface)),
-           Text('Have a nice day!', style: textTheme.bodyLarge),
+           Text(projectDescription, style: textTheme.bodyLarge),
            const SizedBox(height: 20),
```

---

`1-198`: _🧹 Nitpick (assertive)_

**ARCHITECTURE RECOMMENDATION FOR BLOC IMPLEMENTATION.**

CURRENT CODE USES STATEFUL WIDGET WITH LOCAL STATE MANAGEMENT. RECOMMEND MIGRATING TO BLOC PATTERN FOR CONSISTENCY WITH PROJECT ARCHITECTURE.


SUGGESTED IMPLEMENTATION:
1. CREATE PROJECT BLOC/CUBIT TO HANDLE PROJECT DATA
2. WRAP WIDGET WITH BLOCBUILDER/BLOCPROVIDER
3. REPLACE DIRECT STATE MANAGEMENT WITH BLOC EVENTS/STATES
4. USE PROJECT DATA FROM BLOC STATE INSTEAD OF DIRECT PROPS

THIS WILL ALIGN WITH THE ARCHITECTURE USED IN OTHER PARTS OF THE APPLICATION AND IMPROVE MAINTAINABILITY.

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: ASSERTIVE**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 428f9e86b1a721199692afc18572878e6b32ef62 and f2dae4890e99adcc4f6fe2fd29aa9fbcdd6e417b.

</details>

<details>
<summary>📒 Files selected for processing (5)</summary>

* `task_hive/lib/features/home/data/data_source/remote/home_remote_imp.dart` (1 hunks)
* `task_hive/lib/features/home/data/repository_imp/home_repo_imp.dart` (2 hunks)
* `task_hive/lib/features/home/domain/use_cases/home_use_cases.dart` (2 hunks)
* `task_hive/lib/features/home/presentation/cubits/create_project/create_project_cubit.dart` (1 hunks)
* `task_hive/lib/features/home/presentation/screens/dashboard_screen.dart` (1 hunks)

</details>

<details>
<summary>🔇 Additional comments (5)</summary><blockquote>

<details>
<summary>task_hive/lib/features/home/data/data_source/remote/home_remote_imp.dart (1)</summary>

`15-21`: **REMOTE DATA SOURCE METHOD IMPLEMENTED CORRECTLY.**

METHOD SUCCESSFULLY EXECUTES INSERT OPERATION INTO SUPABASE DATABASE TABLE 'projects'. ERROR HANDLING IMPLEMENTED WITH DESCRIPTIVE EXCEPTION MESSAGE. RETURN TYPE MATCHES INTERFACE REQUIREMENTS.

</details>
<details>
<summary>task_hive/lib/features/home/domain/use_cases/home_use_cases.dart (1)</summary>

`33-42`: **USE-CASE IMPLEMENTATION SATISFIES CLEAN ARCHITECTURE REQUIREMENTS.**

CORRECT INHERITANCE FROM BASE-USE-CASE WITH APPROPRIATE TYPE PARAMETERS. USE-CASE PROPERLY DELEGATES TO REPOSITORY LAYER AND MAINTAINS CONSISTENT RETURN TYPE OF Either<Success, Failure>. CODE STRUCTURE FOLLOWS ESTABLISHED PROJECT PATTERNS.

</details>
<details>
<summary>task_hive/lib/features/home/data/repository_imp/home_repo_imp.dart (1)</summary>

`54-63`: **REPOSITORY IMPLEMENTATION CONFORMS TO EXPECTED PATTERN.**

METHOD CORRECTLY IMPLEMENTS INTERFACE CONTRACT WITH PROPER ERROR HANDLING AND CONSISTENT TYPES. SUCCESS AND FAILURE CASES PROPERLY WRAPPED IN Either TYPE AS PER PROJECT CONVENTION.

PREVIOUS DEBUG PRINT STATEMENTS HAVE BEEN REMOVED AS RECOMMENDED IN EARLIER REVIEW.

</details>
<details>
<summary>task_hive/lib/features/home/presentation/cubits/create_project/create_project_cubit.dart (1)</summary>

`8-24`: **CUBIT IMPLEMENTATION FOLLOWS BLOC PATTERN STANDARDS.**

IMPLEMENTATION PROPERLY MANAGES STATE TRANSITIONS WITH APPROPRIATE ERROR HANDLING. RECOMMENDED ASYNC APPROACH ADOPTED PER PREVIOUS CODE REVIEW SUGGESTION.

STATE MANAGEMENT IS CLEAN AND PREDICTABLE WITH PROPER INITIALIZATION, LOADING, SUCCESS, AND FAILURE STATES.

</details>
<details>
<summary>task_hive/lib/features/home/presentation/screens/dashboard_screen.dart (1)</summary>

`5-5`: **IMPORT STATEMENT ADDED SUCCESSFULLY.**

PROCESSING IMPORT OF PROJECT_ENTITY. FUNCTIONALITY EXPANSION DETECTED.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: NONE
submitted_at: 2025-04-19T07:00:44Z

Review comments:
diff_hunk: @@ -12,9 +12,15 @@ class HomeRemoteImpl implements HomeRemote {
             supabaseClient ?? getIt<AuthService>().getSupabaseClient();
 
   @override
-  Future<void> addProject(Map<String, dynamic> project) {
-    // TODO: implement addProject
-    throw UnimplementedError();
+  Future<void> addProject(Map<String, dynamic> project) async {
+    try {
+      print('dbg project: $project');
+      final response = await supabaseClient.from('projects').insert(project);
+      print('dbg response: $response');
+      return response;
+    } catch (e) {
+      throw Exception('Error adding project: ${e.toString()}');
+    }
path: task_hive/lib/features/home/data/data_source/remote/home_remote_imp.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**REMOTE DATA SOURCE IMPLEMENTATION COMPLETED: ADD-PROJECT FUNCTION**

IMPLEMENTATION SUCCESSFULLY INSERTS PROJECT DATA INTO SUPABASE DATABASE. DEBUG LOGGING PRESENT FOR DEVELOPMENT ASSISTANCE. ERROR HANDLING INCLUDED WITH DESCRIPTIVE EXCEPTION MESSAGE.

SUGGESTION: CONSIDER REMOVING DEBUG PRINT STATEMENTS BEFORE PRODUCTION DEPLOYMENT.


```diff
-    print('dbg project: $project');
-    print('dbg response: $response');
```

<!-- This is an auto-generated comment by CodeRabbit -->

✅ Addressed in commit f2dae48
created_at: 2025-04-19T06:30:50Z
author_association: NONE
diff_hunk: @@ -27,3 +29,15 @@ class FetchUserUseCase
     return await _projectRepository.fetchUser();
   }
 }
+
+class CreateProjectUseCase
+    extends BaseUseCase<ProjectEntity, Success, Failure> {
+  final HomeRepository _projectRepository;
+  CreateProjectUseCase(this._projectRepository);
+
+  @override
+  Future<Either<Success, Failure>> call(ProjectEntity input) async {
+    print('dbg before project in use case: ${input.toJson()}');
+    return await _projectRepository.createProject(input);
+  }
+}
path: task_hive/lib/features/home/domain/use_cases/home_use_cases.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**NEW USE-CASE DETECTED: CREATE-PROJECT-USE-CASE**

USE-CASE IMPLEMENTS STANDARDIZED PATTERN FOR PROJECT CREATION. EXTENDS BASE-USE-CASE WITH APPROPRIATE TYPE PARAMETERS. 

DEBUGGING PRINT STATEMENT DETECTED ON LINE 40. RECOMMEND REMOVAL BEFORE PRODUCTION DEPLOYMENT.


```diff
-    print('dbg before project in use case: ${input.toJson()}');
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
class CreateProjectUseCase
    extends BaseUseCase<ProjectEntity, Success, Failure> {
  final HomeRepository _projectRepository;
  CreateProjectUseCase(this._projectRepository);

  @override
  Future<Either<Success, Failure>> call(ProjectEntity input) async {
-    print('dbg before project in use case: ${input.toJson()}');
    return await _projectRepository.createProject(input);
  }
}
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->

✅ Addressed in commit f2dae48
created_at: 2025-04-19T06:30:50Z
author_association: NONE
diff_hunk: @@ -46,16 +42,25 @@ class HomeRepositoryImpl implements HomeRepository {
   @override
   Future<Either<HomePageUserEntity, String>> fetchUser() async {
     try {
-      print('dbg before fetchUser');
       final userId = await _homeLocalDataSource.getUserId();
-      print('dbg after fetchUser $userId');
-
       final response = await _homeRemoteDataSource.fetchUser(userId);
-      print('dbg after fetchUser response $response');
       final user = HomePageUserEntity.fromJson(response);
       return Left(user);
     } catch (e) {
       return Right(e.toString());
     }
   }
+
+  @override
+  Future<Either<Success, Failure>> createProject(ProjectEntity project) async {
+    try {
+      print('dbg before project in repo imp: $project');
+      await _homeRemoteDataSource.addProject(project.toJson());
+      print('dbg before project in repo imp');
+
path: task_hive/lib/features/home/data/repository_imp/home_repo_imp.dart
user: login: coderabbitai[bot]
body: _💡 Verification agent_

<details>
<summary>❓ Verification inconclusive</summary>

**Beep‑boop: Drop noisy `print` calls & consider proper logging / Either semantics**

1. The two `print` statements are handy during development, but they will spam production logs and slow down I/O.  
2. Your current convention is `Either<Success, Failure>` with *Left = success* and *Right = failure*.  This is the reverse of the de‑facto `dartz` pattern (`Left = Failure`).  Swapping sides later will break every consumer.  Decide now and document clearly in the type alias or repository contract.

```diff
-      print('dbg before project in repo imp: $project');
-      await _homeRemoteDataSource.addProject(project.toJson());
-      print('dbg before project in repo imp');
+      await _homeRemoteDataSource.addProject(project.toJson());
+      // TODO: inject a logger and log at debug level if needed
```


Would you like a short patch to introduce a lightweight logger wrapper?

---



</details>

**Beep‑boop: Remove debug prints & adopt structured logging + clarify Either semantics**

- File `task_hive/lib/features/home/data/repository_imp/home_repo_imp.dart`, lines 55–60: drop both `print(…)` calls to avoid spamming production I/O.  
- Inject a `Logger` (e.g. via `package:logging` or a lightweight wrapper) into `HomeRepoImp` and replace prints with `logger.debug(…)`.  
- Define or update a type alias for your repository results—e.g.  
  ```dart
  /// Left = Success, Right = Failure (inverted from dartz default)
  typedef ProjectResult = Either<Success, Failure>;
  ```  
  or swap to `Either<Failure, Success>` to align with dartz conventions. Document the chosen orientation in your repository contract to prevent breaking consumers.  

Suggested snippet:
```diff
-      print('dbg before project in repo imp: $project');
-      await _homeRemoteDataSource.addProject(project.toJson());
-      print('dbg before project in repo imp');
+      await _homeRemoteDataSource.addProject(project.toJson());
+      logger.debug('Project created: $project');
```

Consider adding a lightweight logger wrapper for easy injection and level-based filtering.

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-19T06:30:50Z
author_association: NONE
diff_hunk: @@ -0,0 +1,27 @@
+import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:task_hive/core/io/failure.dart';
+import 'package:task_hive/features/home/domain/entities/project_entity.dart';
+import 'package:task_hive/features/home/domain/use_cases/home_use_cases.dart';
+
+import 'create_project_state.dart';
+
+class CreateProjectCubit extends Cubit<CreateProjectState> {
+  final CreateProjectUseCase _createProjectUseCase;
+  CreateProjectCubit(this._createProjectUseCase)
+      : super(CreateProjectInitial());
+  void createProject(ProjectEntity project) {
+    emit(CreateProjectLoading());
+    try {
+      final res = _createProjectUseCase.call(project);
+      res.then((value) {
+        value.fold((l) {
+          emit(CreateProjectSuccess(success: l));
+        }, (r) {
+          emit(CreateProjectFailure(failure: r));
+        });
+      });
+    } catch (e) {
+      emit(CreateProjectFailure(failure: Failure(e.toString())));
+    }
+  }
path: task_hive/lib/features/home/presentation/cubits/create_project/create_project_cubit.dart
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Beep‑boop: Make `createProject` `async` for cleaner flow & error capture**

Using `then` inside a `try` block only catches synchronous exceptions; async errors inside `then` are swallowed.  A tiny refactor improves readability and robustness.

```diff
-  void createProject(ProjectEntity project) {
-    emit(CreateProjectLoading());
-    try {
-      final res = _createProjectUseCase.call(project);
-      res.then((value) {
-        value.fold((l) {
-          emit(CreateProjectSuccess(success: l));
-        }, (r) {
-          emit(CreateProjectFailure(failure: r));
-        });
-      });
-    } catch (e) {
-      emit(CreateProjectFailure(failure: Failure(e.toString())));
-    }
-  }
+  Future<void> createProject(ProjectEntity project) async {
+    emit(CreateProjectLoading());
+    try {
+      final result = await _createProjectUseCase(project);
+      result.fold(
+        (success) => emit(CreateProjectSuccess(success: success)),
+        (failure) => emit(CreateProjectFailure(failure: failure)),
+      );
+    } catch (e) {
+      emit(CreateProjectFailure(failure: Failure(e.toString())));
+    }
+  }
```

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-19T06:30:50Z
author_association: NONE
diff_hunk: @@ -19,41 +80,79 @@ class ProjectsScreen extends StatelessWidget {
               child: Column(
                 crossAxisAlignment: CrossAxisAlignment.start,
                 children: [
+                  BlocBuilder<FetchUserCubit, FetchUserState>(
+                    bloc: _fetchUserCubit,
+                    builder: (context, state) {
+                      if (state is FetchUserLoading) {
+                        return const CircularProgressIndicator(
+                          color: Colors.blue,
+                        );
+                      } else if (state is FetchUserSuccess) {
+                        _fetchProjectCubit.fetchProjects(
+                            userId: state.userData.userId ?? 0);
+                        _userData = state.userData;
+                        // return Text(
+                        //   'Welcome ${state.userData.name}',
path: task_hive/lib/features/home/presentation/screens/projects_screen.dart
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Beep‑boop: Avoid fetching projects on every rebuild**

Calling `_fetchProjectCubit.fetchProjects` inside a `BlocBuilder` fires on **every** state change → network storm.  
Move this side‑effect to a `BlocListener` or `initState`.

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-19T06:30:50Z
author_association: NONE
diff_hunk: @@ -199,17 +308,52 @@ class _CreateProjectBottomSheetState extends State<CreateProjectBottomSheet> {
                   if (_formKey.currentState!.validate()) {
                     final title = titleController.text.trim();
                     final description = descriptionController.text.trim();
-                    print('Title: $title, Description: $description');
-                    Navigator.pop(context);
+                    widget.createProjectCubit?.createProject(
+                      ProjectEntity(
+                        name: title,
+                        description: description,
+                        createdBy: widget.userData?.userId ?? 0,
+                      ),
+                    );
                   }
                 },
-                child: const Text('Submit'),
+                child: BlocBuilder<CreateProjectCubit, CreateProjectState>(
+                  bloc: widget.createProjectCubit,
+                  builder: (context, state) {
+                    if (state is CreateProjectLoading) {
+                      return const CircularProgressIndicator(
+                        color: Colors.white,
+                      );
+                    } else if (state is CreateProjectSuccess) {
+                      widget.fetchProjectsCubit?.fetchProjects(
+                        userId: widget.userData?.userId ?? 0,
+                      );
+                      _showSnackBar(state.success.message);
+                      Navigator.pop(context);
+                    }
+                    if (state is CreateProjectFailure) {
+                      _showSnackBar(state.failure.message);
+                    }
+                    return const Text('Submit');
+                  },
+                ),
path: task_hive/lib/features/home/presentation/screens/projects_screen.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**Beep‑boop: Avoid heavy side‑effects inside `BlocBuilder`**

Showing snackbars and popping routes inside the builder can run multiple times due to state re‑builds.  
Wrap this logic in a `BlocListener` to ensure single execution per state transition.

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-19T06:30:50Z
author_association: NONE
diff_hunk: @@ -1,14 +1,75 @@
 import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:task_hive/core/extensions/app_extension.dart';
 
-class ProjectsScreen extends StatelessWidget {
+import '../../../../core/di/di.dart';
+import '../../domain/entities/home_user_entity.dart';
+import '../../domain/entities/project_entity.dart';
+import '../cubits/create_project/create_project_cubit.dart';
+import '../cubits/create_project/create_project_state.dart';
+import '../cubits/fetch_projects/fetch_projects_cubit.dart';
+import '../cubits/fetch_projects/fetch_projects_state.dart';
+import '../cubits/fetch_user/fetch_user_cubit.dart';
+import '../cubits/fetch_user/fetch_user_state.dart';
+
+class ProjectsScreen extends StatefulWidget {
   const ProjectsScreen({super.key});
 
+  @override
+  State<ProjectsScreen> createState() => _ProjectsScreenState();
+}
+
+class _ProjectsScreenState extends State<ProjectsScreen> {
+  final _fetchProjectCubit = getIt.get<FetchProjectsCubit>();
+  final _fetchUserCubit = getIt.get<FetchUserCubit>();
+  final _createProjectCubit = getIt.get<CreateProjectCubit>();
+
+  @override
+  void initState() {
+    _fetchUserCubit.fetchUser();
+    super.initState();
+  }
+
+  @override
+  void dispose() {
+    _fetchProjectCubit.close();
+    _fetchUserCubit.close();
+    _createProjectCubit.close();
+    super.dispose();
+  }
+
   @override
   Widget build(BuildContext context) {
     final colorScheme = Theme.of(context).colorScheme;
     final textTheme = Theme.of(context).textTheme;
+    HomePageUserEntity? _userData;
     return Scaffold(
path: task_hive/lib/features/home/presentation/screens/projects_screen.dart
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Beep‑boop ERROR: `final` local variable `_userData` cannot be reassigned**

`final HomePageUserEntity? _userData;` inside `build` is illegal (un‑initialized & later mutated).  
Store the user once in the `State` object instead.

```diff
-class _ProjectsScreenState extends State<ProjectsScreen> {
+class _ProjectsScreenState extends State<ProjectsScreen> {
   final _fetchProjectCubit = getIt.get<FetchProjectsCubit>();
   final _fetchUserCubit    = getIt.get<FetchUserCubit>();
   final _createProjectCubit= getIt.get<CreateProjectCubit>();
+
+  HomePageUserEntity? _userData; // mutable field
```

Remove the local declaration inside `build`.



> Committable suggestion skipped: line range outside the PR's diff.

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-19T06:30:50Z
author_association: NONE
diff_hunk: @@ -1,13 +1,14 @@
 import 'package:flutter/material.dart';
-import 'package:logger/logger.dart';
 import 'package:task_hive/features/home/presentation/widgets/priority_task_card.dart';
 import 'package:task_hive/features/home/presentation/widgets/upcoming_delivery_card.dart';
 
+import '../../domain/entities/project_entity.dart';
 import '../../domain/entity/project_info.dart';
 // import 'package:intl/intl.dart';
 
 class HomePage extends StatefulWidget {
-  const HomePage({super.key});
+  final ProjectEntity? projectEntity;
+  const HomePage({super.key, this.projectEntity});
path: task_hive/lib/features/home/presentation/screens/dashboard_screen.dart
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**PARAMETER INITIALIZED BUT NOT UTILIZED.**

OBSERVATION: PROJECTENTITY PARAMETER ADDED TO HOMEPAGE WIDGET BUT NO IMPLEMENTATION DETECTED IN CODE BODY. WIDGET ACCEPTS DATA BUT DOES NOT PROCESS IT.

```diff
class _HomePageState extends State<HomePage> {
  int _selectedIndex = 0;

+  @override
+  void initState() {
+    super.initState();
+    // Initialize with project data if available
+    if (widget.projectEntity != null) {
+      // TODO: Process project entity data
+    }
+  }
```

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-19T07:00:43Z
author_association: NONE
diff_hunk: @@ -1,13 +1,14 @@
 import 'package:flutter/material.dart';
-import 'package:logger/logger.dart';
 import 'package:task_hive/features/home/presentation/widgets/priority_task_card.dart';
 import 'package:task_hive/features/home/presentation/widgets/upcoming_delivery_card.dart';
 
+import '../../domain/entities/project_entity.dart';
 import '../../domain/entity/project_info.dart';
 // import 'package:intl/intl.dart';
path: task_hive/lib/features/home/presentation/screens/dashboard_screen.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**REMOVE COMMENTED IMPORT.**

UNNECESSARY CODE DETECTED. COMMENTED IMPORT FOR INTL PACKAGE SERVES NO FUNCTION. RECOMMEND DELETION.

```diff
import '../../domain/entities/project_entity.dart';
import '../../domain/entity/project_info.dart';
-// import 'package:intl/intl.dart';
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
import '../../domain/entities/project_entity.dart';
import '../../domain/entity/project_info.dart';
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-19T07:00:43Z
author_association: NONE

PR comments:
user: login: coderabbitai[bot]
created_at: 2025-04-19T06:28:13Z
body: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- walkthrough_start -->

<details>
<summary>📝 Walkthrough</summary>

## Summary by CodeRabbit

- **New Features**
  - Introduced the ability to create new projects directly from the projects screen, with real-time feedback on success or failure.
  - Projects screen now dynamically displays user and project data, updating automatically when new projects are created.

- **Improvements**
  - Enhanced project data handling with improved date parsing and error fallback.
  - Project creation and retrieval now use robust state management for a smoother user experience.

- **Bug Fixes**
  - Fixed issues with unimplemented project creation methods and improved error handling during project creation.
## Summary by CodeRabbit

- **New Features**
  - Introduced the ability to create new projects, including a modal bottom sheet for project creation and real-time feedback on success or failure.
  - Project and user data on the Projects screen now update dynamically using state management, reflecting changes instantly.

- **Improvements**
  - Enhanced project data handling with more robust date formatting and error handling.
  - The Projects screen now displays actual project data, loading indicators, and error messages for a more responsive experience.

- **Bug Fixes**
  - Improved reliability and error messaging when creating projects or fetching data.

- **Refactor**
  - Updated the Projects screen and related widgets to use advanced state management for better performance and maintainability.

## Walkthrough

01101100 01101111 01100001 01100100 01101001 01101110 01100111 00101110 Summary of changes detected: The project creation feature has been implemented and integrated across multiple layers. New Cubits, states, and use cases were introduced to manage project creation. The repository and data source interfaces were updated to support the new workflow, with improved error handling and type safety. The UI was refactored to use stateful widgets and BlocBuilders for dynamic, reactive updates based on Cubit states. Routing was updated to point to the new `ProjectsScreen`. Dependency injection was extended to register new Cubits and use cases. Data models and entities now use `DateTime` for timestamps and provide serialization methods.

## Changes

| File(s) | Change Summary |
|---------|----------------|
| `task_hive/lib/core/di/di.dart` | Registered `CreateProjectCubit` and `CreateProjectUseCase` in the dependency injection setup. |
| `task_hive/lib/core/navigation/router_config.dart` | Updated route to use `ProjectsScreen` instead of `HomePage`. |
| `task_hive/lib/core/services/auth_service/supabase_impl.dart` | Explicitly typed the `_client` field as `SupabaseClient`. |
| `task_hive/lib/features/home/data/data_source/remote/home_remote_imp.dart` | Implemented `addProject` method to insert a project into Supabase and handle errors. |
| `task_hive/lib/features/home/data/models/project_model.dart` | Modified `toEntity()` to parse `createdAt` and `updatedAt` as `DateTime`, defaulting to `DateTime.now()` if parsing fails. |
| `task_hive/lib/features/home/data/repository_imp/home_repo_imp.dart` | Removed unimplemented `addProject`; added `createProject` with error handling and result wrapping in `Either`. |
| `task_hive/lib/features/home/domain/entities/project_entity.dart` | Changed `createdAt`/`updatedAt` to `DateTime?`, made constructor parameters optional, and added `toJson` method. |
| `task_hive/lib/features/home/domain/repository/home_repository.dart` | Replaced `addProject` with `createProject` using `ProjectEntity` and returning `Either<Success, Failure>`. |
| `task_hive/lib/features/home/domain/use_cases/home_use_cases.dart` | Added `CreateProjectUseCase` for project creation logic. |
| `task_hive/lib/features/home/presentation/cubits/create_project/create_project_cubit.dart` | Introduced `CreateProjectCubit` to manage project creation states and logic. |
| `task_hive/lib/features/home/presentation/cubits/create_project/create_project_state.dart` | Added state classes for the create project Cubit: initial, loading, success, and failure. |
| `task_hive/lib/features/home/presentation/screens/projects_screen.dart` | Refactored `ProjectsScreen` to a stateful widget using Cubits for fetching and creating projects. Updated UI for dynamic state handling and integrated project creation modal. |
| `task_hive/lib/features/home/presentation/screens/dashboard_screen.dart` | Added optional `ProjectEntity? projectEntity` field to `HomePage` widget constructor. |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant UI as ProjectsScreen
    participant CreateProjectCubit
    participant CreateProjectUseCase
    participant HomeRepository
    participant HomeRemoteImpl
    participant SupabaseClient

    UI->>CreateProjectCubit: createProject(ProjectEntity)
    CreateProjectCubit->>CreateProjectUseCase: call(ProjectEntity)
    CreateProjectUseCase->>HomeRepository: createProject(ProjectEntity)
    HomeRepository->>HomeRemoteImpl: addProject(Map)
    HomeRemoteImpl->>SupabaseClient: insert(project)
    SupabaseClient-->>HomeRemoteImpl: response
    HomeRemoteImpl-->>HomeRepository: response
    HomeRepository-->>CreateProjectUseCase: Either<Success, Failure>
    CreateProjectUseCase-->>CreateProjectCubit: Either<Success, Failure>
    CreateProjectCubit-->>UI: Emit Success/Failure State
```

## Poem

> 01010000 01110010 01101111 01101010 01100101 01100011 01110100 01110011 00100000 01100001 01110010 01100101 00100000 01100010 01101111 01110010 01101110 00100000  
> In Cubits and UseCases, logic is sworn.  
> From UI to Supabase, data flows tight,  
> With BlocBuilders blinking through day and night.  
> Entities timestamped, errors contained,  
> The project creation pipeline is now well-trained.  
> 01100001 01101100 01101100 00100000 01110011 01111001 01110011 01110100 01100101 01101101 01110011 00100000 01100111 01101111 00100001  
> 🤖

</details>

<!-- walkthrough_end -->
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIAMRJqbH8AelgWEi4AYX9qD0x6eNwGWB4KfBExZHwsNLZ7Bn8ySFpqkmjIAHc0ZAcBZnUaejkw2A9sREpIAFk0WAFsATAACW7MMGg0L2wAayU+bus7DEcBSYBGAE4NGFHGWExSZHhmbki2DEGULFwEZFtIABm+AY434WDIKi88AwRBGHgaCXE1XQGHoAJIRQQMP4ANK5VEuGQtHg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AEJHzvjcKjFZwARdVgYXILYo5CuyGzIwLqgaF5NegPoCAA= -->

<!-- internal state end -->
<!-- tips_start -->

---



<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=Learnathon-By-Geeky-Solutions/nstu-codebreakers&utm_content=19):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai generate unit testing code for this file.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and generate unit testing code.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
author_association: NONE
user: login: Warhammer4000
created_at: 2025-04-19T06:28:17Z
body: ![](https://res.cloudinary.com/snyk/image/upload/r-d/scm-platform/snyk-pull-requests/pr-banner-default.svg)

### :tada: **Snyk checks have passed. No issues have been found so far.**

:white_check_mark: **security/snyk** check is complete. No issues have been found. [(View Details)](https://app.snyk.io/org/warhammer4000/pr-checks/3c57d792-42a3-4114-a67c-9e5d76794835?refs=f2dae4890e99adcc4f6fe2fd29aa9fbcdd6e417b&source=prChecksComment)



author_association: CONTRIBUTOR