fix: fixes the display selection screen#23
Conversation
Reviewer's Guide by SourceryThis pull request refactors the display selection screen to remove the previous JSON implementation and filtering logic. It replaces the dynamic display grid with a hardcoded list of Updated class diagram for DisplaySelectionScreenclassDiagram
class DisplaySelectionScreen {
-List<Epd> displays
-int? selectedIndex
+Widget build(BuildContext context)
-Widget _buildContinueButton(BuildContext context)
}
class _DisplaySelectionScreenState {
-List<Epd> displays
-int? selectedIndex
+Widget build(BuildContext context)
-Widget _buildContinueButton(BuildContext context)
}
DisplaySelectionScreen -- _DisplaySelectionScreenState
class Epd {
<<abstract>>
+int width
+int height
+List~Image Function(img.Image)~ processingMethods
+String name
+String modelId
+String aspectRatio
+String driverName
+String imgPath
+List~Color~ colors
+Driver controller
}
class Gdey037z03 {
+int width
+int height
+String name
+String modelId
+String aspectRatio
+String driverName
+String imgPath
+List~Color~ colors
}
class Gdey037z03BW {
+int width
+int height
+String name
+String modelId
+String aspectRatio
+String driverName
+String imgPath
+List~Color~ colors
}
Epd <|-- Gdey037z03
Epd <|-- Gdey037z03BW
class DisplayCard {
-Epd display
-bool isSelected
-VoidCallback onTap
+Widget build(BuildContext context)
-String _getColorName(Color color)
-Widget _buildSpecRow(String label, String value)
}
DisplaySelectionScreen -- DisplayCard
note for DisplaySelectionScreen "Removes JSON implementation and filtering logic.
Replaces dynamic display grid with a hardcoded list of Epd objects.
Implements simple state management for display selection."
note for DisplayCard "Updated to work with the new Epd model."
note for Epd "Abstract class for ePaper displays."
note for Gdey037z03 "Concrete implementation of Epd for a specific display."
note for Gdey037z03BW "Concrete implementation of Epd for a specific display."
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @Vishveshwara - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider using a
ListView.builderinstead ofGridView.builderif you expect a small number of displays, as it might be more performant. - The
_getColorNamemethod inDisplayCardcould be moved to theEpdclass to promote code reuse.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| onTap: onTap, | ||
| highlightColor: Colors.redAccent, | ||
| borderRadius: BorderRadius.circular(12), | ||
| splashColor: Colors.redAccent.withValues(alpha: 0.2), |
There was a problem hiding this comment.
issue (typo): Potential typo in splashColor method usage.
It appears that withValues(alpha: 0.2) might be intended to set opacity. Consider replacing with withOpacity(0.2) to correctly apply the desired transparency.
| splashColor: Colors.redAccent.withValues(alpha: 0.2), | |
| splashColor: Colors.redAccent.withOpacity(0.2), |
AsCress
left a comment
There was a problem hiding this comment.
@Vishveshwara Nice work on the refactoring ! This code is now much more simplified and makes much more sense.
Thank you for the review! 🙏 I appreciate your guidance in helping simplify the architecture. |
kienvo
left a comment
There was a problem hiding this comment.
Looks good. Some minor issues need to be fixed before merging.
| @override | ||
| String get aspectRatio => '26:15'; | ||
| @override | ||
| String get driverName => 'UC8253'; |
There was a problem hiding this comment.
I think this driverName should be moved to util/epd/driver /driver.dart.
aspectRatio is not so important, can we remove it?
| if (color == Colors.black) return 'Black'; | ||
| if (color == Colors.white) return 'White'; | ||
| if (color == Colors.red) return 'Red'; |
There was a problem hiding this comment.
Not just Black, White, Red, but also Yellow, Blue, Green, and Orange.
|
@mariobehling This is good to go. |
Fixes #18
Screenshot

Changes:
Summary by Sourcery
Refactor the display selection screen by removing JSON, filtering logic, and provider-based state management, and simplify the implementation to use a more direct approach for selecting e-paper displays.
Bug Fixes:
Enhancements:
Chores: