Skip to content

Feature/user profile#37

Merged
tqha1011 merged 12 commits intomainfrom
feature/user-profile
Apr 17, 2026
Merged

Feature/user profile#37
tqha1011 merged 12 commits intomainfrom
feature/user-profile

Conversation

@tqha1011
Copy link
Copy Markdown
Owner

@tqha1011 tqha1011 commented Apr 17, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added AI-powered chatbot assistant (TaskBot) for intelligent task management via conversational interface
    • Implemented dynamic category management with user-profile-based categories
    • Added custom tag creation functionality
    • Introduced activity heatmap displaying task completion history on user profile
    • Enhanced color adaptation for improved dark mode support
  • Improvements

    • Reorganized category and tag selection across task creation and detail screens

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 17, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR introduces a comprehensive task management enhancement with three major features: a new category system with dynamic UI selection, an AI-powered chatbot assistant integrated with Google Generative AI for task creation, and a refactored tag system. It also updates the user profile model to include activity heatmap data and modifies the task model to use structured category objects instead of strings. Supporting database migrations add server-side RPC functions for user profile statistics and AI-assisted task creation.

Changes

Cohort / File(s) Summary
Color Adaptation Utility
src/lib/core/utils/adaptive_color_extension.dart
New AdaptiveColorExtension adds theme-aware color adaptation by interpolating colors toward white in dark mode to improve visibility.
Category Feature
src/lib/features/category/model/category_model.dart, src/lib/features/category/repository/category_repository.dart, src/lib/features/category/viewmodel/category_viewmodel.dart, src/lib/features/category/view/widgets/category_choice_chips.dart
Complete category system with model (immutable with hex color parsing), repository (Supabase-backed fetching), viewmodel (state management with loading/error), and UI widget (adaptive color choice chips for selection).
ChatBot AI Feature
src/lib/features/chatbot/model/chatmessage_model.dart, src/lib/features/chatbot/services/chatbot_services.dart, src/lib/features/chatbot/viewmodel/chatbot_viewmodel.dart, src/lib/features/chatbot/view/chatbot_view.dart, src/lib/features/chatbot/view/widgets/{bot_avatar,chat_header,day_separator,message_composer,message_tile,typing_indicator,user_avatar}.dart
Complete chatbot implementation with Google Generative AI integration, local chat history persistence (SharedPreferences), Supabase RPC task creation, message models with serialization, viewmodel for state/lifecycle management, and comprehensive UI widgets (avatars, message bubbles, input composer, typing indicator, headers).
Tag Feature Refactor
src/lib/features/tag/model/tag_model.dart, src/lib/features/tag/repository/tag_repository.dart, src/lib/features/tag/viewmodel/tag_viewmodel.dart, src/lib/features/tag/view/widgets/tag_selector.dart
New tag system extracted from task viewmodel: model with color parsing, repository with fetch/create operations, viewmodel with selection state and custom tag creation (with palette-based color generation), and UI widget (chip-based selector with custom tag creation dialog).
Task Model & Views Updates
src/lib/features/tasks/model/task_model.dart, src/lib/features/tasks/view/screens/create_task_screen.dart, src/lib/features/tasks/view/screens/task_detail_screen.dart, src/lib/features/tasks/view/widgets/tag_selector.dart, src/lib/features/tasks/viewmodel/task_viewmodel.dart
Task model refactored to use CategoryModel instead of String for categories; legacy tag management removed from viewmodel and delegated to TagViewModel; UI screens updated to use CategoryViewModel and TagViewModel for data and selection; local TagSelector widget replaced with feature-level tag_feature.TagSelector.
User Profile Feature Updates
src/lib/features/user/model/user_profile_model.dart, src/lib/features/user/service/user_service.dart, src/lib/features/user/viewmodel/user_profile_viewmodel.dart, src/lib/features/user/view/user_profile_view.dart
User profile model extended with heatmapData field (map of DateTime to task counts); service adds auth validation; viewmodel generates mock heatmap data; view integrates flutter_heatmap_calendar with interactive cells and bottom sheet modal.
Screen Integration & Navigation
src/lib/features/main/view/screens/main_screen.dart, src/lib/features/statistics/view/screens/statistics_screen.dart, src/lib/features/statistics/view/widgets/statistics_widgets.dart
Main screen loads categories/tags on init and replaces calendar placeholder with ChatBotView; Statistics screen integrates category loading; CompletedTaskCard now reads CategoryViewModel to assign dynamic category instead of hardcoded value.
App Setup & Dependencies
src/lib/main.dart, pubspec.yaml
App-level providers registered for CategoryViewModel and TagViewModel; new dependencies added: flutter_heatmap_calendar: ^1.0.5, google_generative_ai: ^0.4.7; shared_preferences version downgraded.
Database Migrations
supabase/migrations/20260409084009_create_user_profile_rpc.sql, supabase/migrations/20260413084521_update_user_profile_with_heatmap_rpc.sql, supabase/migrations/20260417060333_chatbot_add_task_rpc.sql
Three migrations: user profile RPC (cleanup), enhanced user profile RPC with heatmap calculation and streak logic (7+ lines of complex date/streak grouping), and chatbot task creation RPC (upserts tags, links to task, error handling).

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant ChatBotView
    participant ChatBotViewModel
    participant ChatBotAssistantService
    participant GoogleGenAI
    participant SupabaseRPC
    participant SharedPrefs

    User->>ChatBotView: Type & send message
    ChatBotView->>ChatBotViewModel: sendMessage(text)
    ChatBotViewModel->>SharedPrefs: Load chat history
    ChatBotViewModel->>ChatBotAssistantService: sendMessage(userMessage)
    ChatBotAssistantService->>GoogleGenAI: Send message to chat session
    GoogleGenAI-->>ChatBotAssistantService: Response with function call (create_task_full)
    ChatBotAssistantService->>SupabaseRPC: Call create_task_full(title, priority, profile_id, tags)
    SupabaseRPC-->>ChatBotAssistantService: Task created (task_id)
    ChatBotAssistantService->>GoogleGenAI: Send function result back to session
    GoogleGenAI-->>ChatBotAssistantService: Final text response
    ChatBotAssistantService-->>ChatBotViewModel: Response text
    ChatBotViewModel->>SharedPrefs: Append assistant message & save history
    ChatBotViewModel->>ChatBotView: Notify listeners
    ChatBotView->>User: Display message & typing indicator
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~65 minutes

Possibly related PRs

  • PR #30: Modifies user profile model and related services (user_profile_model.dart, user service/viewmodel) for heatmap data integration; overlaps with this PR's user profile enhancements.
  • PR #33: Makes overlapping changes to tag system refactoring, including TagSelector widget, tag management APIs, and TagModel handling across task and tag features.
  • PR #23: Updates StatisticsScreen initialization logic to load categories based on Supabase user state; aligns with this PR's category-loading side effects in screen startup.

Suggested reviewers

  • hoanghaoz

🐰 Whiskers twitch with glee—categories hop into place,
A chatbot friend arrives to help tasks embrace,
Tags dance in new colors, heatmaps show the way,
This PR hops forward to brighten your day!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'Feature/user profile' is vague and does not clearly summarize the actual changes. The changeset includes chatbot features, category/tag management, adaptive colors, heatmap functionality, and multiple view models—not primarily about user profile. Replace with a descriptive title that accurately reflects the primary changes, such as 'Add chatbot, category/tag management, and heatmap features' or 'Integrate AI assistant with category and tag selection UI'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/user-profile

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tqha1011 tqha1011 merged commit c4b702b into main Apr 17, 2026
1 of 2 checks passed
tqha1011 added a commit that referenced this pull request Apr 18, 2026
* Feature/user profile (#30)

* feat(UserProfile): build screen UserProfile

# Conflicts:
#	src/lib/features/main/view/screens/main_screen.dart

* feat: switch dark/light theme

* fix: black color theme

* fix: black theme in statistics screen

* feat: add dark theme to auth screen

* feat: apply dark theme for bottom navigation bar

* feat(priority task):Implement priority and tag selection in task creation version 1 (#31)

* feat(task): implement priority and tag selection features in task creation

* Update README.md

* Update README.md

* Update README.md

---------

Co-authored-by: Tran Quang Ha <tranquangha2006@gmail.com>

* Update README.md (#32)

* feat: Priority selector and tag system verson2 (#33)

* feat(task): implement priority and tag selection features in task creation

* feat(tags): enhance tag management with custom tag creation and selection

* Update README.md

* Update README.md

* fix: error screen in main.dart (#34)

* Enhance authentication UI and implement Focus feature set (#35)

* feat(core): add auth layout template, custom textfield and colors

* feat(auth): implement viewmodels for auth flow (MVVM)

* feat(auth): build complete auth UI screens (Login, Register, OTP, Passwords)

* chore(main): set LoginView as initial route

* refactor(auth) : delete .gitkeep

* chore: update dependencies and pubspec.lock

* refactor(auth): optimize registration logic, timezone handling, and form validation

* feat(auth): update UI for login, registration, and forgot password screens

* feat(tasks): update task management UI and statistics screen

* chore: update main entry point and fix widget tests

* chore: ignore devtools_options.yaml

* chore: ignore devtools_options.yaml

* style(login) : rewrite title for login view

* feat(auth): configure android deep link for supabase oauth

* refactor(ui): add social login callbacks to auth layout template

* feat(auth): update oauth methods with redirect url and signout

* feat(auth): implement AuthGate using StreamBuilder for session tracking

* feat(viewmodel): add oauth logic and improve provider lifecycle

* refactor(ui): migrate LoginView to Provider pattern

* chore(main): set AuthGate as initial route and setup provider

* feat: implement full Focus feature set

- Added Pomodoro timer with Start/Reset/Skip logic.
- Integrated local Quick Notes with Pin/Delete functionality.
- Supported image attachments in notes using image_picker.
- Added Focus settings: time duration, vibration, and ringtones.

* fix (auth) : dispose TextEditingControllers to prevent memory leaks

* refactor (alarm ) : create off alarm button  when time out

* fix: apply CodeRabbit auto-fixes

Fixed 3 file(s) based on 4 unresolved review comments.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>

* fix(timer): prevent division by zero in progress calculation and sanitize negative settings input

* fix(timer): prevent division by zero in progress calculation and sanitize negative settings input

* fix(auth): unblock new-user login and add settings logout

* refactor(LoginScreen) : compact all items to fit in screen to help users interface easily

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: CodeRabbit <noreply@coderabbit.ai>

* build(deps)(deps): bump shared_preferences from 2.5.4 to 2.5.5 in /src (#36)

Bumps [shared_preferences](https://github.com/flutter/packages/tree/main/packages/shared_preferences) from 2.5.4 to 2.5.5.
- [Commits](https://github.com/flutter/packages/commits/shared_preferences-v2.5.5/packages/shared_preferences)

---
updated-dependencies:
- dependency-name: shared_preferences
  dependency-version: 2.5.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Feature/user profile (#37)

* feat(UserProfile): build screen UserProfile

# Conflicts:
#	src/lib/features/main/view/screens/main_screen.dart

* feat: switch dark/light theme

* fix: black color theme

* fix: black theme in statistics screen

* feat: add dark theme to auth screen

* feat: apply dark theme for bottom navigation bar

* feat(RPC): update RPC to get data for heatmap

* feat(RPC): update new RPC to get data for heatmap

* feat: integrate chatbot assistant

* feat(chatbot): integrate create task, answer question for chatbot

* feat: remove mock data and get data tags and categories from supabase

* feat: integrate chatbot's ability to create task

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Nguyễn Anh Kiệt <griffinbienhoa@gmail.com>
Co-authored-by: Nguyễn Lê Hoàng Hảo <nlhhao888@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@coderabbitai coderabbitai Bot mentioned this pull request Apr 18, 2026
tqha1011 added a commit that referenced this pull request Apr 18, 2026
* feat: add create task screen and fix home screen provider errors

* Feature/user profile (#30)

* feat(UserProfile): build screen UserProfile

# Conflicts:
#	src/lib/features/main/view/screens/main_screen.dart

* feat: switch dark/light theme

* fix: black color theme

* fix: black theme in statistics screen

* feat: add dark theme to auth screen

* feat: apply dark theme for bottom navigation bar

* feat(priority task):Implement priority and tag selection in task creation version 1 (#31)

* feat(task): implement priority and tag selection features in task creation

* Update README.md

* Update README.md

* Update README.md

---------

Co-authored-by: Tran Quang Ha <tranquangha2006@gmail.com>

* Remove comment about main UI in home_screen.dart

Removed commented section about main UI.

* Update README.md (#32)

* feat: Priority selector and tag system verson2 (#33)

* feat(task): implement priority and tag selection features in task creation

* feat(tags): enhance tag management with custom tag creation and selection

* Update README.md

* Update README.md

* fix: error screen in main.dart (#34)

* Enhance authentication UI and implement Focus feature set (#35)

* feat(core): add auth layout template, custom textfield and colors

* feat(auth): implement viewmodels for auth flow (MVVM)

* feat(auth): build complete auth UI screens (Login, Register, OTP, Passwords)

* chore(main): set LoginView as initial route

* refactor(auth) : delete .gitkeep

* chore: update dependencies and pubspec.lock

* refactor(auth): optimize registration logic, timezone handling, and form validation

* feat(auth): update UI for login, registration, and forgot password screens

* feat(tasks): update task management UI and statistics screen

* chore: update main entry point and fix widget tests

* chore: ignore devtools_options.yaml

* chore: ignore devtools_options.yaml

* style(login) : rewrite title for login view

* feat(auth): configure android deep link for supabase oauth

* refactor(ui): add social login callbacks to auth layout template

* feat(auth): update oauth methods with redirect url and signout

* feat(auth): implement AuthGate using StreamBuilder for session tracking

* feat(viewmodel): add oauth logic and improve provider lifecycle

* refactor(ui): migrate LoginView to Provider pattern

* chore(main): set AuthGate as initial route and setup provider

* feat: implement full Focus feature set

- Added Pomodoro timer with Start/Reset/Skip logic.
- Integrated local Quick Notes with Pin/Delete functionality.
- Supported image attachments in notes using image_picker.
- Added Focus settings: time duration, vibration, and ringtones.

* fix (auth) : dispose TextEditingControllers to prevent memory leaks

* refactor (alarm ) : create off alarm button  when time out

* fix: apply CodeRabbit auto-fixes

Fixed 3 file(s) based on 4 unresolved review comments.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>

* fix(timer): prevent division by zero in progress calculation and sanitize negative settings input

* fix(timer): prevent division by zero in progress calculation and sanitize negative settings input

* fix(auth): unblock new-user login and add settings logout

* refactor(LoginScreen) : compact all items to fit in screen to help users interface easily

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: CodeRabbit <noreply@coderabbit.ai>

* build(deps)(deps): bump shared_preferences from 2.5.4 to 2.5.5 in /src (#36)

Bumps [shared_preferences](https://github.com/flutter/packages/tree/main/packages/shared_preferences) from 2.5.4 to 2.5.5.
- [Commits](https://github.com/flutter/packages/commits/shared_preferences-v2.5.5/packages/shared_preferences)

---
updated-dependencies:
- dependency-name: shared_preferences
  dependency-version: 2.5.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Feature/user profile (#37)

* feat(UserProfile): build screen UserProfile

# Conflicts:
#	src/lib/features/main/view/screens/main_screen.dart

* feat: switch dark/light theme

* fix: black color theme

* fix: black theme in statistics screen

* feat: add dark theme to auth screen

* feat: apply dark theme for bottom navigation bar

* feat(RPC): update RPC to get data for heatmap

* feat(RPC): update new RPC to get data for heatmap

* feat: integrate chatbot assistant

* feat(chatbot): integrate create task, answer question for chatbot

* feat: remove mock data and get data tags and categories from supabase

* fixed codes, added save delete and create tasks and notes

* Delete .vs/TaskManagement.slnx/v18/.wsuo

* Delete .vs directory

* Delete .vscode directory

* Delete src/.gitignore

* Delete src/lib/features/auth/viewmodels/task_provider.dart

* Delete src/web_entrypoint.dart

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Tran Quang Ha <tranquangha2006@gmail.com>
Co-authored-by: Nguyễn Anh Kiệt <griffinbienhoa@gmail.com>
Co-authored-by: Nguyễn Lê Hoàng Hảo <nlhhao888@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant