Skip to content

configure material theme; create placeholder screens: splash, login a…#2

Merged
abelarismendy merged 4 commits intomainfrom
project-folder-structure-and-material-theme
Sep 14, 2024
Merged

configure material theme; create placeholder screens: splash, login a…#2
abelarismendy merged 4 commits intomainfrom
project-folder-structure-and-material-theme

Conversation

@abelarismendy
Copy link
Copy Markdown
Contributor

@abelarismendy abelarismendy commented Sep 14, 2024

…nd home

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a splash screen, login screen, and home screen for the "Food Waste" app.
    • Implemented a theming system with light and dark modes for a consistent user interface.
    • Added support for Google Fonts to enhance typography options.
  • Bug Fixes

    • Disabled automated tests in the CI/CD workflow, which may affect quality assurance.
  • Chores

    • Updated VSCode settings to automatically trim trailing whitespace for cleaner code.
  • Refactor

    • Streamlined the application structure by moving core functionality to a dedicated file.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Sep 14, 2024

Walkthrough

The pull request introduces several modifications across multiple files in a Flutter project. Key changes include the commenting out of the testing job in the GitHub Actions workflow, the addition of a theming system, the introduction of main application screens, and the restructuring of the main application file. A new file for the main app structure is created, and several UI screens are implemented, including a login screen, home screen, and splash screen. Additionally, settings for automatic whitespace trimming in Visual Studio Code are added, and a widget test file is deleted.

Changes

File Change Summary
.github/workflows/dart.yml Commented out the "Test" job, disabling automated tests in the CI/CD pipeline.
.vscode/settings.json Added setting to automatically trim trailing whitespace in files.
lib/app.dart Introduced MyApp class as the main application structure for the Flutter app.
lib/core/config/theme.dart Added a theming system with MaterialTheme and MaterialScheme classes for light and dark themes.
lib/core/utils/create_text_theme.dart Added createTextTheme function to generate a customized TextTheme using Google Fonts.
lib/features/auth/presentation/screens/login_screen.dart Added LoginScreen class for user login interface.
lib/features/home/presentation/screens/home_screen.dart Added HomeScreen class for the main interface.
lib/features/splash/presentation/screens/splash_screen.dart Added SplashScreen class for the splash screen.
lib/main.dart Removed MyApp and MyHomePage classes, delegating functionality to app.dart.
ios/Flutter/Debug.xcconfig Added conditional inclusion of Pods configuration file for debugging.
ios/Flutter/Release.xcconfig Added conditional inclusion of Pods configuration file for release builds.
ios/Podfile Introduced Podfile to manage iOS dependencies and configurations.
pubspec.yaml Added google_fonts dependency for enhanced typography options.
test/widget_test.dart Deleted the widget test file that tested a simple counter application.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant LoginScreen
    participant HomeScreen
    participant SplashScreen

    User->>App: Launch App
    App->>SplashScreen: Show Splash Screen
    SplashScreen-->>App: Navigate to LoginScreen
    App->>LoginScreen: Show Login Screen
    User->>LoginScreen: Enter Credentials
    LoginScreen-->>App: Authenticate User
    App->>HomeScreen: Show Home Screen
Loading

🐇 In the code, we make our way,
With themes and screens, we hop and play.
No more tests to run today,
But cleaner code is here to stay!
A splash of joy, a login cheer,
In our Flutter world, we persevere! 🌟

Tip

OpenAI O1 model for chat
  • We have deployed OpenAI's latest O1 model for chat.
  • OpenAI claims that this model has superior reasoning capabilities than their GPT-4o model.
  • Please share any feedback with us in the discussions post.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 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
Copy Markdown

@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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 0cd1d0f and febf356.

Files selected for processing (9)
  • .github/workflows/dart.yml (1 hunks)
  • .vscode/settings.json (1 hunks)
  • lib/app.dart (1 hunks)
  • lib/core/config/theme.dart (1 hunks)
  • lib/features/auth/presentation/screens/login_screen.dart (1 hunks)
  • lib/features/home/presentation/screens/home_screen.dart (1 hunks)
  • lib/features/splash/presentation/screens/splash_screen.dart (1 hunks)
  • lib/main.dart (1 hunks)
  • test/widget_test.dart (0 hunks)
Files not reviewed due to no reviewable changes (1)
  • test/widget_test.dart
Additional comments not posted (16)
.vscode/settings.json (1)

1-3: Great addition to enforce consistent code formatting!

The "files.trimTrailingWhitespace": true setting in the .vscode/settings.json file is a valuable addition to the project. It ensures that any unnecessary trailing whitespace is automatically removed upon saving files, promoting cleaner and more consistent code.

This setting is particularly beneficial in collaborative coding environments, as it helps prevent issues related to whitespace discrepancies that can arise during version control operations. By enforcing this setting, the team can maintain a cleaner codebase, reduce potential merge conflicts, and improve overall code quality.

The addition of this configuration reflects a commitment to best practices in coding standards and aids in maintaining a professional development workflow.

lib/main.dart (2)

2-2: LGTM!

The import statement for app.dart is a good change that promotes better organization and separation of concerns by moving the main application logic to a separate file.


6-6: Verify the MyApp widget in app.dart.

The closing brace for the main function has been moved as a result of the removal of the MyApp and MyHomePage classes. This change is fine, but please ensure that the MyApp widget is correctly defined in app.dart.

Run the following script to verify the MyApp widget in app.dart:

Verification successful

MyApp widget implementation verified, manual check recommended for build method.

The MyApp widget is correctly implemented in lib/app.dart:

  • Extends StatelessWidget
  • Has a const constructor
  • Overrides the build method
  • Sets up theme and system UI styles

However, the complete build method implementation is not visible. Please manually verify that it returns a widget, typically a MaterialApp or CupertinoApp.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the `MyApp` widget is defined in `app.dart`.

# Test: Search for the `MyApp` widget in `app.dart`. Expect: At least one occurrence.
rg --type dart $'class MyApp extends StatelessWidget' lib/app.dart

Length of output: 105


Script:

#!/bin/bash
# Description: Retrieve more context about the MyApp widget implementation

# Search for the MyApp class definition and its content
rg --type dart -A 10 'class MyApp extends StatelessWidget' lib/app.dart

Length of output: 714

lib/features/home/presentation/screens/home_screen.dart (1)

3-19: LGTM!

The HomeScreen class is a well-structured and straightforward implementation of the home screen. It follows the standard conventions for creating a stateless widget in Flutter and utilizes the current theme to maintain a consistent look and feel.

The layout is simple and easy to understand, making it a good starting point for the home screen. As the app evolves, more complex layouts and functionality can be added to this screen.

Good job!

lib/features/auth/presentation/screens/login_screen.dart (1)

1-19: LGTM!

The LoginScreen class is a well-structured stateless widget that serves as a placeholder for the login functionality. The code follows the Flutter coding conventions and best practices, and the use of Theme.of(context) ensures consistent styling throughout the app.

Some suggestions for future iterations:

  1. Replace the centered Text widget with a login form that includes input fields for username and password, and a login button.
  2. Implement form validation to ensure that the user enters valid credentials.
  3. Handle the login button press event and implement the authentication logic to validate the user's credentials against a backend API or local storage.
  4. Display error messages to the user if the authentication fails.
  5. Navigate to the home screen or dashboard upon successful login.

Overall, this is a good starting point for the login screen, and the code is ready to be merged into the main branch.

.github/workflows/dart.yml (1)

26-27: Verify the decision to disable the testing phase.

Commenting out the "Test" job effectively disables the testing phase of the CI/CD pipeline. This could impact the overall quality assurance process, as it removes a critical step that ensures code correctness and functionality before deployment.

Please confirm that disabling the testing phase is intentional and consider the potential risks associated with this decision. If this change is temporary, consider adding a TODO comment to remind the team to re-enable testing in the future.

lib/features/splash/presentation/screens/splash_screen.dart (1)

8-28: LGTM!

The build method of the SplashScreen class is well-structured and follows best practices. It correctly retrieves the current theme and customizes the system UI overlays to match the theme. The use of Scaffold as the root widget and setting its background color to the theme's surface color is appropriate for a splash screen. The centered Text widget displaying the app name with the headlineLarge text style is suitable for a splash screen.

Overall, the implementation is clean, readable, and adheres to the Material Design guidelines.

lib/app.dart (6)

9-11: LGTM!

The MyApp class declaration and structure are correct. It extends StatelessWidget and overrides the build method to define the app's structure and configuration.


14-14: LGTM!

The app's theme is correctly configured using a custom MaterialTheme derived from Typography.blackCupertino. This ensures a consistent typography throughout the app.


15-20: LGTM!

The system UI overlay styles are correctly set to ensure that the navigation and status bar colors align with the app's theme. This enhances visual consistency and provides a seamless user experience.


21-24: LGTM!

Restricting the device's orientation to portrait mode allows for a more controlled user experience and ensures that the app's layout remains consistent across different devices.


25-28: LGTM!

The MaterialApp widget is correctly instantiated with the following properties:

  • The debug banner is disabled, which is appropriate for a production app.
  • The app title is set to "Food Waste", clearly identifying the app's purpose.
  • The defined light theme is applied, ensuring a consistent visual style throughout the app.

29-34: LGTM!

The routing system is correctly established with the following configuration:

  • The initial route leads to a SplashScreen, providing a starting point for the app.
  • Routes for navigating to HomeScreen and LoginScreen are included, enabling easy navigation between key screens.

This routing configuration facilitates a clear navigation flow and modular screen management within the app.

lib/core/config/theme.dart (3)

5-380: LGTM!

The MaterialTheme class is well-structured and provides a clear separation of concerns for generating different theme variations. The methods are named appropriately and follow a consistent naming convention. The theme() method ensures that the text theme is applied correctly based on the color scheme's surface colors.


382-486: LGTM!

The MaterialScheme class is well-structured and includes all the necessary color properties for a comprehensive UI design. The constructor ensures that all the required color properties are provided when creating an instance of the class.


488-523: LGTM!

The MaterialSchemeUtils extension is a useful utility that allows for easy conversion of a MaterialScheme instance into a ColorScheme. The toColorScheme() method is implemented correctly and maps all the necessary color properties.

Comment thread lib/core/config/theme.dart
…com:mobile-dev-16/flutter_app into project-folder-structure-and-material-theme
Copy link
Copy Markdown

@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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between febf356 and ccde486.

Files ignored due to path filters (1)
  • pubspec.lock is excluded by !**/*.lock
Files selected for processing (8)
  • ios/Flutter/Debug.xcconfig (1 hunks)
  • ios/Flutter/Release.xcconfig (1 hunks)
  • ios/Podfile (1 hunks)
  • lib/app.dart (1 hunks)
  • lib/core/config/theme.dart (1 hunks)
  • lib/core/utils/create_text_theme.dart (1 hunks)
  • lib/features/splash/presentation/screens/splash_screen.dart (1 hunks)
  • pubspec.yaml (1 hunks)
Additional context used
rubocop
ios/Podfile

[convention] 34-34: Use __dir__ to get an absolute path to the current file's directory.

(Style/Dir)

Additional comments not posted (16)
ios/Flutter/Debug.xcconfig (1)

1-1: LGTM!

The addition of the conditional include statement #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" is a good practice for enhancing the configuration management by allowing for more modular and maintainable build settings, particularly in projects that utilize CocoaPods for dependency management.

The use of #include? provides flexibility in the build process depending on the presence of the specified file, which is a nice touch.

Overall, this modification aims to streamline the integration of third-party libraries and dependencies into the Flutter iOS build environment, which is a positive change.

ios/Flutter/Release.xcconfig (1)

1-1: Modular Configuration Approach

The inclusion of the conditional directive to include the Pods configuration file is a good practice. It allows for a more modular configuration approach, enabling the possibility of overriding or extending default settings defined in Generated.xcconfig.

This change enhances the flexibility of the build process, particularly in scenarios where different build environments or dependency configurations are required.

lib/core/utils/create_text_theme.dart (1)

1-19: LGTM!

The createTextTheme function is well-structured, follows a clear logic, and ensures a cohesive design by combining body and display text themes. The code is clean, readable, and well-documented with clear variable names and appropriate whitespace. The imports are correctly used, and there are no unused imports.

Great job on implementing this utility function!

lib/features/splash/presentation/screens/splash_screen.dart (1)

4-29: Great implementation of the SplashScreen class!

The SplashScreen class is well-structured and follows best practices for creating a splash screen in Flutter. Here are some positive aspects of the implementation:

  1. The class extends StatelessWidget, which is appropriate for a splash screen that does not require any internal state management.

  2. The build method effectively utilizes the current theme of the application to ensure consistency with the overall design. This includes styling the text widget and configuring the system UI overlays.

  3. The use of the AnnotatedRegion<SystemUiOverlayStyle> widget to customize the system UI elements based on the current theme's brightness and surface colors enhances the visual appeal and user experience.

  4. The code is readable and well-organized, making it easy to understand and maintain.

Overall, the implementation of the SplashScreen class provides a visually appealing entry point for the application while aligning with the app's branding and user interface guidelines.

ios/Podfile (6)

1-2: LGTM!

The global platform version section provides a clear instruction to the user and is correctly implemented.


4-5: LGTM!

Disabling CocoaPods analytics is a good practice to enhance build performance and avoid latency during the Flutter build process. The section provides a clear explanation of the purpose and is correctly implemented.


7-11: LGTM!

The project configuration section correctly specifies the project name and sets different build configurations for Debug, Profile, and Release modes. The section is correctly implemented and provides a clear configuration for the project.


13-24: LGTM!

The flutter_root function is a key component of the Podfile that ensures the necessary Flutter environment is set up correctly. It correctly locates the Flutter SDK path by reading the Generated.xcconfig file and raises appropriate errors if the file is missing or if the FLUTTER_ROOT variable is not found. The function is correctly implemented and provides a robust way to manage the Flutter environment.


30-38: LGTM!

The targets section correctly defines the necessary configurations for the 'Runner' and 'RunnerTests' targets. It specifies the use of frameworks and modular headers for the 'Runner' target, and includes a call to flutter_install_all_ios_pods to install all required iOS pods based on the Flutter project structure. The nested 'RunnerTests' target correctly inherits search paths from the main target. The section is correctly implemented and ensures that the necessary dependencies and settings are in place for successful builds.

Tools
rubocop

[convention] 34-34: Use __dir__ to get an absolute path to the current file's directory.

(Style/Dir)


40-44: LGTM!

The post_install hook is a necessary step to ensure that the Flutter-specific configurations are correctly applied to each target after the installation of pods. It correctly iterates over each target in the pods project and applies the additional build settings. The section is correctly implemented and ensures that the necessary configurations are in place for successful builds.

lib/app.dart (2)

10-11: LGTM!

The MyApp class declaration and structure are correct. It extends StatelessWidget and has a constant constructor that takes a key parameter.


13-43: LGTM!

The build method in the MyApp class is well-structured and follows a logical flow. It effectively configures the app's theme, system UI overlay style, and device orientation. The MaterialApp widget is properly configured with the necessary properties, and the routing system is set up correctly with an initial route and named routes for different screens.

pubspec.yaml (1)

38-38: LGTM!

The addition of the google_fonts dependency is a valid change that enhances the project's capabilities by providing access to a wide range of Google Fonts. The specified version ^6.2.1 is reasonable and follows semantic versioning conventions.

lib/core/config/theme.dart (3)

542-575: ****
Consider utilizing ExtendedColor and ColorFamily classes or remove them if not needed.

The ExtendedColor and ColorFamily classes provide a structured way to manage color variations and their relationships. The classes are well-defined and include all the necessary properties. However, the extendedColors getter in the MaterialTheme class is empty, indicating that these classes are not being utilized in the current implementation.

If there are plans to utilize these classes in the future, it's recommended to keep them. Otherwise, consider removing them to avoid unnecessary code.


382-486: LGTM!

The MaterialScheme class is well-defined and includes all the necessary color properties essential for user interface design. The class structure and property names follow a consistent naming convention, making it easy to understand and use.


488-540: LGTM!

The MaterialSchemeUtils extension provides a convenient method to convert a MaterialScheme instance into a ColorScheme, facilitating integration with Flutter's theming system. The method is correctly implemented and maps all the necessary color properties from MaterialScheme to ColorScheme.

Comment thread ios/Podfile
@abelarismendy abelarismendy merged commit 89a8759 into main Sep 14, 2024
RaulRinconX added a commit that referenced this pull request Sep 27, 2024
RaulRinconX added a commit that referenced this pull request Sep 29, 2024
* order-list advanced native prototype

* Refactor order_bloc and order_item_bloc

Remove unnecessary comments and clean up code in order_bloc and order_item_bloc files.

* Refactor VSCode settings and order-related blocs

* Update nested dependency to version 1.0.0 in pubspec.yaml

* Create date util. Fixes #1

* Refactoring order_item_bloc and fixing another issues. Fixing #2

* Refactor date formatting in DateUtils and OrderItem widget. Fix #3

* Advise order bloc and add test data for orders. Implement #1

* delete widgetbook

---------

Co-authored-by: Abel Arismendy <abel@arismendy.co>
RaulRinconX added a commit that referenced this pull request Sep 29, 2024
* Creating login screen, login repository and navigation path login-main. Implement #1

* Refactor object type. Fix #1

* Refactor app.dart and login_screen.  Fix #2

* fix initial route

* fix: login navigable after pressing back in the main layout

* add trailing commas

---------

Co-authored-by: Abel Arismendy <abel@arismendy.co>
@coderabbitai coderabbitai Bot mentioned this pull request Sep 29, 2024
RaulRinconX added a commit that referenced this pull request Oct 1, 2024
* Update Firebase dependencies and configuration. Implement #1

* Update AndroidManifest.xml package name. Implement #2

* Update AndroidManifest.xml package name and configure firebase. Implement #1
RaulRinconX added a commit that referenced this pull request Oct 1, 2024
* Firebase auth with email/password and google, update screens and logic app. Implement #1

* Solved Sign In/Up troubles and using Sign_Button package. Fix #1

* Refactor AuthBloc to handle sign-in and sign-up with Google. Fix #2
RaulRinconX added a commit that referenced this pull request Oct 2, 2024
* Firebase auth with email/password and google, update screens and logic app. Implement #1

* Solved Sign In/Up troubles and using Sign_Button package. Fix #1

* Refactor AuthBloc to handle sign-in and sign-up with Google. Fix #2

* Refactor login and register screens. Fixes #3
RaulRinconX added a commit that referenced this pull request Oct 2, 2024
* Finally finished integration GoogleMaps with GPS and address resolution. Resolves #1

* Ignore print statements and specify widget types in reverse_geocoding.dart and address_screen.dart. Fixes #1

* Refactor main.dart to remove redundant code. Fixes #2
RaulRinconX added a commit that referenced this pull request Oct 2, 2024
RaulRinconX added a commit that referenced this pull request Oct 2, 2024
* Finally finished integration GoogleMaps with GPS and address resolution. Resolves #1

* Ignore print statements and specify widget types in reverse_geocoding.dart and address_screen.dart. Fixes #1

* Refactor main.dart to remove redundant code. Fixes #2

* Add location permissions to AndroidManifest.xml and implement GPS location fetching in AddressScreen. Resolves #2

* Refactor address_screen.dart to ignore deprecated member usage. Fixes #3
This was referenced Nov 4, 2024
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.

Configure Material 3 and Apply Custom Theme Define folder structure and design pattern

2 participants