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 painter to have the same UI for each screen size. #1096

Closed Jhalakupadhyay closed 1 week ago

Jhalakupadhyay commented 2 weeks ago

1095

I have added the screen Utils property for the width of the screen this will handle the cells size as per the screen size and the draw badge screen UI will remain same for each screen sizes.

WhatsApp Image 2024-11-15 at 00 28 20_a2b78cd1

image

Summary by Sourcery

Enhancements:

sourcery-ai[bot] commented 2 weeks ago

Reviewer's Guide by Sourcery

The changes update the DrawBadgePaint class to make the badge UI consistent across different screen sizes by introducing screen-width-dependent path offsets and adjusting the rotation angle.

Updated class diagram for DrawBadgePaint

classDiagram
    class DrawBadgePaint {
        List~List~bool~~ grid
        Color color
        draw(Canvas canvas, Size size)
    }
    note for DrawBadgePaint "Updated to include screen-width-dependent path offsets and adjusted rotation angle."
    DrawBadgePaint : +double pathOffsetX1
    DrawBadgePaint : +double pathOffsetX2
    DrawBadgePaint : +double pathOffsetX3
    DrawBadgePaint : +const double radians = math.pi / 3

File-Level Changes

Change Details Files
Introduced screen-width-dependent path offsets for responsive cell sizing
  • Added flutter_screenutil package import for screen size utilities
  • Created three path offset variables using screen width multipliers
  • Updated path drawing coordinates to use the new dynamic offsets
lib/virtualbadge/view/draw_badge_paint.dart
Modified badge rotation angle
  • Changed rotation angle from pi/4 (45 degrees) to pi/3 (60 degrees)
lib/virtualbadge/view/draw_badge_paint.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).