Skip to content

Conversation

@Amitjoiya
Copy link

@Amitjoiya Amitjoiya commented Nov 10, 2025

Overview

This PR re-submits the clean version of my previous contribution that adds a "Custom" option on the image screen (similar to Arduino).

Features

  • Added "Custom" option to image screen.
  • Opens a configuration screen for:
    • Custom screen size
    • Display driver/SDK
    • Color selection
    • Activity type

Notes

  • Only relevant changes are included.
  • No formatting or unrelated file modifications.
  • All code written manually following project conventions.

Thank you for the feedback earlier — I’ve created this clean PR as requested.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 10, 2025

Reviewer's Guide

Adds a “Custom” export option to the image editor that launches a configurable EPD dialog for user-defined display parameters, updates the color provider, and navigates to an export‐only editor instance with the custom device.

Sequence diagram for Custom export option flow

sequenceDiagram
    actor User
    participant ImageEditor
    participant ConfigurableEpdDialog
    participant ColorPaletteProvider
    participant ExportOnlyImageEditor
    User->>ImageEditor: Tap "Custom" button
    ImageEditor->>ConfigurableEpdDialog: Open dialog with default params
    User->>ConfigurableEpdDialog: Set custom width, height, colors, name
    ConfigurableEpdDialog-->>ImageEditor: Return CustomEpdConfig
    ImageEditor->>ColorPaletteProvider: updateColors(customEpd.colors)
    ImageEditor->>ExportOnlyImageEditor: Navigate with customEpd
    User->>ExportOnlyImageEditor: Interact with export-only editor
Loading

Class diagram for new and updated types in Custom export flow

classDiagram
    class ConfigurableEpd {
      +String modelId
      +int width
      +int height
      +List<Color> colors
      +String name
    }
    class CustomEpdConfig {
      +int width
      +int height
      +List<Color> colors
      +String presetName
    }
    class ColorPaletteProvider {
      +updateColors(List<Color> colors)
    }
    ConfigurableEpdDialog --> CustomEpdConfig
    ImageEditor --> ConfigurableEpd
    ImageEditor --> ColorPaletteProvider
    ImageEditor --> ConfigurableEpdDialog
    ImageEditor --> ExportOnlyImageEditor
Loading

File-Level Changes

Change Details Files
Add Custom action button and supporting imports
  • Imported ConfigurableEpdDialog, ConfigurableEpd, and ColorPaletteProvider
  • Added ‘Custom’ button with developer_mode_outlined icon to BottomActionMenu
  • Wired onTap to initiate the configuration flow
lib/view/image_editor.dart
Implement configuration dialog flow with ConfigurableEpdDialog
  • Instantiate default ConfigurableEpd for dialog defaults
  • Launch showDialog to collect width, height, colors, and preset name
  • Construct new ConfigurableEpd from the dialog result
lib/view/image_editor.dart
Update color provider and navigate to export-only editor
  • Update ColorPaletteProvider with the selected colors
  • Handle missing provider errors silently
  • Push a new ImageEditor route with isExportOnly flag and custom device
lib/view/image_editor.dart

Possibly linked issues

  • #issue_id_placeholder: The PR adds a 'Custom' option to the image screen, enabling users to define custom screen size, display driver, and color preferences, directly addressing the issue's requirements.
  • #N/A: The PR adds a 'Custom' display option allowing users to define custom screen size, color, and driver, which directly enhances the display screen's functionality to support various specifications as requested by the issue.
  • #N/A: The PR adds a custom export option allowing users to define specific screen dimensions, directly resolving the issue's problem of hardcoded image and canvas sizes.

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!

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
Contributor

@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 there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `lib/view/image_editor.dart:759-763` </location>
<code_context>
+
+                    try {
+                      context.read<ColorPaletteProvider>().updateColors(customEpd.colors);
+                    } catch (e) {
+                      // provider may not be available in some contexts; ignore silently
+                    }
+
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Silent catch may obscure underlying issues.

Logging the exception or adding a debug print would help identify unexpected issues when the provider is unavailable.

```suggestion
                    try {
                      context.read<ColorPaletteProvider>().updateColors(customEpd.colors);
                    } catch (e, stackTrace) {
                      // provider may not be available in some contexts; log for debugging
                      debugPrint('ColorPaletteProvider unavailable: $e\n$stackTrace');
                    }
```
</issue_to_address>

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.

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