Skip to content

fix: error screen in main.dart#34

Merged
tqha1011 merged 1 commit intomainfrom
fix/errorWhenStart
Apr 10, 2026
Merged

fix: error screen in main.dart#34
tqha1011 merged 1 commit intomainfrom
fix/errorWhenStart

Conversation

@tqha1011
Copy link
Copy Markdown
Owner

@tqha1011 tqha1011 commented Apr 10, 2026

Summary by CodeRabbit

  • Refactor
    • Simplified the Sort filter button UI by removing mock content for a cleaner interface
    • Updated app initialization to implement authentication-first navigation flow
    • Reorganized internal state management architecture for improved provider registration

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 10, 2026

📝 Walkthrough

Walkthrough

Three distinct updates across the codebase: removing annotation comments from UserStatisticsModel, cleaning up mock UI elements from the Sort button in the home screen, and restructuring the app's root navigation to use AuthGate for authentication-first flow while explicitly registering TaskViewModel in the provider hierarchy.

Changes

Cohort / File(s) Summary
Statistics Model Cleanup
src/lib/features/statistics/model/StatisticsModel.dart
Removed inline comment markers/annotations from the dailyCounts field and constructor parameter; no logic or type changes.
Home Screen UI Refactoring
src/lib/features/tasks/view/screens/home_screen.dart
Removed mock TaskCard UI block from Sort filter button, including stacked CircleAvatar widgets and "add" icon overlay; sort button now renders icon only.
Authentication & Provider Configuration
src/lib/main.dart
Changed app root from MainScreen to AuthGate for authentication-first navigation; explicitly registered TaskViewModel in MultiProvider via ChangeNotifierProvider<TaskViewModel>; removed unused login_view.dart import and reorganized provider imports.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • hoanghaoz

Poem

🐰 The app hops forward with auth in sight,
AuthGate guards the entrance, holding tight.
Providers whisper their tasks with care,
While mock UI vanishes into thin air. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title 'fix: error screen in main.dart' references only one specific aspect (error screen in main.dart), but the changeset includes multiple substantial modifications across three files: comment removal in StatisticsModel, UI cleanup in home_screen, and authentication flow restructuring plus provider registration in main.dart. The title does not capture the main architectural change (switching to AuthGate and registering TaskViewModel), making it partially related but not representing the primary changes. Update the title to reflect the primary architectural change, such as: 'feat: initialize auth flow and register TaskViewModel globally' or 'refactor: switch to AuthGate and setup provider structure', which better represents the core changes across the files.
✅ 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 fix/errorWhenStart

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/lib/features/tasks/view/screens/home_screen.dart (1)

154-184: ⚠️ Potential issue | 🟡 Minor

Use an accessible button widget for the icon-only sort action.

The sort button (lines 154–184) currently uses GestureDetector with no semantic markup or tooltip, reducing clarity for screen readers and keyboard navigation. Replace with IconButton and add a tooltip label:

Proposed refactor
-                      GestureDetector(
-                        onTap: () => viewModel.toggleSortByPriority(),
-                        child: AnimatedContainer(
+                      AnimatedContainer(
                           duration: const Duration(milliseconds: 200),
                           padding: const EdgeInsets.symmetric(
                             horizontal: 12,
                             vertical: 7,
                           ),
                           decoration: BoxDecoration(
                             color: viewModel.sortByPriority
                                 ? AppColors.primaryBlue
                                 : Colors.white,
                             borderRadius: BorderRadius.circular(20),
                             border: Border.all(
                               color: AppColors.primaryBlue,
                               width: 1,
                             ),
                           ),
-                          child: Row(
-                            children: [
-                              Icon(
-                                Icons.sort,
-                                size: 16,
-                                color: viewModel.sortByPriority
-                                    ? Colors.white
-                                    : AppColors.primaryBlue,
-                              ),
-                            ]
-                          ),
-                        )
-                      ),
+                          child: IconButton(
+                            tooltip: 'Sort by priority',
+                            onPressed: () => viewModel.toggleSortByPriority(),
+                            icon: Icon(
+                              Icons.sort,
+                              size: 16,
+                              color: viewModel.sortByPriority
+                                  ? Colors.white
+                                  : AppColors.primaryBlue,
+                            ),
+                            visualDensity: VisualDensity.compact,
+                            constraints: const BoxConstraints(),
+                            padding: EdgeInsets.zero,
+                          ),
+                        ),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/features/tasks/view/screens/home_screen.dart` around lines 154 - 184,
Replace the GestureDetector wrapping the AnimatedContainer (the icon-only sort
control) with an accessible IconButton so it supports keyboard focus, semantics
and a tooltip; wire IconButton.onPressed to viewModel.toggleSortByPriority(),
provide a meaningful tooltip/semanticLabel like "Sort by priority", and preserve
the existing visual state by applying the same conditional colors
(viewModel.sortByPriority ? AppColors.primaryBlue : Colors.white for background
and the inverse for Icon color) and the rounded border/animation (keep the
AnimatedContainer or wrap IconButton with a decorated/animated parent) so
behavior of sortByPriority and visual styling remain unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/lib/features/tasks/view/screens/home_screen.dart`:
- Around line 154-184: Replace the GestureDetector wrapping the
AnimatedContainer (the icon-only sort control) with an accessible IconButton so
it supports keyboard focus, semantics and a tooltip; wire IconButton.onPressed
to viewModel.toggleSortByPriority(), provide a meaningful tooltip/semanticLabel
like "Sort by priority", and preserve the existing visual state by applying the
same conditional colors (viewModel.sortByPriority ? AppColors.primaryBlue :
Colors.white for background and the inverse for Icon color) and the rounded
border/animation (keep the AnimatedContainer or wrap IconButton with a
decorated/animated parent) so behavior of sortByPriority and visual styling
remain unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 60acb9c8-bde2-4223-aad0-1def92ffd149

📥 Commits

Reviewing files that changed from the base of the PR and between ae8e44c and f3dfe0f.

📒 Files selected for processing (3)
  • src/lib/features/statistics/model/StatisticsModel.dart
  • src/lib/features/tasks/view/screens/home_screen.dart
  • src/lib/main.dart

@tqha1011 tqha1011 merged commit 7a77888 into main Apr 10, 2026
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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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] <[email protected]>
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] <[email protected]>
Co-authored-by: Nguyễn Anh Kiệt <[email protected]>
Co-authored-by: Nguyễn Lê Hoàng Hảo <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: CodeRabbit <[email protected]>
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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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] <[email protected]>
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] <[email protected]>
Co-authored-by: Tran Quang Ha <[email protected]>
Co-authored-by: Nguyễn Anh Kiệt <[email protected]>
Co-authored-by: Nguyễn Lê Hoàng Hảo <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: CodeRabbit <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@tqha1011 tqha1011 deleted the fix/errorWhenStart branch April 20, 2026 12:29
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.

2 participants