-
Notifications
You must be signed in to change notification settings - Fork 10
fix: changes the implementation of the display selection screen #23
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
fix: changes the implementation of 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.
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
ListView.builder
instead ofGridView.builder
if you expect a small number of displays, as it might be more performant. - The
_getColorName
method inDisplayCard
could be moved to theEpd
class 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@kienvo We might want to test the app once and decide upon the UI implementations before we merge this. I'll leave this to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Some minor issues need to be fixed before merging.
lib/util/epd/gdey037z03.dart
Outdated
@override | ||
String get aspectRatio => '26:15'; | ||
@override | ||
String get driverName => 'UC8253'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this driverName
should be moved to util/epd/driver /driver.dart
.
aspectRatio
is not so important, can we remove it?
lib/view/widget/display_card.dart
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: