-
-
Notifications
You must be signed in to change notification settings - Fork 320
Barcode scanner #115
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
Barcode scanner #115
Conversation
…to test/fixtures(for mocking data)
lib/providers/nutrition.dart
Outdated
); | ||
|
||
if(data['count'] != 0) { | ||
ingredient = Ingredient.fromJson(data['results'][0]); |
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.
you can just do return Ingredient.fromJson(...)
lib/widgets/nutrition/forms.dart
Outdated
String barcode; | ||
try { | ||
barcode = await FlutterBarcodeScanner.scanBarcode( | ||
'#ff6666', 'Cancel', true, ScanMode.BARCODE); |
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.
"Cancel" is used in UI right? Better use a translated string. There are a handfull from flutter/android for such things, I'm not sure how to access them (if it's complicated, just add cancel to app_en.arb if it isn't there already)
lib/widgets/nutrition/forms.dart
Outdated
child: Column( | ||
children: [ | ||
IngredientTypeahead(_ingredientIdController, _ingredientController), | ||
ElevatedButton( |
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.
is it possible to add this to ingredient typeahead? Ideally we would have a single widget where we could either type a name or scan a product. We can add a barcode scanner as a suffixIcon that opens the scanner (the search icon would go to preffixIcon). If that's not possible because the typeahead logic interferes with it, we can leave it as a separate button
oh, and add yourself to AUTHORS.md ;) |
…l_meal_item_form_test.dart. Changed return inside searchIngredientWithCode function.
Thanks for the PR! I want to submit the app to the f-droid app store before merging more things into master but once that's done I'll merge this (a feature that's been missing for quite some time) |
This took a big longer to merge, but it's finally done. Thanks again 👍🏻 |
Proposed Changes
Related Issues (if applicable)
Please check that the PR fulfills these requirements