Skip to content

Settings#1

Merged
budaimdev merged 7 commits intomainfrom
settings
Jul 29, 2025
Merged

Settings#1
budaimdev merged 7 commits intomainfrom
settings

Conversation

@budaimdev
Copy link
Owner

@budaimdev budaimdev commented Jul 29, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a Home screen with searchable, sortable card grid and pull-to-refresh support.
    • Added a Settings page allowing users to change theme mode and app color scheme.
    • Implemented bottom navigation for switching between Home and Settings.
    • Added a theme provider for global theme management.
    • Added a donation dialog accessible from the Home screen.
    • Added a navigation item model for bottom navigation destinations.
  • Improvements

    • Enhanced navigation structure for clearer separation between Home and Settings.
    • Updated card detail and edit screens for consistency in navigation and labeling.
    • Improved error handling for URL launching and empty states.
  • Dependency Updates

    • Replaced several dependencies with flutter_colorpicker for improved color selection.
  • Refactor

    • Simplified main app structure and centralized theming logic.
    • Updated import paths to reflect new directory organization.

@budaimdev budaimdev self-assigned this Jul 29, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 29, 2025

Walkthrough

The changes introduce a major refactor of the Flutter application's structure, separating navigation, home, and settings logic into distinct files and widgets. Theme management is centralized via a provider. Several import paths are updated to reflect the new modular organization. A color picker and theme switching are added, and unused dependencies are removed.

Changes

Cohort / File(s) Change Summary
Navigation & Structure Refactor
lib/main.dart, lib/destination.dart, lib/Views/home.dart, lib/Views/settings.dart
Refactored the app to use a bottom navigation bar with separate Home and Settings pages. Navigation logic is handled by new Destination class and NavigationHandler widget. Home and Settings are now modular widgets with their own files. Removed embedded card grid, search, sorting, and donation dialog from main.dart.
Theme Management
lib/providers/theme_provider.dart, lib/Views/settings.dart, lib/main.dart
Introduced a ThemeProvider for global theme and color scheme management, including a color picker and theme mode selector in Settings. The app now uses provider-based theming with dynamic light and dark themes.
Card Functionality & Import Path Updates
lib/card/carddetail.dart, lib/card/cardedit.dart, lib/card/cardlist.dart, lib/card/scanner.dart, lib/providers/db.dart
Updated import paths to reflect new directory structure. Navigation after card actions now routes to the new Home widget. Minor import and navigation target changes to align with new app structure.
New Feature: Home Screen UI
lib/Views/home.dart
Added a new stateful Home screen widget with searchable and sortable grid of user cards, donation dialog, and navigation to card list. Supports pull-to-refresh, sorting, and search filtering.
New Feature: Settings Screen UI
lib/Views/settings.dart
Added a new Settings page widget with app color scheme picker, theme mode selector, GitHub link, and placeholders for app lock functionality.
Dependency Updates
pubspec.yaml
Removed english_words, rename_app, and shared_preferences dependencies. Added flutter_colorpicker.
New Enum for Sorting
lib/models/enums.dart
Added SortOptions enum with values byName, byDateCreated, and byUsage for sorting user cards.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant ThemeProvider
    participant Home
    participant SettingsPage

    User->>App: Launches app
    App->>ThemeProvider: Initializes theme
    App->>User: Displays bottom navigation (Home, Settings)
    User->>App: Selects Home
    App->>Home: Loads Home screen
    User->>App: Selects Settings
    App->>SettingsPage: Loads Settings screen
    SettingsPage->>ThemeProvider: Updates theme/color on user action
    ThemeProvider-->>App: Notifies theme change
    App->>User: Updates UI with new theme
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Poem

In a warren of widgets, I hop with glee,
New pages and themes for all to see!
Colors to pick, and settings to tweak,
Navigation smooth—no more hide and seek.
With imports in order and code so spry,
This bunny app’s ready to leap sky-high! 🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 674cd39 and f247604.

📒 Files selected for processing (9)
  • lib/Views/home.dart (1 hunks)
  • lib/Views/settings.dart (1 hunks)
  • lib/card/carddetail.dart (2 hunks)
  • lib/card/cardedit.dart (1 hunks)
  • lib/destination.dart (1 hunks)
  • lib/main.dart (1 hunks)
  • lib/models/enums.dart (1 hunks)
  • lib/providers/db.dart (1 hunks)
  • lib/providers/theme_provider.dart (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • lib/models/enums.dart
  • lib/destination.dart
🚧 Files skipped from review as they are similar to previous changes (6)
  • lib/providers/db.dart
  • lib/card/carddetail.dart
  • lib/card/cardedit.dart
  • lib/Views/settings.dart
  • lib/providers/theme_provider.dart
  • lib/Views/home.dart
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: LahevOdVika
PR: LahevOdVika/Stashcard#1
File: lib/Views/home.dart:80-84
Timestamp: 2025-07-29T20:27:05.733Z
Learning: User LahevOdVika has a tendency to be self-deprecating about their coding abilities, calling themselves "dumb" and their code poor quality. They appreciate patient, educational feedback and are very open to learning new concepts. They prefer explanatory responses that help them understand the "why" behind suggestions.
Learnt from: LahevOdVika
PR: LahevOdVika/Stashcard#1
File: lib/Views/home.dart:25-25
Timestamp: 2025-07-29T20:16:06.664Z
Learning: User LahevOdVika prefers to defer localization implementation until later due to lack of familiarity with the concept, indicating they are open to learning about it in the future.
🔇 Additional comments (3)
lib/main.dart (3)

1-7: Well-organized imports for the new modular structure!

The separation of concerns into distinct files (Views, providers, destination) makes the codebase more maintainable.


19-33: Excellent implementation of theme provider integration!

The StashcardApp correctly accesses the theme provider and applies the dynamic themes. Using const NavigationHandler() on line 30 is a good practice.


42-78: Well-structured navigation implementation!

Great job on:

  • Using const constructors for the routes (lines 49-50)
  • Proper state management for navigation
  • Clean separation of destinations data from the UI

The NavigationBar implementation follows Material Design guidelines perfectly.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch settings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

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

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation 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 for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @LahevOdVika, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the application's structure and introduces a new settings page. The main goal is to provide users with customization options for the app's appearance, including color schemes and theme modes, while also improving code organization by separating concerns into dedicated view and provider directories.

Highlights

  • Introduced a dedicated Settings Page: Users can now customize the app's primary color scheme and switch between system, light, and dark theme modes.
  • Refactored Application Structure: Key UI components like the main Home screen and all card-related functionalities have been moved into lib/Views and lib/card subdirectories, respectively, enhancing modularity.
  • Implemented Centralized Theme Management: A new ThemeProvider utilizing the provider package has been added to manage and apply theme settings consistently across the application.
  • Integrated Bottom Navigation Bar: The main application now features a NavigationBar for seamless switching between the Home and Settings sections, improving overall navigation.
  • Updated Project Dependencies: Added flutter_colorpicker for color selection and removed several unused packages like english_words, rename_app, and shared_preferences to streamline the project.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new settings page and refactors the application to use a bottom navigation bar, which is a great architectural improvement. The code is generally well-structured, but I've identified a critical bug in the search functionality where the search query isn't passed to the card grid. Additionally, there are several instances of undisposed controllers which will cause memory leaks, some minor UI text inconsistencies, and some dead code. I've provided detailed comments and suggestions to address these issues.

Copy link

@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.

Actionable comments posted: 19

🧹 Nitpick comments (4)
lib/Views/settings.dart (1)

119-123: Add TODO comment for unimplemented feature.

The app lock feature appears to be a placeholder. Add a TODO comment to track implementation.

           ListTile(
             leading: const Icon(Icons.lock),
             title: const Text("App lock"),
+            // TODO: Implement app lock functionality
+            enabled: false,
           ),
lib/main.dart (1)

43-51: Consider using DestinationView for consistent navigation.

The current implementation duplicates navigation logic. The DestinationView widget in destination.dart already handles navigation but isn't being used. This creates maintenance overhead and potential for bugs.

Consider refactoring to use DestinationView for each destination, which would centralize navigation logic and support nested navigation:

-  List<Widget> routes = [
-    const Home(),
-    const SettingsPage(),
-  ];
+  final List<GlobalKey<NavigatorState>> _navigatorKeys = [
+    GlobalKey<NavigatorState>(),
+    GlobalKey<NavigatorState>(),
+  ];

   ...

-      body: routes[_selectedIndex],
+      body: Stack(
+        children: destinations.map((destination) {
+          return Offstage(
+            offstage: _selectedIndex != destination.index,
+            child: DestinationView(
+              destination: destination,
+              navigatorKey: _navigatorKeys[destination.index],
+            ),
+          );
+        }).toList(),
+      ),

Also applies to: 64-64

lib/Views/home.dart (2)

122-134: Remove unnecessary Builder wrapper.

The Builder wrapper around FloatingActionButton is unnecessary since the context is already available.

Apply this diff to simplify:

-      floatingActionButton: Builder(
-        builder: (BuildContext context) {
-          return FloatingActionButton(
-            onPressed: () {
-              Navigator.push(
-                  context,
-                  MaterialPageRoute(builder: (context) => const CardList())
-              );
-            },
-            child: const Icon(Icons.add),
-          );
-        },
-      ),
+      floatingActionButton: FloatingActionButton(
+        onPressed: () {
+          Navigator.push(
+              context,
+              MaterialPageRoute(builder: (context) => const CardList())
+          );
+        },
+        child: const Icon(Icons.add),
+      ),

161-163: Consider incorporating search query into database query.

Currently, sorting is done at the database level but searching is done at the UI level after loading all cards. For better performance with large datasets, consider adding search functionality to the database query.

If the database helper supports it, modify the method to accept a search parameter:

  Future<List<UserCard>> _loadCards() async {
-    return await db.getUserCardsSorted(widget.selectedOption);
+    return await db.getUserCardsSorted(widget.selectedOption, searchQuery: widget.searchQuery);
  }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0d5b060 and 674cd39.

⛔ Files ignored due to path filters (1)
  • pubspec.lock is excluded by !**/*.lock
📒 Files selected for processing (11)
  • lib/Views/home.dart (1 hunks)
  • lib/Views/settings.dart (1 hunks)
  • lib/card/carddetail.dart (4 hunks)
  • lib/card/cardedit.dart (2 hunks)
  • lib/card/cardlist.dart (1 hunks)
  • lib/card/scanner.dart (2 hunks)
  • lib/destination.dart (1 hunks)
  • lib/main.dart (1 hunks)
  • lib/providers/db.dart (1 hunks)
  • lib/providers/theme_provider.dart (1 hunks)
  • pubspec.yaml (1 hunks)
🔇 Additional comments (9)
pubspec.yaml (1)

22-22: Dependency verified: flutter_colorpicker 1.1.0 is current and secure.

– The latest release on pub.dev is 1.1.0 (as of May 19, 2024).
– No known security vulnerabilities affect version 1.1.0.

No changes are needed for this dependency.

lib/card/cardlist.dart (1)

2-2: LGTM: Import path updated for new directory structure.

The import path has been correctly updated to reflect the new modular organization with card-related files in the card/ subdirectory.

lib/card/cardedit.dart (2)

2-2: LGTM: Import path updated for providers directory.

The import has been correctly updated to reference the database provider in its new location under providers/.


32-32: LGTM: Title case consistency improvement.

The title change from "Edit Card" to "Edit card" improves UI consistency with other card-related screens.

lib/card/scanner.dart (3)

3-3: LGTM: Database import updated for providers directory.

The import has been correctly updated to reference the database provider in its new location.


5-5: LGTM: Home view import updated for new architecture.

The import correctly references the new Home widget location in the Views directory, supporting the modular app structure.


58-58: LGTM: Navigation target updated for new architecture.

The navigation now correctly targets the new Home widget instead of the old Stashcard widget, aligning with the refactored app structure.

lib/Views/home.dart (2)

1-8: LGTM! Clean imports and enum definition.

The imports are well-organized and the SortOptions enum provides a clear, type-safe way to handle sorting options.


140-154: LGTM! Well-structured CardGrid widget.

The widget properly declares its dependencies and initializes the database helper appropriately.

@coderabbitai
Copy link

coderabbitai bot commented Jul 29, 2025

Note

Unit test generation is an Early Access feature. Expect some limitations and changes as we gather feedback and continue to improve it.


Generating unit tests... This may take up to 20 minutes.

@coderabbitai
Copy link

coderabbitai bot commented Jul 29, 2025

UTG Post-Process Complete

No new issues were detected in the generated code and all check runs have completed. The unit test generation process has completed successfully.

@coderabbitai
Copy link

coderabbitai bot commented Jul 29, 2025

Creating a PR to put the unit tests in...

The changes have been created in this pull request: View PR

@budaimdev budaimdev merged commit 7b5662e into main Jul 29, 2025
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