Skip to content

Conversation

@JatsuAkaYashvant
Copy link
Member

@JatsuAkaYashvant JatsuAkaYashvant commented Apr 3, 2025

Fixes #

A button which is not touching the borders, and is of perfect size as per the Material3. Solving the issue number : #330

Describe the changes you have made in this PR -

Before Fix:

  • Text touches button edges
  • Poor padding/spacing
  • Unprofessional appearance

After Fix:

  • Proper padding
  • Minimum width constraints
  • Clean visual hierarchy

Files Modified

  • lib/ui/components/cv_primary_button.dart
  • lib/ui/views/projects/components/featured_project_card.dart

Screenshots of the changes (If any) -

Before:

WhatsApp Image 2025-04-04 at 02 58 09_87c7ad22

After:

WhatsApp Image 2025-04-04 at 02 58 09_b678e4ef

Note: Please check Allow edits from maintainers. if you would like us to assist in the PR.

Summary by CodeRabbit

  • New Features
    • The primary button now supports customizable text styles and includes a new compact variant for a more flexible design.
    • Featured project cards have been enhanced to display images gracefully, with a smooth transition to a placeholder when an image isn’t available, ensuring a refined visual experience.

@coderabbitai
Copy link

coderabbitai bot commented Apr 3, 2025

Walkthrough

This update introduces modifications to two UI components. The primary button now accepts an optional text style parameter and offers a new factory constructor for creating a smaller button variant. In addition, the featured project card has updated image preview logic that checks for an image URL and displays either a network-loaded image or a placeholder when necessary. New helper methods handle placeholder creation and image URL construction, and the footer now utilizes the small button variant.

Changes

Files Change Summary
lib/ui/components/cv_primary_button.dart - Added optional textStyle parameter to the constructor
- Introduced factory constructor CVPrimaryButton.small for a smaller variant
- Updated build method to apply custom textStyle, with fallback based on existing isBodyText logic
lib/ui/views/projects/components/featured_project_card.dart - Updated _buildPreview to check for image availability using a new hasImage flag
- Added error handling with _buildPlaceholderImage for failed image loads
- Introduced two new methods: _buildPlaceholderImage() and _getImageUrl() for managing placeholder display and URL construction
- Modified _buildFooter to use CVPrimaryButton.small

Possibly related issues


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.
    • 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 for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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

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

🧹 Nitpick comments (1)
lib/ui/views/projects/components/featured_project_card.dart (1)

84-90: Consider making the URL construction more robust.

The substring operation assumes the API base URL ends with a specific 7-character pattern ("/api/v1/"). This could be fragile if the base URL format changes in the future.

  String _getImageUrl() {
-    return EnvironmentConfig.CV_API_BASE_URL.substring(
-          0,
-          EnvironmentConfig.CV_API_BASE_URL.length - 7,
-        ) +
-        widget.project.attributes.imagePreview.url;
+    // Remove API path component more reliably
+    String baseUrl = EnvironmentConfig.CV_API_BASE_URL;
+    if (baseUrl.endsWith('/api/v1/')) {
+      baseUrl = baseUrl.substring(0, baseUrl.length - 8);
+    } else if (baseUrl.endsWith('/api/v1')) {
+      baseUrl = baseUrl.substring(0, baseUrl.length - 7);
+    }
+    return baseUrl + widget.project.attributes.imagePreview.url;
  }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e6ec7fd and a4b7ba9.

📒 Files selected for processing (2)
  • lib/ui/components/cv_primary_button.dart (3 hunks)
  • lib/ui/views/projects/components/featured_project_card.dart (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (macos-latest)
  • GitHub Check: build (windows-latest)
🔇 Additional comments (9)
lib/ui/components/cv_primary_button.dart (4)

11-11: Good addition of a customizable text style parameter.

Adding an optional textStyle parameter allows for more flexibility in button appearance customization, which aligns with the PR objective of improving UI styling.


20-20: Appropriate class variable declaration.

The textStyle variable is correctly defined as optional (TextStyle?) to match the constructor parameter.


22-39: Well-designed small button variant.

The factory constructor provides a good pre-configured variant with appropriate padding and text styling. The horizontal padding (12) being greater than vertical padding (6) creates a better visual balance, and the font weight of 500 ensures good readability at the smaller size.


53-54: Proper implementation of text style fallback.

The null coalescing operator (??) correctly uses the provided textStyle if available, otherwise falls back to the existing logic. This maintains backward compatibility while adding new functionality.

lib/ui/views/projects/components/featured_project_card.dart (5)

24-25: Good practice for conditional image handling.

Adding a Boolean check for empty image URLs is a clean approach to determine the appropriate rendering path.


41-51: Improved image loading with fallback.

The conditional rendering using FadeInImage with a proper error handler is a robust approach to image display. This ensures a good user experience even when images fail to load.


57-82: Well-designed placeholder implementation.

The placeholder has a thoughtful design with appropriate colors, icon, and text that maintains visual consistency with the app's theme. The subtle color variations using Color.lerp are a nice touch.


94-94: Improved padding for better content spacing.

The symmetric padding provides consistent spacing around the footer content, aligning with the PR objective of better padding and spacing.


115-116: Enhanced button presentation.

Adding a spacing of 10 between the text and button improves visual separation, and using the new CVPrimaryButton.small variant creates a more professional appearance with appropriate sizing and padding.

@JatsuAkaYashvant
Copy link
Member Author

@hardik17771 I have made the required changes to uplift the UI of View button in Featured Circuits. Please review.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 14253409765

Details

  • 15 of 29 (51.72%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 64.118%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/ui/views/projects/components/featured_project_card.dart 10 24 41.67%
Totals Coverage Status
Change from base Build 14252173608: -0.1%
Covered Lines: 4026
Relevant Lines: 6279

💛 - Coveralls

@hardik17771 hardik17771 merged commit 2b2a694 into CircuitVerse:master Apr 4, 2025
5 checks passed
@github-actions
Copy link
Contributor

🎉 This PR is included in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@coderabbitai coderabbitai bot mentioned this pull request Aug 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants