openfoodfacts / smooth-app

🤳🥫 The new Open Food Facts mobile application for Android and iOS, crafted with Flutter and Dart
https://world.openfoodfacts.org/open-food-facts-mobile-app?utm_source=off&utf_medium=web&utm_campaign=github-repo
Apache License 2.0
795 stars 273 forks source link

Serving size: don't display the dropdown if no serving size or serving size = 100g #1137

Open monsieurtanuki opened 2 years ago

monsieurtanuki commented 2 years ago

Simulator Screen Shot - iPhone 8 Plus - 2022-02-12 at 17 52 57

teolemon commented 2 years ago
UgoKo-Rubeast commented 2 years ago

Should we change our backend API? According to the following pic, the dropdown widget seems to be built based on backend data. I think a thorough solution is to let our backend API not to send per serving data when serving size = 100g.

https://github.com/openfoodfacts/smooth-app/blob/2c9cd30b33315443a99fc1523774972629e4eab6/packages/smooth_app/lib/data_models/query_product_list_supplier.dart#L19

スクリーンショット 2022-06-04 10 39 57

when columns.length == 1, a text(100g) will be built. Else, a dropdown(100g/per serving) will be built.

https://github.com/openfoodfacts/smooth-app/blob/2c24f9bde0d9a2babace6451d71280b208a04f47/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_table_card.dart#L263-L284