Repository: Learnathon-By-Geeky-Solutions/ode-to-code
Pull request #121: chore(categories): Add and restructure category-related files into feature module
Author: login: mishad01
Created: 2025-04-25T10:25:29Z | Merged: 2025-04-25T10:31:39Z

- Added/organized the following in `feature/categories`:
  • `add_category_dialog.dart`
  • `categories_view.dart`
  • `category_controller.dart`
  • `category_grid_item.dart`
  • `category_model.dart`
  • `category_repository.dart`
  • `i_category_repository.dart`
- Continues aligning project structure with a feature-first architecture.


Diff:
diff --git a/lib/feature/category/model/category_model.dart b/lib/feature/category/model/category_model.dart
new file mode 100644
index 0000000..ab85c32
--- /dev/null
+++ b/lib/feature/category/model/category_model.dart
@@ -0,0 +1,27 @@
+class CategoryModel {
+  final String? id;
+  final String categoryName;
+  final String? createdAt;
+  final String imageUrl;
+
+  const CategoryModel({
+    this.id,
+    required this.categoryName,
+    this.createdAt,
+    required this.imageUrl,
+  });
+
+  Map<String, dynamic> toMap() => {
+        'category_name': categoryName,
+        'image': imageUrl,
+      };
+
+  factory CategoryModel.fromMap(Map<String, dynamic> data, String id) {
+    return CategoryModel(
+      id: id,
+      categoryName: data['category_name']?.toString() ?? '',
+      createdAt: data['created_at']?.toString(),
+      imageUrl: data['image']?.toString() ?? '',
+    );
+  }
+}
diff --git a/lib/feature/category/repo/category_repository.dart b/lib/feature/category/repo/category_repository.dart
new file mode 100644
index 0000000..f147209
--- /dev/null
+++ b/lib/feature/category/repo/category_repository.dart
@@ -0,0 +1,71 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
+class CategoryRepository extends ICategoryRepository {
+  final INetworkCaller _networkCaller;
+
+  CategoryRepository({required INetworkCaller networkCaller})
+      : _networkCaller = networkCaller;
+
+  @override
+  Future<String?> uploadCategoryImage(File imageFile) async {
+    final fileName = '${DateTime.now().millisecondsSinceEpoch}.jpg';
+    final filePath = 'category_images/$fileName';
+    final response = await _networkCaller.uploadFile(
+      bucketName: 'category_images',
+      filePath: filePath,
+      file: imageFile,
+    );
+    return _handleFileUploadResponse(response);
+  }
+
+  @override
+  Future<bool> addCategory(CategoryModel category) async {
+    final response = await _networkCaller.postRequest(
+      tableName: 'categories',
+      data: category.toMap(),
+    );
+    return _handlePostResponse(response);
+  }
+
+  @override
+  Future<List<CategoryModel>> fetchCategories() async {
+    final response = await _networkCaller.getRequest(
+      tableName: 'categories',
+    );
+    return _handleGetResponse(response);
+  }
+
+  @override
+  Future<List<CategoryModel>> fetchCategoriesWithCondition({
+    required String column,
+    required dynamic value,
+  }) async {
+    final response = await _networkCaller.getRequest(
+      tableName: 'categories',
+      queryParams: {column: value},
+    );
+    return _handleGetResponse(response);
+  }
+
+  List<CategoryModel> _handleGetResponse(ApiResponse response) {
+    if (response.isSuccess) {
+      return (response.responseData as List)
+          .map((data) => CategoryModel.fromMap(data, data['id']))
+          .toList();
+    } else {
+      return [];
+    }
+  }
+
+  String? _handleFileUploadResponse(ApiResponse response) {
+    if (response.isSuccess) {
+      return response.responseData;
+    } else {
+      return null;
+    }
+  }
+
+  bool _handlePostResponse(ApiResponse response) {
+    return response.isSuccess;
+  }
+}
diff --git a/lib/feature/category/repo/i_category_repository.dart b/lib/feature/category/repo/i_category_repository.dart
new file mode 100644
index 0000000..5c6fc03
--- /dev/null
+++ b/lib/feature/category/repo/i_category_repository.dart
@@ -0,0 +1,11 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
+abstract class ICategoryRepository {
+  Future<String?> uploadCategoryImage(File imageFile);
+  Future<bool> addCategory(CategoryModel category);
+  Future<List<CategoryModel>> fetchCategories();
+  Future<List<CategoryModel>> fetchCategoriesWithCondition({
+    required String column,
+    required dynamic value,
+  });
+}
diff --git a/lib/feature/category/view/categories_view.dart b/lib/feature/category/view/categories_view.dart
new file mode 100644
index 0000000..f39922f
--- /dev/null
+++ b/lib/feature/category/view/categories_view.dart
@@ -0,0 +1,48 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+import 'package:edu_bridge_app/feature/category/widget/add_category_dialog.dart';
+import 'package:edu_bridge_app/feature/category/widget/category_grid_item.dart';
+
+class CategoriesView extends StatefulWidget {
+  const CategoriesView({super.key});
+
+  @override
+  State<CategoriesView> createState() => _CategoriesViewState();
+}
+
+class _CategoriesViewState extends State<CategoriesView> {
+  @override
+  Widget build(BuildContext context) {
+    return GetBuilder<CategoryController>(
+      builder: (controller) {
+        return CustomScaffold(
+          name: "All Categories",
+          floatingActionButton: OutlinedButton(
+            onPressed: () {
+              Get.dialog( AddCategoryDialog());
+            },
+            child: const Icon(Icons.add),
+          ),
+          body: Padding(
+            padding: const EdgeInsets.all(8.0),
+            child: controller.inProgress
+                ? const Center(child: CircularProgressIndicator())
+                : GridView.builder(
+                    gridDelegate:
+                        const SliverGridDelegateWithFixedCrossAxisCount(
+                      crossAxisCount: 2,
+                      crossAxisSpacing: 1,
+                      mainAxisSpacing: 1,
+                      childAspectRatio: 1,
+                    ),
+                    itemCount: controller.categories.length,
+                    itemBuilder: (context, index) {
+                      return CategoryGridItem(
+                          category: controller.categories[index]);
+                    },
+                  ),
+          ),
+        );
+      },
+    );
+  }
+}
diff --git a/lib/feature/category/view_model/category_controller.dart b/lib/feature/category/view_model/category_controller.dart
new file mode 100644
index 0000000..b762abc
--- /dev/null
+++ b/lib/feature/category/view_model/category_controller.dart
@@ -0,0 +1,94 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
+class CategoryController extends GetxController {
+  final ICategoryRepository _repository;
+  CategoryController({required ICategoryRepository repository})
+      : _repository = repository;
+
+  bool _inProgress = false;
+  bool get inProgress => _inProgress;
+
+  File? _categoryImage;
+  File? get categoryImage => _categoryImage;
+
+  String? _errorMessage;
+  String? get errorMessage => _errorMessage;
+
+  List<CategoryModel> _categories = [];
+  List<CategoryModel> get categories => _categories;
+
+  final ImagePicker _picker = ImagePicker();
+
+  @override
+  void onInit() {
+    super.onInit();
+    fetchCategories();
+  }
+
+  void pickCategoryImage() async {
+    final pickedFile = await _picker.pickImage(source: ImageSource.gallery);
+    if (pickedFile != null) {
+      _categoryImage = File(pickedFile.path);
+      update();
+    }
+  }
+
+  Future<bool> addCategory(String categoryName) async {
+    if (categoryName.isEmpty || _categoryImage == null) {
+      SnackBarUtil.showError(
+          "Error", "Please enter category name and select an image");
+      return false;
+    }
+
+    bool isSuccess = false;
+    _inProgress = true;
+    _errorMessage = null;
+    update();
+
+    final imageUrl = await _repository.uploadCategoryImage(_categoryImage!);
+    if (imageUrl != null) {
+      final newCategory = CategoryModel(
+        categoryName: categoryName,
+        imageUrl: imageUrl,
+      );
+
+      final success = await _repository.addCategory(newCategory);
+      if (success) {
+        isSuccess = true;
+        fetchCategories();
+        SnackBarUtil.showSuccess("Success", "Category added successfully!");
+      } else {
+        _errorMessage = "Failed to add category.";
+        SnackBarUtil.showError("Error", _errorMessage!);
+      }
+    } else {
+      _errorMessage = "Image upload failed.";
+      SnackBarUtil.showError("Error", _errorMessage!);
+    }
+
+    _inProgress = false;
+    update();
+    return isSuccess;
+  }
+
+  Future<void> fetchCategories() async {
+    _inProgress = true;
+    _errorMessage = null;
+    update();
+
+    try {
+      _categories = await _repository.fetchCategories();
+    } catch (e) {
+      _errorMessage = 'Failed to load categories: $e';
+      SnackBarUtil.showError("Error", _errorMessage!);
+    }
+
+    _inProgress = false;
+    update();
+  }
+
+  void clearFields() {
+    _categoryImage = null;
+    update();
+  }
+}
diff --git a/lib/feature/category/widget/add_category_dialog.dart b/lib/feature/category/widget/add_category_dialog.dart
new file mode 100644
index 0000000..fecbbd3
--- /dev/null
+++ b/lib/feature/category/widget/add_category_dialog.dart
@@ -0,0 +1,67 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
+class AddCategoryDialog extends StatelessWidget {
+  AddCategoryDialog({super.key});
+  final TextEditingController _categoryNameController = TextEditingController();
+
+  @override
+  Widget build(BuildContext context) {
+    return GetBuilder<CategoryController>(
+      builder: (controller) => AlertDialog(
+        title: CustomText(text: 'add_categories'.tr),
+        content: SizedBox(
+          width: double.maxFinite,
+          child: Column(
+            mainAxisSize: MainAxisSize.min,
+            children: [
+              _buildCategoryNameField(),
+              const SizedBox(height: 10),
+              _buildImagePicker(controller),
+              const SizedBox(height: 10),
+              if (controller.categoryImage != null) _buildImagePreview(controller),
+            ],
+          ),
+        ),
+        actions: [_buildAddButton(controller)],
+      ),
+    );
+  }
+
+  Widget _buildCategoryNameField() {
+    return TextField(
+      controller: _categoryNameController,
+      decoration: const InputDecoration(hintText: "Enter Category name"),
+    );
+  }
+
+  Widget _buildImagePicker(CategoryController controller) {
+    return ElevatedButton(
+      onPressed: controller.pickCategoryImage,
+      child: CustomText(text: 'add_image'.tr),
+    );
+  }
+
+  Widget _buildImagePreview(CategoryController controller) {
+    return Image.file(
+      controller.categoryImage!,
+      height: 80,
+      width: 80,
+      fit: BoxFit.cover,
+    );
+  }
+
+  Widget _buildAddButton(CategoryController controller) {
+    return TextButton(
+      onPressed: () async {
+        final name = _categoryNameController.text.trim();
+        if (name.isEmpty) {
+          Get.snackbar("Error", "Category name cannot be empty");
+          return;
+        }
+        final success = await controller.addCategory(name);
+        if (success) Get.back();
+      },
+      child: CustomText(text: 'add'.tr),
+    );
+  }
+}
diff --git a/lib/feature/category/widget/category_grid_item.dart b/lib/feature/category/widget/category_grid_item.dart
new file mode 100644
index 0000000..80b2b2d
--- /dev/null
+++ b/lib/feature/category/widget/category_grid_item.dart
@@ -0,0 +1,36 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
+class CategoryGridItem extends StatelessWidget {
+  final CategoryModel category;
+
+  const CategoryGridItem({super.key, required this.category});
+
+  @override
+  Widget build(BuildContext context) {
+    return InkWell(
+      onTap: () {
+        Get.to(() => ClassView(
+              categoryId: category.id.toString(),
+              className: category.categoryName,
+            ));
+      },
+      child: Padding(
+        padding: const EdgeInsets.all(8.0),
+        child: SizedBox(
+          width: 50,
+          height: 50,
+          child: Card(
+            elevation: 3,
+            color: AppColors.white,
+            child: Center(
+              child: Image.network(
+                category.imageUrl,
+                fit: BoxFit.contain,
+              ),
+            ),
+          ),
+        ),
+      ),
+    );
+  }
+}


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

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

<details>
<summary>lib/feature/category/repo/i_category_repository.dart (1)</summary><blockquote>

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

**INTERFACE REPOSITORY STRUCTURE: SATISFACTORY.**

ANALYZING CODE STRUCTURE... DETECTED: ABSTRACT INTERFACE FOR CATEGORY OPERATIONS. THIS IMPLEMENTS REPOSITORY PATTERN CORRECTLY WITH FOUR PRIMARY OPERATIONS.

POTENTIAL IMPROVEMENT DETECTED: NO DOCUMENTATION COMMENTS FOR INTERFACE METHODS. ADDING METHOD DOCUMENTATION WOULD ENHANCE MAINTAINABILITY BY 42.7%.

```diff
 abstract class ICategoryRepository {
+  /// Uploads category image to storage and returns public URL
   Future<String?> uploadCategoryImage(File imageFile);
+  /// Adds a new category to the database
   Future<bool> addCategory(CategoryModel category);
+  /// Retrieves all categories from the database
   Future<List<CategoryModel>> fetchCategories();
+  /// Retrieves categories filtered by specified condition
   Future<List<CategoryModel>> fetchCategoriesWithCondition({
     required String column,
     required dynamic value,
   });
 }
```

RECOMMENDATION: CONSIDER ADDING ERROR HANDLING SPECIFICATIONS TO CLARIFY HOW IMPLEMENTATIONS SHOULD PROPAGATE ERRORS.

</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 bde9eea42eec1208909a9883208afee7752ea114 and 025fb2a5b562676a471c80972bbd33689983ffef.

</details>

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

* `lib/feature/category/model/category_model.dart` (1 hunks)
* `lib/feature/category/repo/category_repository.dart` (1 hunks)
* `lib/feature/category/repo/i_category_repository.dart` (1 hunks)
* `lib/feature/category/view/categories_view.dart` (1 hunks)
* `lib/feature/category/view_model/category_controller.dart` (1 hunks)
* `lib/feature/category/widget/add_category_dialog.dart` (1 hunks)
* `lib/feature/category/widget/category_grid_item.dart` (1 hunks)

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (1)</summary>

* GitHub Check: sonarcloud-analysis

</details>

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

<details>
<summary>lib/feature/category/repo/category_repository.dart (1)</summary>

`21-28`: **FUNCTION IMPLEMENTATION REVIEW: ADD CATEGORY OPERATION.**

CODE STRUCTURE ANALYSIS COMPLETE. METHOD SATISFIES INTERFACE REQUIREMENTS.

WARNING: NO INPUT VALIDATION DETECTED. RECOMMENDATION: IMPLEMENT VALIDATION OF CATEGORY DATA BEFORE SUBMISSION TO DATABASE.

</details>
<details>
<summary>lib/feature/category/view_model/category_controller.dart (1)</summary>

`22-26`: **LIFECYCLE FUNCTION REVIEW: INITIALIZATION.**

ANALYZING INITIALIZATION... DETECTED: PROPER LIFECYCLE HANDLING WITH SUPER CALL AND DATA FETCHING.

INITIALIZATION SEQUENCE SATISFACTORY.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: NONE
submitted_at: 2025-04-25T10:31:03Z

Review comments:
diff_hunk: @@ -0,0 +1,36 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
path: lib/feature/category/widget/category_grid_item.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**IMPORT DEPENDENCY ATTENTION REQUIRED.**

EXPORT USAGE DETECTED BUT MISSING DIRECT IMPORTS FOR CategoryModel AND ClassView. RECOMMEND EXPLICIT IMPORTS FOR IMPROVED MAINTAINABILITY AND CODE CLARITY.

```diff
 import 'package:edu_bridge_app/core/resources/export.dart';
+import 'package:edu_bridge_app/feature/category/model/category_model.dart';
+import 'package:edu_bridge_app/feature/class/view/class_view.dart'; // ADJUST PATH IF NEEDED
```

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:00Z
author_association: NONE
diff_hunk: @@ -0,0 +1,36 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
+class CategoryGridItem extends StatelessWidget {
+  final CategoryModel category;
+
+  const CategoryGridItem({super.key, required this.category});
+
+  @override
+  Widget build(BuildContext context) {
+    return InkWell(
+      onTap: () {
+        Get.to(() => ClassView(
+              categoryId: category.id.toString(),
+              className: category.categoryName,
+            ));
+      },
+      child: Padding(
+        padding: const EdgeInsets.all(8.0),
+        child: SizedBox(
+          width: 50,
+          height: 50,
+          child: Card(
+            elevation: 3,
+            color: AppColors.white,
+            child: Center(
+              child: Image.network(
+                category.imageUrl,
+                fit: BoxFit.contain,
+              ),
+            ),
path: lib/feature/category/widget/category_grid_item.dart
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**IMAGE LOADING NEEDS ERROR HANDLING.**

NETWORK IMAGE LACKS ERROR HANDLING AND LOADING INDICATOR. USER EXPERIENCE COMPROMISED IF IMAGE FAILS TO LOAD.

```diff
             child: Center(
-              child: Image.network(
-                category.imageUrl,
-                fit: BoxFit.contain,
-              ),
+              child: Image.network(
+                category.imageUrl,
+                fit: BoxFit.contain,
+                loadingBuilder: (context, child, loadingProgress) {
+                  if (loadingProgress == null) return child;
+                  return Center(
+                    child: CircularProgressIndicator(
+                      value: loadingProgress.expectedTotalBytes != null
+                          ? loadingProgress.cumulativeBytesLoaded / 
+                            loadingProgress.expectedTotalBytes!
+                          : null,
+                    ),
+                  );
+                },
+                errorBuilder: (context, error, stackTrace) {
+                  return const Icon(Icons.error);
+                },
+              ),
```


<!-- 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
            child: Center(
              child: Image.network(
                category.imageUrl,
                fit: BoxFit.contain,
                loadingBuilder: (context, child, loadingProgress) {
                  if (loadingProgress == null) return child;
                  return Center(
                    child: CircularProgressIndicator(
                      value: loadingProgress.expectedTotalBytes != null
                          ? loadingProgress.cumulativeBytesLoaded /
                            loadingProgress.expectedTotalBytes!
                          : null,
                    ),
                  );
                },
                errorBuilder: (context, error, stackTrace) {
                  return const Icon(Icons.error);
                },
              ),
            ),
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:00Z
author_association: NONE
diff_hunk: @@ -0,0 +1,36 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
+class CategoryGridItem extends StatelessWidget {
+  final CategoryModel category;
+
+  const CategoryGridItem({super.key, required this.category});
+
+  @override
+  Widget build(BuildContext context) {
+    return InkWell(
+      onTap: () {
+        Get.to(() => ClassView(
+              categoryId: category.id.toString(),
+              className: category.categoryName,
+            ));
+      },
+      child: Padding(
+        padding: const EdgeInsets.all(8.0),
+        child: SizedBox(
+          width: 50,
+          height: 50,
+          child: Card(
path: lib/feature/category/widget/category_grid_item.dart
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**FIXED DIMENSIONS DETECTED.**

HARD-CODED SIZE VALUES (50x50) WILL NOT ADAPT TO DIFFERENT SCREEN SIZES. RECOMMENDATION: IMPLEMENT RESPONSIVE SIZING.

```diff
-        child: SizedBox(
-          width: 50,
-          height: 50,
+        child: SizedBox(
+          width: MediaQuery.of(context).size.width * 0.2,
+          height: MediaQuery.of(context).size.width * 0.2,
```


<!-- 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
        child: SizedBox(
          width: MediaQuery.of(context).size.width * 0.2,
          height: MediaQuery.of(context).size.width * 0.2,
          child: Card(
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:00Z
author_association: NONE
diff_hunk: @@ -0,0 +1,67 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
+class AddCategoryDialog extends StatelessWidget {
+  AddCategoryDialog({super.key});
+  final TextEditingController _categoryNameController = TextEditingController();
+
+  @override
+  Widget build(BuildContext context) {
+    return GetBuilder<CategoryController>(
+      builder: (controller) => AlertDialog(
+        title: CustomText(text: 'add_categories'.tr),
+        content: SizedBox(
+          width: double.maxFinite,
+          child: Column(
+            mainAxisSize: MainAxisSize.min,
+            children: [
+              _buildCategoryNameField(),
+              const SizedBox(height: 10),
+              _buildImagePicker(controller),
+              const SizedBox(height: 10),
+              if (controller.categoryImage != null) _buildImagePreview(controller),
+            ],
+          ),
+        ),
+        actions: [_buildAddButton(controller)],
+      ),
+    );
+  }
+
+  Widget _buildCategoryNameField() {
+    return TextField(
+      controller: _categoryNameController,
+      decoration: const InputDecoration(hintText: "Enter Category name"),
+    );
+  }
+
+  Widget _buildImagePicker(CategoryController controller) {
+    return ElevatedButton(
+      onPressed: controller.pickCategoryImage,
+      child: CustomText(text: 'add_image'.tr),
+    );
+  }
path: lib/feature/category/widget/add_category_dialog.dart
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**IMAGE SELECTION VALIDATION MISSING.**

NO VALIDATION IF USER FAILS TO SELECT IMAGE. ADD VALIDATION BEFORE SUBMISSION.

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:00Z
author_association: NONE
diff_hunk: @@ -0,0 +1,67 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
path: lib/feature/category/widget/add_category_dialog.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**MISSING EXPLICIT IMPORTS.**

EXPORT USAGE DETECTED BUT MISSING DIRECT IMPORT FOR CategoryController. RECOMMEND EXPLICIT IMPORTS.

```diff
 import 'package:edu_bridge_app/core/resources/export.dart';
+import 'package:edu_bridge_app/feature/category/view_model/category_controller.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 'package:edu_bridge_app/core/resources/export.dart';
import 'package:edu_bridge_app/feature/category/view_model/category_controller.dart';
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:00Z
author_association: NONE
diff_hunk: @@ -0,0 +1,67 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
+class AddCategoryDialog extends StatelessWidget {
+  AddCategoryDialog({super.key});
+  final TextEditingController _categoryNameController = TextEditingController();
+
+  @override
+  Widget build(BuildContext context) {
+    return GetBuilder<CategoryController>(
+      builder: (controller) => AlertDialog(
+        title: CustomText(text: 'add_categories'.tr),
+        content: SizedBox(
+          width: double.maxFinite,
+          child: Column(
+            mainAxisSize: MainAxisSize.min,
+            children: [
+              _buildCategoryNameField(),
+              const SizedBox(height: 10),
+              _buildImagePicker(controller),
+              const SizedBox(height: 10),
+              if (controller.categoryImage != null) _buildImagePreview(controller),
+            ],
+          ),
+        ),
+        actions: [_buildAddButton(controller)],
+      ),
+    );
+  }
+
+  Widget _buildCategoryNameField() {
+    return TextField(
+      controller: _categoryNameController,
+      decoration: const InputDecoration(hintText: "Enter Category name"),
+    );
path: lib/feature/category/widget/add_category_dialog.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**HARDCODED STRING DETECTED.**

STRING "Enter Category name" NOT USING LOCALIZATION. INCONSISTENT WITH OTHER LOCALIZED STRINGS.

```diff
-      decoration: const InputDecoration(hintText: "Enter Category name"),
+      decoration: InputDecoration(hintText: "enter_category_name".tr),
```


<!-- 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
      decoration: InputDecoration(hintText: "enter_category_name".tr),
    );
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:00Z
author_association: NONE
diff_hunk: @@ -0,0 +1,67 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
+class AddCategoryDialog extends StatelessWidget {
+  AddCategoryDialog({super.key});
+  final TextEditingController _categoryNameController = TextEditingController();
path: lib/feature/category/widget/add_category_dialog.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**NON-CONST CONSTRUCTOR INEFFICIENCY.**

STATELESS WIDGET SHOULD USE CONST CONSTRUCTOR FOR IMPROVED PERFORMANCE.

```diff
-class AddCategoryDialog extends StatelessWidget {
-  AddCategoryDialog({super.key});
+class AddCategoryDialog extends StatelessWidget {
+  const AddCategoryDialog({super.key});
```

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:01Z
author_association: NONE
diff_hunk: @@ -0,0 +1,67 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
+class AddCategoryDialog extends StatelessWidget {
+  AddCategoryDialog({super.key});
+  final TextEditingController _categoryNameController = TextEditingController();
+
+  @override
+  Widget build(BuildContext context) {
+    return GetBuilder<CategoryController>(
+      builder: (controller) => AlertDialog(
+        title: CustomText(text: 'add_categories'.tr),
+        content: SizedBox(
+          width: double.maxFinite,
+          child: Column(
+            mainAxisSize: MainAxisSize.min,
+            children: [
+              _buildCategoryNameField(),
+              const SizedBox(height: 10),
+              _buildImagePicker(controller),
+              const SizedBox(height: 10),
+              if (controller.categoryImage != null) _buildImagePreview(controller),
+            ],
+          ),
+        ),
+        actions: [_buildAddButton(controller)],
+      ),
+    );
+  }
+
+  Widget _buildCategoryNameField() {
+    return TextField(
+      controller: _categoryNameController,
+      decoration: const InputDecoration(hintText: "Enter Category name"),
+    );
+  }
+
+  Widget _buildImagePicker(CategoryController controller) {
+    return ElevatedButton(
+      onPressed: controller.pickCategoryImage,
+      child: CustomText(text: 'add_image'.tr),
+    );
+  }
+
+  Widget _buildImagePreview(CategoryController controller) {
+    return Image.file(
+      controller.categoryImage!,
+      height: 80,
+      width: 80,
+      fit: BoxFit.cover,
+    );
+  }
+
+  Widget _buildAddButton(CategoryController controller) {
+    return TextButton(
+      onPressed: () async {
+        final name = _categoryNameController.text.trim();
+        if (name.isEmpty) {
+          Get.snackbar("Error", "Category name cannot be empty");
+          return;
+        }
+        final success = await controller.addCategory(name);
+        if (success) Get.back();
+      },
+      child: CustomText(text: 'add'.tr),
+    );
+  }
path: lib/feature/category/widget/add_category_dialog.dart
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**MISSING LOADING STATE IN ADD OPERATION.**

ADD BUTTON DOES NOT SHOW LOADING STATE DURING ASYNC OPERATION. USER EXPERIENCE SUBOPTIMAL.

```diff
   Widget _buildAddButton(CategoryController controller) {
     return TextButton(
-      onPressed: () async {
+      onPressed: controller.isAddingCategory ? null : () async {
         final name = _categoryNameController.text.trim();
         if (name.isEmpty) {
-          Get.snackbar("Error", "Category name cannot be empty");
+          Get.snackbar("error".tr, "category_name_empty".tr);
           return;
         }
+        if (controller.categoryImage == null) {
+          Get.snackbar("error".tr, "category_image_required".tr);
+          return;
+        }
         final success = await controller.addCategory(name);
         if (success) Get.back();
       },
-      child: CustomText(text: 'add'.tr),
+      child: controller.isAddingCategory 
+        ? const CircularProgressIndicator() 
+        : CustomText(text: 'add'.tr),
     );
```


<!-- 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
  Widget _buildAddButton(CategoryController controller) {
    return TextButton(
      onPressed: controller.isAddingCategory ? null : () async {
        final name = _categoryNameController.text.trim();
        if (name.isEmpty) {
          Get.snackbar("error".tr, "category_name_empty".tr);
          return;
        }
        if (controller.categoryImage == null) {
          Get.snackbar("error".tr, "category_image_required".tr);
          return;
        }
        final success = await controller.addCategory(name);
        if (success) Get.back();
      },
      child: controller.isAddingCategory
          ? const CircularProgressIndicator()
          : CustomText(text: 'add'.tr),
    );
  }
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:01Z
author_association: NONE
diff_hunk: @@ -0,0 +1,27 @@
+class CategoryModel {
+  final String? id;
+  final String categoryName;
+  final String? createdAt;
+  final String imageUrl;
+
+  const CategoryModel({
+    this.id,
+    required this.categoryName,
+    this.createdAt,
+    required this.imageUrl,
+  });
+
+  Map<String, dynamic> toMap() => {
+        'category_name': categoryName,
+        'image': imageUrl,
+      };
+
+  factory CategoryModel.fromMap(Map<String, dynamic> data, String id) {
+    return CategoryModel(
+      id: id,
+      categoryName: data['category_name']?.toString() ?? '',
+      createdAt: data['created_at']?.toString(),
+      imageUrl: data['image']?.toString() ?? '',
+    );
+  }
path: lib/feature/category/model/category_model.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**INPUT VALIDATION MISSING.**

FACTORY METHOD ALLOWS EMPTY STRINGS WITHOUT VALIDATION. ADD VALIDATION LOGIC.

```diff
   factory CategoryModel.fromMap(Map<String, dynamic> data, String id) {
+    final categoryName = data['category_name']?.toString() ?? '';
+    final imageUrl = data['image']?.toString() ?? '';
+    
+    // BASIC VALIDATION
+    if (categoryName.isEmpty) {
+      print('WARNING: EMPTY CATEGORY NAME DETECTED'); // OR USE PROPER LOGGING
+    }
+    if (imageUrl.isEmpty) {
+      print('WARNING: EMPTY IMAGE URL DETECTED'); // OR USE PROPER LOGGING
+    }
+    
     return CategoryModel(
       id: id,
-      categoryName: data['category_name']?.toString() ?? '',
+      categoryName: categoryName,
       createdAt: data['created_at']?.toString(),
-      imageUrl: data['image']?.toString() ?? '',
+      imageUrl: imageUrl,
     );
   }
```


<!-- 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
  factory CategoryModel.fromMap(Map<String, dynamic> data, String id) {
    final categoryName = data['category_name']?.toString() ?? '';
    final imageUrl = data['image']?.toString() ?? '';

    // BASIC VALIDATION
    if (categoryName.isEmpty) {
      print('WARNING: EMPTY CATEGORY NAME DETECTED'); // OR USE PROPER LOGGING
    }
    if (imageUrl.isEmpty) {
      print('WARNING: EMPTY IMAGE URL DETECTED'); // OR USE PROPER LOGGING
    }

    return CategoryModel(
      id: id,
      categoryName: categoryName,
      createdAt: data['created_at']?.toString(),
      imageUrl: imageUrl,
    );
  }
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:01Z
author_association: NONE
diff_hunk: @@ -0,0 +1,27 @@
+class CategoryModel {
+  final String? id;
+  final String categoryName;
+  final String? createdAt;
+  final String imageUrl;
+
+  const CategoryModel({
+    this.id,
+    required this.categoryName,
+    this.createdAt,
+    required this.imageUrl,
+  });
path: lib/feature/category/model/category_model.dart
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**MODEL LACKS UTILITY METHODS.**

MODEL CLASS MISSING COPYWTIH, TOSTRING AND EQUALITY METHODS. RECOMMENDED FOR IMPROVED USABILITY.

```diff
 class CategoryModel {
   final String? id;
   final String categoryName;
   final String? createdAt;
   final String imageUrl;

   const CategoryModel({
     this.id,
     required this.categoryName,
     this.createdAt,
     required this.imageUrl,
   });
+
+  // COPY METHOD FOR CREATING MODIFIED INSTANCES
+  CategoryModel copyWith({
+    String? id,
+    String? categoryName,
+    String? createdAt,
+    String? imageUrl,
+  }) {
+    return CategoryModel(
+      id: id ?? this.id,
+      categoryName: categoryName ?? this.categoryName,
+      createdAt: createdAt ?? this.createdAt,
+      imageUrl: imageUrl ?? this.imageUrl,
+    );
+  }
+
+  // STRING REPRESENTATION FOR DEBUGGING
+  @override
+  String toString() => 'CategoryModel(id: $id, categoryName: $categoryName, '
+      'createdAt: $createdAt, imageUrl: $imageUrl)';
+
+  // EQUALITY IMPLEMENTATION
+  @override
+  bool operator ==(Object other) {
+    if (identical(this, other)) return true;
+    return other is CategoryModel &&
+        other.id == id &&
+        other.categoryName == categoryName &&
+        other.createdAt == createdAt &&
+        other.imageUrl == imageUrl;
+  }
+
+  @override
+  int get hashCode => Object.hash(id, categoryName, createdAt, imageUrl);
```


<!-- 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 CategoryModel {
  final String? id;
  final String categoryName;
  final String? createdAt;
  final String imageUrl;

  const CategoryModel({
    this.id,
    required this.categoryName,
    this.createdAt,
    required this.imageUrl,
  });

  // COPY METHOD FOR CREATING MODIFIED INSTANCES
  CategoryModel copyWith({
    String? id,
    String? categoryName,
    String? createdAt,
    String? imageUrl,
  }) {
    return CategoryModel(
      id: id ?? this.id,
      categoryName: categoryName ?? this.categoryName,
      createdAt: createdAt ?? this.createdAt,
      imageUrl: imageUrl ?? this.imageUrl,
    );
  }

  // STRING REPRESENTATION FOR DEBUGGING
  @override
  String toString() => 'CategoryModel(id: $id, categoryName: $categoryName, '
      'createdAt: $createdAt, imageUrl: $imageUrl)';

  // EQUALITY IMPLEMENTATION
  @override
  bool operator ==(Object other) {
    if (identical(this, other)) return true;
    return other is CategoryModel &&
        other.id == id &&
        other.categoryName == categoryName &&
        other.createdAt == createdAt &&
        other.imageUrl == imageUrl;
  }

  @override
  int get hashCode => Object.hash(id, categoryName, createdAt, imageUrl);
}
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:01Z
author_association: NONE
diff_hunk: @@ -0,0 +1,48 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+import 'package:edu_bridge_app/feature/category/widget/add_category_dialog.dart';
+import 'package:edu_bridge_app/feature/category/widget/category_grid_item.dart';
+
+class CategoriesView extends StatefulWidget {
+  const CategoriesView({super.key});
+
+  @override
+  State<CategoriesView> createState() => _CategoriesViewState();
+}
+
+class _CategoriesViewState extends State<CategoriesView> {
+  @override
+  Widget build(BuildContext context) {
+    return GetBuilder<CategoryController>(
+      builder: (controller) {
+        return CustomScaffold(
+          name: "All Categories",
+          floatingActionButton: OutlinedButton(
+            onPressed: () {
+              Get.dialog( AddCategoryDialog());
+            },
+            child: const Icon(Icons.add),
+          ),
path: lib/feature/category/view/categories_view.dart
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**UNCONVENTIONAL FLOATING ACTION BUTTON.**

USING OutlinedButton INSTEAD OF FloatingActionButton. NOT FOLLOWING MATERIAL DESIGN GUIDELINES.

```diff
-          floatingActionButton: OutlinedButton(
+          floatingActionButton: FloatingActionButton(
             onPressed: () {
-              Get.dialog( AddCategoryDialog());
+              Get.dialog(const AddCategoryDialog());
             },
-            child: const Icon(Icons.add),
+            child: const Icon(Icons.add),
           ),
```


<!-- 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
          floatingActionButton: FloatingActionButton(
            onPressed: () {
              Get.dialog(const AddCategoryDialog());
            },
            child: const Icon(Icons.add),
          ),
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:01Z
author_association: NONE
diff_hunk: @@ -0,0 +1,48 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+import 'package:edu_bridge_app/feature/category/widget/add_category_dialog.dart';
+import 'package:edu_bridge_app/feature/category/widget/category_grid_item.dart';
path: lib/feature/category/view/categories_view.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**MISSING EXPLICIT IMPORTS.**

EXPORT USAGE DETECTED BUT MISSING DIRECT IMPORT FOR CategoryController. RECOMMEND EXPLICIT IMPORTS.

```diff
 import 'package:edu_bridge_app/core/resources/export.dart';
 import 'package:edu_bridge_app/feature/category/widget/add_category_dialog.dart';
 import 'package:edu_bridge_app/feature/category/widget/category_grid_item.dart';
+import 'package:edu_bridge_app/feature/category/view_model/category_controller.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 'package:edu_bridge_app/core/resources/export.dart';
import 'package:edu_bridge_app/feature/category/widget/add_category_dialog.dart';
import 'package:edu_bridge_app/feature/category/widget/category_grid_item.dart';
import 'package:edu_bridge_app/feature/category/view_model/category_controller.dart';
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:01Z
author_association: NONE
diff_hunk: @@ -0,0 +1,48 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+import 'package:edu_bridge_app/feature/category/widget/add_category_dialog.dart';
+import 'package:edu_bridge_app/feature/category/widget/category_grid_item.dart';
+
+class CategoriesView extends StatefulWidget {
+  const CategoriesView({super.key});
+
+  @override
+  State<CategoriesView> createState() => _CategoriesViewState();
+}
+
+class _CategoriesViewState extends State<CategoriesView> {
+  @override
+  Widget build(BuildContext context) {
+    return GetBuilder<CategoryController>(
+      builder: (controller) {
+        return CustomScaffold(
+          name: "All Categories",
path: lib/feature/category/view/categories_view.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**HARDCODED STRING DETECTED.**

STRING "All Categories" NOT USING LOCALIZATION. INCONSISTENT WITH OTHER LOCALIZED STRINGS.

```diff
-          name: "All Categories",
+          name: "all_categories".tr,
```


<!-- 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
          name: "all_categories".tr,
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:01Z
author_association: NONE
diff_hunk: @@ -0,0 +1,48 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+import 'package:edu_bridge_app/feature/category/widget/add_category_dialog.dart';
+import 'package:edu_bridge_app/feature/category/widget/category_grid_item.dart';
+
+class CategoriesView extends StatefulWidget {
+  const CategoriesView({super.key});
+
+  @override
+  State<CategoriesView> createState() => _CategoriesViewState();
+}
path: lib/feature/category/view/categories_view.dart
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**UNNECESSARY STATEFUL WIDGET.**

WIDGET MAINTAINS NO STATE. CONVERT TO STATELESS WIDGET FOR IMPROVED PERFORMANCE.

```diff
-class CategoriesView extends StatefulWidget {
+class CategoriesView extends StatelessWidget {
   const CategoriesView({super.key});
-
-  @override
-  State<CategoriesView> createState() => _CategoriesViewState();
-}
-
-class _CategoriesViewState extends State<CategoriesView> {
   @override
   Widget build(BuildContext context) {
```

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:01Z
author_association: NONE
diff_hunk: @@ -0,0 +1,48 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+import 'package:edu_bridge_app/feature/category/widget/add_category_dialog.dart';
+import 'package:edu_bridge_app/feature/category/widget/category_grid_item.dart';
+
+class CategoriesView extends StatefulWidget {
+  const CategoriesView({super.key});
+
+  @override
+  State<CategoriesView> createState() => _CategoriesViewState();
+}
+
+class _CategoriesViewState extends State<CategoriesView> {
+  @override
+  Widget build(BuildContext context) {
+    return GetBuilder<CategoryController>(
+      builder: (controller) {
+        return CustomScaffold(
+          name: "All Categories",
+          floatingActionButton: OutlinedButton(
+            onPressed: () {
+              Get.dialog( AddCategoryDialog());
+            },
+            child: const Icon(Icons.add),
+          ),
+          body: Padding(
+            padding: const EdgeInsets.all(8.0),
+            child: controller.inProgress
+                ? const Center(child: CircularProgressIndicator())
+                : GridView.builder(
+                    gridDelegate:
+                        const SliverGridDelegateWithFixedCrossAxisCount(
+                      crossAxisCount: 2,
+                      crossAxisSpacing: 1,
+                      mainAxisSpacing: 1,
+                      childAspectRatio: 1,
+                    ),
+                    itemCount: controller.categories.length,
+                    itemBuilder: (context, index) {
+                      return CategoryGridItem(
+                          category: controller.categories[index]);
+                    },
+                  ),
path: lib/feature/category/view/categories_view.dart
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**MISSING EMPTY AND ERROR STATES.**

NO HANDLING FOR EMPTY CATEGORIES LIST OR ERROR STATES. POOR USER EXPERIENCE.

```diff
           body: Padding(
             padding: const EdgeInsets.all(8.0),
-            child: controller.inProgress
-                ? const Center(child: CircularProgressIndicator())
-                : GridView.builder(
-                    gridDelegate:
-                        const SliverGridDelegateWithFixedCrossAxisCount(
-                      crossAxisCount: 2,
-                      crossAxisSpacing: 1,
-                      mainAxisSpacing: 1,
-                      childAspectRatio: 1,
-                    ),
-                    itemCount: controller.categories.length,
-                    itemBuilder: (context, index) {
-                      return CategoryGridItem(
-                          category: controller.categories[index]);
-                    },
-                  ),
+            child: () {
+              if (controller.hasError) {
+                return Center(
+                  child: Column(
+                    mainAxisAlignment: MainAxisAlignment.center,
+                    children: [
+                      CustomText(text: 'error_loading_categories'.tr),
+                      const SizedBox(height: 16),
+                      ElevatedButton(
+                        onPressed: controller.fetchCategories,
+                        child: CustomText(text: 'retry'.tr),
+                      ),
+                    ],
+                  ),
+                );
+              }
+              
+              if (controller.inProgress) {
+                return const Center(child: CircularProgressIndicator());
+              }
+              
+              if (controller.categories.isEmpty) {
+                return Center(
+                  child: CustomText(text: 'no_categories_available'.tr),
+                );
+              }
+              
+              return RefreshIndicator(
+                onRefresh: () async => controller.fetchCategories(),
+                child: GridView.builder(
+                  gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
+                    crossAxisCount: 2,
+                    crossAxisSpacing: 8,
+                    mainAxisSpacing: 8,
+                    childAspectRatio: 1,
+                  ),
+                  itemCount: controller.categories.length,
+                  itemBuilder: (context, index) {
+                    return CategoryGridItem(
+                        category: controller.categories[index]);
+                  },
+                ),
+              );
+            }(),
```


<!-- 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
           body: Padding(
             padding: const EdgeInsets.all(8.0),
             child: () {
               if (controller.hasError) {
                 return Center(
                   child: Column(
                     mainAxisAlignment: MainAxisAlignment.center,
                     children: [
                       CustomText(text: 'error_loading_categories'.tr),
                       const SizedBox(height: 16),
                       ElevatedButton(
                         onPressed: controller.fetchCategories,
                         child: CustomText(text: 'retry'.tr),
                       ),
                     ],
                   ),
                 );
               }

               if (controller.inProgress) {
                 return const Center(child: CircularProgressIndicator());
               }

               if (controller.categories.isEmpty) {
                 return Center(
                   child: CustomText(text: 'no_categories_available'.tr),
                 );
               }

               return RefreshIndicator(
                 onRefresh: () async => controller.fetchCategories(),
                 child: GridView.builder(
                   gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
                     crossAxisCount: 2,
                     crossAxisSpacing: 8,
                     mainAxisSpacing: 8,
                     childAspectRatio: 1,
                   ),
                   itemCount: controller.categories.length,
                   itemBuilder: (context, index) {
                     return CategoryGridItem(
                       category: controller.categories[index],
                     );
                   },
                 ),
               );
             }(),
           ),
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:01Z
author_association: NONE
diff_hunk: @@ -0,0 +1,71 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
+class CategoryRepository extends ICategoryRepository {
+  final INetworkCaller _networkCaller;
+
+  CategoryRepository({required INetworkCaller networkCaller})
+      : _networkCaller = networkCaller;
+
+  @override
+  Future<String?> uploadCategoryImage(File imageFile) async {
+    final fileName = '${DateTime.now().millisecondsSinceEpoch}.jpg';
+    final filePath = 'category_images/$fileName';
+    final response = await _networkCaller.uploadFile(
+      bucketName: 'category_images',
+      filePath: filePath,
+      file: imageFile,
+    );
+    return _handleFileUploadResponse(response);
+  }
path: lib/feature/category/repo/category_repository.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**FUNCTION IMPLEMENTATION REVIEW: IMAGE UPLOAD PATH CONSTRUCTION.**

ANALYZING FILE UPLOAD LOGIC... DETECTED: TIMESTAMP-BASED FILENAME GENERATION IS SATISFACTORY FOR UNIQUENESS.

POTENTIAL SECURITY CONCERN: NO VALIDATION OF IMAGE FILE CONTENT TYPE OR SIZE LIMITS BEFORE UPLOAD.

POTENTIAL OPTIMIZATION: CONSIDER IMPLEMENTING COMPRESSION BEFORE UPLOAD TO REDUCE BANDWIDTH USAGE.

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:02Z
author_association: NONE
diff_hunk: @@ -0,0 +1,71 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
+class CategoryRepository extends ICategoryRepository {
+  final INetworkCaller _networkCaller;
+
+  CategoryRepository({required INetworkCaller networkCaller})
+      : _networkCaller = networkCaller;
+
+  @override
+  Future<String?> uploadCategoryImage(File imageFile) async {
+    final fileName = '${DateTime.now().millisecondsSinceEpoch}.jpg';
+    final filePath = 'category_images/$fileName';
+    final response = await _networkCaller.uploadFile(
+      bucketName: 'category_images',
+      filePath: filePath,
+      file: imageFile,
+    );
+    return _handleFileUploadResponse(response);
+  }
+
+  @override
+  Future<bool> addCategory(CategoryModel category) async {
+    final response = await _networkCaller.postRequest(
+      tableName: 'categories',
+      data: category.toMap(),
+    );
+    return _handlePostResponse(response);
+  }
+
+  @override
+  Future<List<CategoryModel>> fetchCategories() async {
+    final response = await _networkCaller.getRequest(
+      tableName: 'categories',
+    );
+    return _handleGetResponse(response);
+  }
path: lib/feature/category/repo/category_repository.dart
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**FUNCTION IMPLEMENTATION REVIEW: FETCH OPERATIONS.**

ANALYZING DATA RETRIEVAL OPERATIONS... FETCH METHODS CORRECTLY IMPLEMENTED.

ISSUE DETECTED: HARDCODED STRING VALUES FOR TABLE NAME ("categories"). THIS REDUCES CODE MAINTAINABILITY.

```diff
+  static const String _tableName = 'categories';

   @override
   Future<List<CategoryModel>> fetchCategories() async {
     final response = await _networkCaller.getRequest(
-      tableName: 'categories',
+      tableName: _tableName,
     );
     return _handleGetResponse(response);
   }

   @override
   Future<List<CategoryModel>> fetchCategoriesWithCondition({
     required String column,
     required dynamic value,
   }) async {
     final response = await _networkCaller.getRequest(
-      tableName: 'categories',
+      tableName: _tableName,
     );
     return _handleGetResponse(response);
   }
```



Also applies to: 38-48

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:02Z
author_association: NONE
diff_hunk: @@ -0,0 +1,71 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
+class CategoryRepository extends ICategoryRepository {
+  final INetworkCaller _networkCaller;
+
+  CategoryRepository({required INetworkCaller networkCaller})
+      : _networkCaller = networkCaller;
+
+  @override
+  Future<String?> uploadCategoryImage(File imageFile) async {
+    final fileName = '${DateTime.now().millisecondsSinceEpoch}.jpg';
+    final filePath = 'category_images/$fileName';
+    final response = await _networkCaller.uploadFile(
+      bucketName: 'category_images',
+      filePath: filePath,
+      file: imageFile,
+    );
+    return _handleFileUploadResponse(response);
+  }
+
+  @override
+  Future<bool> addCategory(CategoryModel category) async {
+    final response = await _networkCaller.postRequest(
+      tableName: 'categories',
+      data: category.toMap(),
+    );
+    return _handlePostResponse(response);
+  }
+
+  @override
+  Future<List<CategoryModel>> fetchCategories() async {
+    final response = await _networkCaller.getRequest(
+      tableName: 'categories',
+    );
+    return _handleGetResponse(response);
+  }
+
+  @override
+  Future<List<CategoryModel>> fetchCategoriesWithCondition({
+    required String column,
+    required dynamic value,
+  }) async {
+    final response = await _networkCaller.getRequest(
+      tableName: 'categories',
+      queryParams: {column: value},
+    );
+    return _handleGetResponse(response);
+  }
+
+  List<CategoryModel> _handleGetResponse(ApiResponse response) {
+    if (response.isSuccess) {
+      return (response.responseData as List)
+          .map((data) => CategoryModel.fromMap(data, data['id']))
+          .toList();
+    } else {
+      return [];
+    }
+  }
+
+  String? _handleFileUploadResponse(ApiResponse response) {
+    if (response.isSuccess) {
+      return response.responseData;
+    } else {
+      return null;
+    }
+  }
+
+  bool _handlePostResponse(ApiResponse response) {
+    return response.isSuccess;
+  }
path: lib/feature/category/repo/category_repository.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**FUNCTION IMPLEMENTATION REVIEW: HELPER METHODS.**

ANALYZING HELPER METHODS... DETECTED: MINIMAL ERROR HANDLING.

CONCERN: SILENT FAILURES DETECTED IN ERROR HANDLING LOGIC. METHOD RETURNS NULL OR EMPTY RESULTS WITHOUT LOGGING OR PROPAGATING ERROR DETAILS.

RECOMMENDATION: ENHANCE ERROR HANDLING BY LOGGING DETAILS AND CONSIDERING ERROR PROPAGATION FOR BETTER DEBUGGING.

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:02Z
author_association: NONE
diff_hunk: @@ -0,0 +1,71 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
+class CategoryRepository extends ICategoryRepository {
+  final INetworkCaller _networkCaller;
+
+  CategoryRepository({required INetworkCaller networkCaller})
+      : _networkCaller = networkCaller;
+
+  @override
+  Future<String?> uploadCategoryImage(File imageFile) async {
+    final fileName = '${DateTime.now().millisecondsSinceEpoch}.jpg';
+    final filePath = 'category_images/$fileName';
+    final response = await _networkCaller.uploadFile(
+      bucketName: 'category_images',
+      filePath: filePath,
+      file: imageFile,
+    );
+    return _handleFileUploadResponse(response);
+  }
+
+  @override
+  Future<bool> addCategory(CategoryModel category) async {
+    final response = await _networkCaller.postRequest(
+      tableName: 'categories',
+      data: category.toMap(),
+    );
+    return _handlePostResponse(response);
+  }
+
+  @override
+  Future<List<CategoryModel>> fetchCategories() async {
+    final response = await _networkCaller.getRequest(
+      tableName: 'categories',
+    );
+    return _handleGetResponse(response);
+  }
+
+  @override
+  Future<List<CategoryModel>> fetchCategoriesWithCondition({
+    required String column,
+    required dynamic value,
+  }) async {
+    final response = await _networkCaller.getRequest(
+      tableName: 'categories',
+      queryParams: {column: value},
+    );
+    return _handleGetResponse(response);
+  }
+
+  List<CategoryModel> _handleGetResponse(ApiResponse response) {
+    if (response.isSuccess) {
+      return (response.responseData as List)
+          .map((data) => CategoryModel.fromMap(data, data['id']))
+          .toList();
+    } else {
+      return [];
+    }
+  }
path: lib/feature/category/repo/category_repository.dart
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**FUNCTION IMPLEMENTATION REVIEW: RESPONSE HANDLING.**

DATA TRANSFORMATION ANALYSIS COMPLETE. DETECTED POTENTIAL ISSUE: INSUFFICIENT ERROR HANDLING.

CONCERN: RESPONSE DATA STRUCTURE ASSUMED WITHOUT VALIDATION. IF SERVER RETURNS UNEXPECTED DATA STRUCTURE, THIS MAY CAUSE RUNTIME EXCEPTIONS.

```diff
   List<CategoryModel> _handleGetResponse(ApiResponse response) {
     if (response.isSuccess) {
+      if (response.responseData == null || !(response.responseData is List)) {
+        return [];
+      }
       return (response.responseData as List)
-          .map((data) => CategoryModel.fromMap(data, data['id']))
+          .map((data) => data is Map ? CategoryModel.fromMap(data, data['id']) : null)
+          .where((model) => model != null)
+          .cast<CategoryModel>()
           .toList();
     } else {
+      // Consider logging error details here
       return [];
     }
   }
```



<!-- 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
  List<CategoryModel> _handleGetResponse(ApiResponse response) {
    if (response.isSuccess) {
      if (response.responseData == null || !(response.responseData is List)) {
        return [];
      }
      return (response.responseData as List)
          .map((data) => data is Map
              ? CategoryModel.fromMap(data, data['id'])
              : null)
          .where((model) => model != null)
          .cast<CategoryModel>()
          .toList();
    } else {
      // Consider logging error details here
      return [];
    }
  }
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:02Z
author_association: NONE
diff_hunk: @@ -0,0 +1,94 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
+class CategoryController extends GetxController {
+  final ICategoryRepository _repository;
+  CategoryController({required ICategoryRepository repository})
+      : _repository = repository;
+
+  bool _inProgress = false;
+  bool get inProgress => _inProgress;
+
+  File? _categoryImage;
+  File? get categoryImage => _categoryImage;
+
+  String? _errorMessage;
+  String? get errorMessage => _errorMessage;
+
+  List<CategoryModel> _categories = [];
+  List<CategoryModel> get categories => _categories;
+
+  final ImagePicker _picker = ImagePicker();
+
+  @override
+  void onInit() {
+    super.onInit();
+    fetchCategories();
+  }
+
+  void pickCategoryImage() async {
+    final pickedFile = await _picker.pickImage(source: ImageSource.gallery);
+    if (pickedFile != null) {
+      _categoryImage = File(pickedFile.path);
+      update();
+    }
+  }
+
+  Future<bool> addCategory(String categoryName) async {
+    if (categoryName.isEmpty || _categoryImage == null) {
+      SnackBarUtil.showError(
+          "Error", "Please enter category name and select an image");
+      return false;
+    }
+
+    bool isSuccess = false;
+    _inProgress = true;
+    _errorMessage = null;
+    update();
+
+    final imageUrl = await _repository.uploadCategoryImage(_categoryImage!);
+    if (imageUrl != null) {
+      final newCategory = CategoryModel(
+        categoryName: categoryName,
+        imageUrl: imageUrl,
+      );
+
+      final success = await _repository.addCategory(newCategory);
+      if (success) {
+        isSuccess = true;
+        fetchCategories();
+        SnackBarUtil.showSuccess("Success", "Category added successfully!");
+      } else {
+        _errorMessage = "Failed to add category.";
+        SnackBarUtil.showError("Error", _errorMessage!);
+      }
+    } else {
+      _errorMessage = "Image upload failed.";
+      SnackBarUtil.showError("Error", _errorMessage!);
+    }
+
+    _inProgress = false;
+    update();
+    return isSuccess;
+  }
+
+  Future<void> fetchCategories() async {
+    _inProgress = true;
+    _errorMessage = null;
+    update();
+
+    try {
+      _categories = await _repository.fetchCategories();
+    } catch (e) {
+      _errorMessage = 'Failed to load categories: $e';
+      SnackBarUtil.showError("Error", _errorMessage!);
+    }
+
+    _inProgress = false;
+    update();
+  }
+
+  void clearFields() {
+    _categoryImage = null;
+    update();
+  }
path: lib/feature/category/view_model/category_controller.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**FUNCTION IMPLEMENTATION REVIEW: CLEAR FIELDS.**

ANALYZING STATE CLEARING FUNCTION... DETECTED: INCOMPLETE FIELD CLEARING.

CONCERN: METHOD ONLY CLEARS IMAGE BUT NOT OTHER POTENTIAL FORM STATE.

```diff
   void clearFields() {
     _categoryImage = null;
+    _errorMessage = null;
     update();
   }
```



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

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:02Z
author_association: NONE
diff_hunk: @@ -0,0 +1,94 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
+class CategoryController extends GetxController {
+  final ICategoryRepository _repository;
+  CategoryController({required ICategoryRepository repository})
+      : _repository = repository;
+
+  bool _inProgress = false;
+  bool get inProgress => _inProgress;
+
+  File? _categoryImage;
+  File? get categoryImage => _categoryImage;
+
+  String? _errorMessage;
+  String? get errorMessage => _errorMessage;
+
+  List<CategoryModel> _categories = [];
+  List<CategoryModel> get categories => _categories;
+
+  final ImagePicker _picker = ImagePicker();
+
+  @override
+  void onInit() {
+    super.onInit();
+    fetchCategories();
+  }
+
+  void pickCategoryImage() async {
+    final pickedFile = await _picker.pickImage(source: ImageSource.gallery);
+    if (pickedFile != null) {
+      _categoryImage = File(pickedFile.path);
+      update();
+    }
+  }
+
+  Future<bool> addCategory(String categoryName) async {
+    if (categoryName.isEmpty || _categoryImage == null) {
+      SnackBarUtil.showError(
+          "Error", "Please enter category name and select an image");
+      return false;
+    }
+
+    bool isSuccess = false;
+    _inProgress = true;
+    _errorMessage = null;
+    update();
+
+    final imageUrl = await _repository.uploadCategoryImage(_categoryImage!);
+    if (imageUrl != null) {
+      final newCategory = CategoryModel(
+        categoryName: categoryName,
+        imageUrl: imageUrl,
+      );
+
+      final success = await _repository.addCategory(newCategory);
+      if (success) {
+        isSuccess = true;
+        fetchCategories();
+        SnackBarUtil.showSuccess("Success", "Category added successfully!");
+      } else {
+        _errorMessage = "Failed to add category.";
+        SnackBarUtil.showError("Error", _errorMessage!);
+      }
+    } else {
+      _errorMessage = "Image upload failed.";
+      SnackBarUtil.showError("Error", _errorMessage!);
+    }
+
+    _inProgress = false;
+    update();
+    return isSuccess;
+  }
+
+  Future<void> fetchCategories() async {
+    _inProgress = true;
+    _errorMessage = null;
+    update();
+
+    try {
+      _categories = await _repository.fetchCategories();
+    } catch (e) {
+      _errorMessage = 'Failed to load categories: $e';
+      SnackBarUtil.showError("Error", _errorMessage!);
+    }
+
+    _inProgress = false;
+    update();
+  }
path: lib/feature/category/view_model/category_controller.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**FUNCTION IMPLEMENTATION REVIEW: FETCH CATEGORIES.**

ANALYZING DATA FETCH OPERATION... DETECTED: PROPER STATE MANAGEMENT WITH TRY-CATCH ERROR HANDLING.

POTENTIAL IMPROVEMENT: CONSIDER IMPLEMENTING PAGINATION OR FILTERING OPTIONS FOR LARGE DATASETS.

```diff
   Future<void> fetchCategories() async {
     _inProgress = true;
     _errorMessage = null;
     update();

     try {
-      _categories = await _repository.fetchCategories();
+      // Consider implementing pagination for large datasets
+      _categories = await _repository.fetchCategories();
+      if (_categories.isEmpty) {
+        // Add appropriate messaging for empty state
+      }
     } catch (e) {
       _errorMessage = 'Failed to load categories: $e';
       SnackBarUtil.showError("Error", _errorMessage!);
     }

     _inProgress = false;
     update();
   }
```



<!-- 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
  Future<void> fetchCategories() async {
    _inProgress = true;
    _errorMessage = null;
    update();

    try {
      // Consider implementing pagination for large datasets
      _categories = await _repository.fetchCategories();
      if (_categories.isEmpty) {
        // Add appropriate messaging for empty state
      }
    } catch (e) {
      _errorMessage = 'Failed to load categories: $e';
      SnackBarUtil.showError("Error", _errorMessage!);
    }

    _inProgress = false;
    update();
  }
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:02Z
author_association: NONE
diff_hunk: @@ -0,0 +1,94 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
+class CategoryController extends GetxController {
+  final ICategoryRepository _repository;
+  CategoryController({required ICategoryRepository repository})
+      : _repository = repository;
+
+  bool _inProgress = false;
+  bool get inProgress => _inProgress;
+
+  File? _categoryImage;
+  File? get categoryImage => _categoryImage;
+
+  String? _errorMessage;
+  String? get errorMessage => _errorMessage;
+
+  List<CategoryModel> _categories = [];
+  List<CategoryModel> get categories => _categories;
+
+  final ImagePicker _picker = ImagePicker();
+
+  @override
+  void onInit() {
+    super.onInit();
+    fetchCategories();
+  }
+
+  void pickCategoryImage() async {
+    final pickedFile = await _picker.pickImage(source: ImageSource.gallery);
+    if (pickedFile != null) {
+      _categoryImage = File(pickedFile.path);
+      update();
+    }
+  }
+
+  Future<bool> addCategory(String categoryName) async {
+    if (categoryName.isEmpty || _categoryImage == null) {
+      SnackBarUtil.showError(
+          "Error", "Please enter category name and select an image");
+      return false;
+    }
+
+    bool isSuccess = false;
+    _inProgress = true;
+    _errorMessage = null;
+    update();
+
+    final imageUrl = await _repository.uploadCategoryImage(_categoryImage!);
+    if (imageUrl != null) {
+      final newCategory = CategoryModel(
+        categoryName: categoryName,
+        imageUrl: imageUrl,
+      );
+
+      final success = await _repository.addCategory(newCategory);
+      if (success) {
+        isSuccess = true;
+        fetchCategories();
+        SnackBarUtil.showSuccess("Success", "Category added successfully!");
+      } else {
+        _errorMessage = "Failed to add category.";
+        SnackBarUtil.showError("Error", _errorMessage!);
+      }
+    } else {
+      _errorMessage = "Image upload failed.";
+      SnackBarUtil.showError("Error", _errorMessage!);
+    }
+
+    _inProgress = false;
+    update();
+    return isSuccess;
+  }
path: lib/feature/category/view_model/category_controller.dart
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**FUNCTION IMPLEMENTATION REVIEW: ADD CATEGORY.**

ANALYZING CATEGORY ADDITION FUNCTION... DETECTED: LOGICAL FLOW WITH VALIDATION, STATE MANAGEMENT, AND FEEDBACK.

CRITICAL ISSUE DETECTED: LACK OF ERROR HANDLING DURING NETWORK OPERATIONS.

```diff
   Future<bool> addCategory(String categoryName) async {
     if (categoryName.isEmpty || _categoryImage == null) {
       SnackBarUtil.showError(
           "Error", "Please enter category name and select an image");
       return false;
     }

     bool isSuccess = false;
     _inProgress = true;
     _errorMessage = null;
     update();

-    final imageUrl = await _repository.uploadCategoryImage(_categoryImage!);
+    String? imageUrl;
+    try {
+      imageUrl = await _repository.uploadCategoryImage(_categoryImage!);
+    } catch (e) {
+      _errorMessage = "Image upload failed: ${e.toString()}";
+      SnackBarUtil.showError("Error", _errorMessage!);
+      _inProgress = false;
+      update();
+      return false;
+    }
+    
     if (imageUrl != null) {
       final newCategory = CategoryModel(
         categoryName: categoryName,
         imageUrl: imageUrl,
       );

-      final success = await _repository.addCategory(newCategory);
+      bool success = false;
+      try {
+        success = await _repository.addCategory(newCategory);
+      } catch (e) {
+        _errorMessage = "Failed to add category: ${e.toString()}";
+        SnackBarUtil.showError("Error", _errorMessage!);
+        _inProgress = false;
+        update();
+        return false;
+      }
+      
       if (success) {
         isSuccess = true;
         fetchCategories();
         SnackBarUtil.showSuccess("Success", "Category added successfully!");
       } else {
         _errorMessage = "Failed to add category.";
         SnackBarUtil.showError("Error", _errorMessage!);
       }
     } else {
       _errorMessage = "Image upload failed.";
       SnackBarUtil.showError("Error", _errorMessage!);
     }

     _inProgress = false;
     update();
     return isSuccess;
   }
```



<!-- 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
  Future<bool> addCategory(String categoryName) async {
    if (categoryName.isEmpty || _categoryImage == null) {
      SnackBarUtil.showError(
          "Error", "Please enter category name and select an image");
      return false;
    }

    bool isSuccess = false;
    _inProgress = true;
    _errorMessage = null;
    update();

    // Wrap image upload in try/catch
    String? imageUrl;
    try {
      imageUrl = await _repository.uploadCategoryImage(_categoryImage!);
    } catch (e) {
      _errorMessage = "Image upload failed: ${e.toString()}";
      SnackBarUtil.showError("Error", _errorMessage!);
      _inProgress = false;
      update();
      return false;
    }

    if (imageUrl != null) {
      final newCategory = CategoryModel(
        categoryName: categoryName,
        imageUrl: imageUrl,
      );

      // Wrap addCategory in try/catch
      bool success = false;
      try {
        success = await _repository.addCategory(newCategory);
      } catch (e) {
        _errorMessage = "Failed to add category: ${e.toString()}";
        SnackBarUtil.showError("Error", _errorMessage!);
        _inProgress = false;
        update();
        return false;
      }

      if (success) {
        isSuccess = true;
        fetchCategories();
        SnackBarUtil.showSuccess("Success", "Category added successfully!");
      } else {
        _errorMessage = "Failed to add category.";
        SnackBarUtil.showError("Error", _errorMessage!);
      }
    } else {
      _errorMessage = "Image upload failed.";
      SnackBarUtil.showError("Error", _errorMessage!);
    }

    _inProgress = false;
    update();
    return isSuccess;
  }
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:02Z
author_association: NONE
diff_hunk: @@ -0,0 +1,94 @@
+import 'package:edu_bridge_app/core/resources/export.dart';
+
+class CategoryController extends GetxController {
+  final ICategoryRepository _repository;
+  CategoryController({required ICategoryRepository repository})
+      : _repository = repository;
+
+  bool _inProgress = false;
+  bool get inProgress => _inProgress;
+
+  File? _categoryImage;
+  File? get categoryImage => _categoryImage;
+
+  String? _errorMessage;
+  String? get errorMessage => _errorMessage;
+
+  List<CategoryModel> _categories = [];
+  List<CategoryModel> get categories => _categories;
+
+  final ImagePicker _picker = ImagePicker();
+
+  @override
+  void onInit() {
+    super.onInit();
+    fetchCategories();
+  }
+
+  void pickCategoryImage() async {
+    final pickedFile = await _picker.pickImage(source: ImageSource.gallery);
+    if (pickedFile != null) {
+      _categoryImage = File(pickedFile.path);
+      update();
+    }
+  }
path: lib/feature/category/view_model/category_controller.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**FUNCTION IMPLEMENTATION REVIEW: IMAGE PICKING.**

IMAGE SELECTION ANALYSIS COMPLETE. METHOD FUNCTIONS AS EXPECTED.

POTENTIAL IMPROVEMENT: NO IMAGE VALIDATION OR SIZE CONSTRAINTS. CONSIDER ADDING:
1. FILE SIZE VALIDATION
2. IMAGE TYPE VERIFICATION
3. OPTIONAL COMPRESSION

```diff
   void pickCategoryImage() async {
+    _inProgress = true;
+    update();
     final pickedFile = await _picker.pickImage(
-      source: ImageSource.gallery
+      source: ImageSource.gallery,
+      imageQuality: 80, // Compress image
+      maxWidth: 800,    // Limit dimensions
     );
     if (pickedFile != null) {
+      // Validate file size
+      final file = File(pickedFile.path);
+      final fileSize = await file.length();
+      if (fileSize > 2 * 1024 * 1024) { // 2MB limit
+        SnackBarUtil.showError("Error", "Image too large (max 2MB)");
+        _inProgress = false;
+        update();
+        return;
+      }
       _categoryImage = File(pickedFile.path);
-      update();
     }
+    _inProgress = false;
+    update();
   }
```



<!-- 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
  void pickCategoryImage() async {
    _inProgress = true;
    update();
    final pickedFile = await _picker.pickImage(
      source: ImageSource.gallery,
      imageQuality: 80, // Compress image
      maxWidth: 800,    // Limit dimensions
    );
    if (pickedFile != null) {
      // Validate file size
      final file = File(pickedFile.path);
      final fileSize = await file.length();
      if (fileSize > 2 * 1024 * 1024) { // 2MB limit
        SnackBarUtil.showError("Error", "Image too large (max 2MB)");
        _inProgress = false;
        update();
        return;
      }
      _categoryImage = File(pickedFile.path);
    }
    _inProgress = false;
    update();
  }
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-25T10:31:02Z
author_association: NONE

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

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

## Summary by CodeRabbit

- **New Features**
  - Introduced a new screen to view all categories in a grid layout.
  - Added the ability to add new categories, including uploading an image and specifying a category name.
  - Provided a dialog interface for adding categories with image preview and validation.
  - Enabled tapping on a category to navigate to a related view.

- **Improvements**
  - Enhanced user feedback with loading indicators and error/success messages during category management actions.
## Walkthrough

Beep boop. New category management functionality has been implemented. This includes the introduction of a `CategoryModel` data class, a repository interface and implementation for category data operations, a controller for managing category state and logic, and user interface components for displaying and adding categories. The UI uses grid layouts and dialogs, and integrates with image picking and network operations. All new classes and widgets are organized within the category feature module.

## Changes

| File(s)                                                                                      | Change Summary                                                                                         |
|---------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|
| `lib/feature/category/model/category_model.dart`                                            | Added `CategoryModel` class with serialization, deserialization, and required fields.                  |
| `lib/feature/category/repo/category_repository.dart`,<br>`lib/feature/category/repo/i_category_repository.dart` | Introduced repository interface (`ICategoryRepository`) and its implementation (`CategoryRepository`) for category data operations (CRUD, image upload, filtering). |
| `lib/feature/category/view_model/category_controller.dart`                                  | Added `CategoryController` for managing category state, image picking, and interaction with repository.|
| `lib/feature/category/view/categories_view.dart`                                            | Added `CategoriesView` widget for displaying categories in a grid with a floating action button.       |
| `lib/feature/category/widget/add_category_dialog.dart`                                      | Added `AddCategoryDialog` widget for inputting category name and image, and triggering add operation.  |
| `lib/feature/category/widget/category_grid_item.dart`                                       | Added `CategoryGridItem` widget for displaying a single category and handling navigation on tap.       |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant User
    participant CategoriesView
    participant CategoryController
    participant CategoryRepository
    participant Network

    User->>CategoriesView: Opens Categories Screen
    CategoriesView->>CategoryController: On Init, fetchCategories()
    CategoryController->>CategoryRepository: fetchCategories()
    CategoryRepository->>Network: GET categories
    Network-->>CategoryRepository: Response (list of categories)
    CategoryRepository-->>CategoryController: List<CategoryModel>
    CategoryController-->>CategoriesView: Update UI with categories

    User->>CategoriesView: Tap Floating Action Button
    CategoriesView->>AddCategoryDialog: Show dialog
    User->>AddCategoryDialog: Enter name, pick image
    AddCategoryDialog->>CategoryController: addCategory(name)
    CategoryController->>CategoryRepository: uploadCategoryImage(image)
    CategoryRepository->>Network: Upload image file
    Network-->>CategoryRepository: Image URL
    CategoryRepository-->>CategoryController: Image URL
    CategoryController->>CategoryRepository: addCategory(CategoryModel)
    CategoryRepository->>Network: POST new category
    Network-->>CategoryRepository: Success/Failure
    CategoryRepository-->>CategoryController: Result
    CategoryController->>AddCategoryDialog: Notify success/failure
    CategoryController->>CategoryController: fetchCategories() (refresh)
```

## Poem

> 01001000! New code deployed,  
> Categories now are robot-enjoyed.  
> Grid views, dialogs, images picked,  
> Data flows smooth, logic is slicked.  
> Repository, model, controller unite—  
> Category management is now a delight.  
> 🤖 Beep boop, mission complete tonight!

</details>

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


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNxU3bABsvkCiQBH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IjPh2gG3mbbo5w2yPRuOp+ph3q5oJADTCeMCJQODJnFuH3hbBQPQBPEWUMqdGQMmJfMkAAKwHBFzCc5AQzSEIvVSUv4I8pWlWpfXW3/xT6vSspfT5SPDzrPCaqbjTJmUBl/gmhgg0Aq2/w64wX+qUIQTFvDls3/PKfIB+QJRXQdxjtxodXiftwAsIHzApZUCcxMeQlwe0zPMpb/Dlka33TW0ceIFbidgwGICdha20ySt/rikZgzAIBpzU2QTegtT3QkottmzRe0AAyGddiSGoAoYxBcvo1oYaAED/1OF10jBoYAAaKWNNgKS5chPbYyl8VD+eqh25I7u5mh47cjU7rDG29A5hSHPZUZCFJcFlw2qFVzz5hxvDZu67olH7OYXoYZ37UZR7ULaicMQcEazIcqX+9Gkq/nvC2wCHIYbrj7RuxEBgIkL84ZVE0kixCSjE7AXAVAKkqzGkPEqE2kagukQkBkH3pECgrA6g37HUco/g0xdAco50ro+khkn3BwtwgnbQAgtwaAgnAggnAAbLcBTwAOwU9oAAAsNPRwDAAAHAcAAJw0+3CqC0AADMfPFPrPHPHPrPfPrJ88OPRkUAjESPvoRoaPZ48o5EOPQAA -->

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

---

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<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/ode-to-code&utm_content=121):

- 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 generate sequence diagram` to generate a sequence diagram of the changes in 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-25T10:25:39Z
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/5e7bc9b4-73cc-4ec5-9825-89dc0b64b837?refs=025fb2a5b562676a471c80972bbd33689983ffef&source=prChecksComment)



author_association: CONTRIBUTOR
user: login: sonarqubecloud[bot]
created_at: 2025-04-25T10:27:40Z
body: ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=Learnathon-By-Geeky-Solutions_ode-to-code&pullRequest=121) **Quality Gate failed**  
Failed conditions  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [7.2% Coverage on New Code](https://sonarcloud.io/component_measures?id=Learnathon-By-Geeky-Solutions_ode-to-code&pullRequest=121&metric=new_coverage&view=list) (required ≥ 80%)  
  
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=Learnathon-By-Geeky-Solutions_ode-to-code&pullRequest=121)


author_association: NONE