Skip to content

feat: Enhanced UI and Functionality for the Select Screen #18

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

Merged
merged 2 commits into from
Apr 16, 2025

Conversation

Vishveshwara
Copy link
Contributor

@Vishveshwara Vishveshwara commented Apr 10, 2025

Fixes #17

Changes:

  • Added new DisplaySelectionScreen with grid layout for display selection

  • Created display cards with:

    1. Display preview images
    2. Color indicator dots
    3. Technical specs (resolution, aspect ratio, driver)
  • Implemented filter chips for All/Color/B&W/HD displays

  • Created DisplayModel class with:

    1. Display specifications
    2. Color parsing
    3. Aspect ratio calculation
    4. PPI calculation
  • Created DisplayProvider for:

    1. JSON data loading
    2. Filter management
    3. Selection state
    4. EPD class mapping
  • Added displays.json with display configurations for easy support for more displays.

Screenshot:
WhatsApp Image 2025-04-10 at 20 36 46_ecf0d77b

Summary by Sourcery

Implement a comprehensive display selection screen with advanced filtering and display information features for the ePaper application

New Features:

  • Create a new display selection screen with a grid layout for display options
  • Implement dynamic filtering of displays by type (Color, B&W, HD)
  • Add display cards with detailed technical specifications and preview images

Enhancements:

  • Develop a flexible DisplayModel class to manage display metadata
  • Create a DisplayProvider for managing display data and selection state
  • Implement a reusable display card widget with comprehensive display information

Chores:

  • Add displays.json configuration file for easy display management
  • Refactor main application routing to use new display selection screen

Copy link

sourcery-ai bot commented Apr 10, 2025

Reviewer's Guide by Sourcery

This pull request introduces a new display selection screen with enhanced UI and functionality. It includes display cards with preview images and technical specifications, filter chips for display types, a DisplayProvider for data management, and a DisplayModel class to represent display specifications. The changes also involve adding a JSON file for display configurations and updating the main application to include the new screen.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Introduced a new screen for display selection with a grid layout.
  • Created a new DisplaySelectionScreen widget.
  • Implemented a grid view to display available ePaper displays.
  • Added a header and subtitle for screen context.
  • Included a continue button to proceed to the image editor.
lib/view/display_selection_screen.dart
Implemented display cards to show display previews, color indicators, and technical specifications.
  • Created a DisplayCard widget to encapsulate display information.
  • Added display name and size to the card.
  • Included color indicator dots and color names.
  • Displayed technical specifications such as model, resolution, aspect ratio, and driver.
  • Added a border to indicate selection status.
lib/view/widget/display_card.dart
Added filter chips for display types (All, Color, B&W, HD).
  • Implemented filter chips to categorize displays.
  • Created a FilterChipOption widget for selectable filter options.
  • Managed active filter state using DisplayProvider.
  • Updated display grid based on the selected filter.
lib/view/display_selection_screen.dart
lib/view/widget/filter_chip_option.dart
Created a DisplayProvider to manage display data, filtering, and selection state.
  • Loaded display configurations from a JSON file.
  • Parsed display specifications, including colors and resolution.
  • Implemented filtering logic based on display type (All, Color, B&W, HD).
  • Managed the selected display state.
  • Mapped display configurations to EPD classes.
lib/provider/display_provider.dart
Defined a DisplayModel class to represent display specifications.
  • Included properties for display name, size, resolution, colors, and driver.
  • Added computed properties for color display, HD status, PPI, and aspect ratio.
  • Implemented color parsing and aspect ratio calculation.
lib/model/display_model.dart
Added a ColorDot widget to visually represent display colors.
  • Created a ColorDot widget to display a colored circle.
  • Added support for indicating selection status with a shadow effect.
lib/view/widget/color_dot.dart
Added a JSON file to store display configurations.
  • Created a displays.json file to store display configurations.
  • Included display properties such as name, size, resolution, colors, and driver.
assets/displays.json
Updated main.dart to include the DisplayProvider and DisplaySelectionScreen.
  • Added DisplayProvider to the MultiProvider.
  • Set DisplaySelectionScreen as the home screen.
lib/main.dart
Added image assets for displays.
  • Added assets/images/displays/ to pubspec.yaml.
  • Added assets/displays.json to pubspec.yaml.
pubspec.yaml

Assessment against linked issues

Issue Objective Addressed Explanation
#17 The app should support a wide range of displays from different vendors.
#17 The app should accommodate various sizes, color configurations, and other essential specifications of displays.
#17 Enhance the UI of the select display screen.

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. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the 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 exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

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 @Vishveshwara - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider using a consistent naming convention (e.g., camelCase) for model properties like ModelName.
  • The _getEpdForClassName method in DisplayProvider could be refactored to use a map for better readability and maintainability.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 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.

@mariobehling
Copy link
Member

Thanks, please follow the colors same as in the badge magic app https://github.com/fossasia/badgemagic-app.

Use white as a background color for example.

@Vishveshwara
Copy link
Contributor Author

Thanks, please follow the colors same as in the badge magic app https://github.com/fossasia/badgemagic-app.

Use white as a background color for example.

Thank you for your feedback, please review the updated colors below:

Updated UI
WhatsApp Image 2025-04-11 at 00 01 59_9cc0c715

@mariobehling mariobehling requested a review from kienvo April 10, 2025 20:20
@mariobehling mariobehling merged commit 926d55b into fossasia:main Apr 16, 2025
2 of 3 checks passed
@AsCress
Copy link

AsCress commented Apr 16, 2025

@mariobehling We might want to review the logic used here. This doesn't align with the structure developed by @kienvo.
@kienvo Could you please see to this once ?
@Vishveshwara Also, please remove any LLM comments before you commit code. I also advise you to have a look at the logic and understand it first rather than relying on an LLM for the same.

@Vishveshwara
Copy link
Contributor Author

@AsCress
I appreciate the call for careful review, but I have to admit it’s a bit disheartening to have my core logic attributed to an LLM. While I did use an AI tool to draft a few inline comments for improving readability and improving the names of variables, every function and data model implementation was carefully thought by me to be scalable such as the json display handling and filter chips.

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.

Enhance the Functionality and UI for the Select Display Screen
3 participants