-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
feat: The compare feature only accepts two existing products #4139
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #4139 +/- ##
===========================================
- Coverage 10.91% 10.89% -0.02%
===========================================
Files 277 277
Lines 13536 13552 +16
===========================================
Hits 1477 1477
- Misses 12059 12075 +16
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
Hi @g123k!
Looks good, but please have a look at my comments.
@@ -32,9 +31,11 @@ class _ScanHeaderState extends State<ScanHeader> { | |||
), | |||
); | |||
|
|||
final int validBarcodes = model.getAvailableBarcodes().length; |
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.
final int validBarcodes = model.getAvailableBarcodes().length; | |
final List<String> barcodes = model.getAvailableBarcodes().toList(growable: false); |
Reasons:
- confusion between "available" and "valid" barcodes
- you call again
model.getAvailableBarcodes()
later in the code - "validBarcodes" does not sound like a number
If you really want,
final int numberOfBarcodes = barcodes.length;
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.
The problem with your toList()
is that it will force to create a new List in memory.
The Iterable is enough here just to count the number of items.
duration: SmoothAnimationsDuration.brief, | ||
child: ElevatedButton.icon( | ||
style: buttonStyle, | ||
icon: const Icon(Icons.compare_arrows), |
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.
Please change RankingFloatingActionButton.rankingIconData
instead, for consistency: the same icon for the same action.
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.
The reason I've changed the icon here, is because the RankingFloatingActionButton.rankingIconData
is a trophy, and in personal search, this is the right icon to use :/
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.
What would be the best option according to you?
To differentiate the 🏆 and
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 would always use the same icon, as it's the same operation (product list / selected items / ranking page).
Co-authored-by: monsieurtanuki <fabrice_fontaine@hotmail.com>
Hi everyone,
Here are my fixes for the Compare feature on the scanner:
Here are two videos:
Compare feature with existing products
Compare.webm
Compare feature with unknown products
Compare2.webm
It will fix both #4127 and #4130