Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: updated the draw badge custom paint to have dynamic cell size and adjusted the padding of the UI for the draw badge. #1107

Open
wants to merge 3 commits into
base: flutter_app
Choose a base branch
from

Conversation

Jhalakupadhyay
Copy link
Contributor

@Jhalakupadhyay Jhalakupadhyay commented Nov 23, 2024

#1095

image

Summary by Sourcery

Enhance the draw badge feature by implementing dynamic cell sizes in the custom paint and adjusting the UI padding for better layout. Remove unused utility functions to streamline the codebase.

Enhancements:

  • Adjust the UI padding for the draw badge screen to improve layout consistency.
  • Remove unused utility functions from byte_array_utils.dart to clean up the codebase.

Chores:

  • Update the draw badge custom paint to support dynamic cell sizes, allowing for more flexible UI designs.

Copy link

sourcery-ai bot commented Nov 23, 2024

Reviewer's Guide by Sourcery

This PR updates the badge drawing functionality by implementing dynamic cell sizing and improving the UI layout. The changes focus on enhancing the visual representation of the badge grid and removing unused utility functions.

Class diagram for DrawBadgePaint changes

classDiagram
    class DrawBadgePaint {
        +List<List<bool>> grid
        +void paint(Canvas canvas, Size size)
    }
    note for DrawBadgePaint "Updated to include dynamic cell sizing and padding adjustments"
    DrawBadgePaint : +double cellWidth
    DrawBadgePaint : +double cellHeight
    DrawBadgePaint : +double pathOffsetX1
    DrawBadgePaint : +double pathOffsetX2
    DrawBadgePaint : +double pathOffsetX3
    DrawBadgePaint : +int paddedRows
    DrawBadgePaint : +int paddedCols
Loading

File-Level Changes

Change Details Files
Refactored the badge drawing canvas to support dynamic cell sizing and improved padding
  • Added padding rows and columns to the grid layout
  • Implemented dynamic cell size calculations based on padded dimensions
  • Added screen utility-based offsets for path drawing
  • Modified the triangular cell shape drawing with new offset calculations
  • Adjusted rotation angle from PI/4 to PI/3
lib/virtualbadge/view/draw_badge_paint.dart
Updated the draw badge screen layout and dimensions
  • Replaced Column's Expanded widget with direct Container
  • Modified padding and margin values
  • Updated container height to fixed 232 pixels
  • Adjusted the overall UI structure for better layout
lib/view/draw_badge_screen.dart
Removed unused byte array utility functions
  • Removed byteArrayToBinaryArray function
  • Removed hexToBin function
  • Removed binaryStringTo2DList function
lib/bademagic_module/utils/byte_array_utils.dart
Code cleanup
  • Removed TODO comment in about_us_screen
lib/view/about_us_screen.dart

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Jhalakupadhyay - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

lib/view/draw_badge_screen.dart Outdated Show resolved Hide resolved
.getDrawViewGrid()
.map((e) => e.map((e) => e ? 1 : 0).toList())
.toList();
List<String> hexString =
Copy link

Choose a reason for hiding this comment

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

suggestion: Consider simplifying the nested conditional logic

The nested ternary operator makes the code harder to read. Consider using if/else statements or extracting this logic into a separate method for better maintainability.

.toList();
List<String> hexString = Converters.convertBitmapToLEDHex(badgeGrid, false);
if (widget.isSavedCard!) {
  fileHelper.updateBadgeText(widget.filename!,

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