fossasia / badgemagic-android

Badge Magic with LEDs - Android App https://play.google.com/apps/testing/org.fossasia.badgemagic
Apache License 2.0
1.85k stars 206 forks source link

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 Jhalakupadhyay opened 1 week ago

Jhalakupadhyay commented 1 week ago

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:

Chores:

sourcery-ai[bot] commented 1 week ago

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

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](https://app.sourcery.ai) 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 - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).