Skip to content
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: Support for '-' in nutritional values #4909

Merged
merged 2 commits into from
Dec 28, 2023

Conversation

g123k
Copy link
Collaborator

@g123k g123k commented Dec 16, 2023

Hi everyone!

Here is an implementation for #4745: the fact that a value is not available on the product.
In addition to this modification, there is also:

  • TextEditingControllerWithInitialValue renamed to TextEditingControllerWithHistory, to also store the previous value
  • In the Nutrition Facts screen, calls to MediaQuery are replaced by the flex mechanism
  • The Controller for each field is passed through a Provider
  • To limit the number of redraws, a _NutritionCellTextWatcher is used to only call when a value is set or not

A video of the implementation:

3.mov

@codecov-commenter
Copy link

Codecov Report

Attention: 78 lines in your changes are missing coverage. Please review.

Comparison is base (02a9942) 9.67% compared to head (38cc56f) 9.66%.
Report is 1 commits behind head on develop.

Files Patch % Lines
...h_app/lib/pages/product/nutrition_page_loaded.dart 1.53% 64 Missing ⚠️
...ckages/smooth_app/lib/pages/text_field_helper.dart 0.00% 7 Missing ⚠️
..._app/lib/pages/product/add_basic_details_page.dart 0.00% 4 Missing ⚠️
..._app/lib/pages/product/add_other_details_page.dart 0.00% 2 Missing ⚠️
...b/pages/product/nutrition_add_nutrient_button.dart 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #4909      +/-   ##
==========================================
- Coverage     9.67%   9.66%   -0.02%     
==========================================
  Files          318     318              
  Lines        16115   16145      +30     
==========================================
+ Hits          1559    1560       +1     
- Misses       14556   14585      +29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@monsieurtanuki monsieurtanuki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @g123k!

My 2 cents:

  • I confirm that I find the UI ugly and not very intuitive
  • I'm not sure it will fit on small screens with your extra column
  • I'm a bit surprised that you manage to put - as a double? value - I would have expected you to edit NutritionContainer too. But I probably haven't had a look at all the details of your code

As long as it works, I approve.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File is a bit too big. Please consider splitting it.

@teolemon teolemon merged commit 2e22987 into openfoodfacts:develop Dec 28, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nutritional values: allow to input an empty value
4 participants