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

popup ingredient details in typeahead suggestions and recently used #613

Merged
merged 16 commits into from
Jul 18, 2024

Conversation

Dieterbe
Copy link
Contributor

unfortunately, we only get the image when getting suggestions. not when using the ingredients API or when browsing recently used ingredients. this would be a nice thing to add to the backend @rolandgeider :) i also think a link to the "upstream source" could be nice. (e.g. to OFF or USDA if applicable)

@Dieterbe Dieterbe marked this pull request as draft June 20, 2024 16:21
@Dieterbe Dieterbe marked this pull request as ready for review June 20, 2024 16:38
@rolandgeider
Copy link
Member

yes, ideally we would query the regular ingredient API, then we would have access to all fields and could decide what to show

@rolandgeider
Copy link
Member

Just tested this, I like it! However, I am always getting a render flex overflow error here (it seems only the first time?). I would also remove the g-per-body-kg column, that's only useful for the whole plan

@Dieterbe
Copy link
Contributor Author

Dieterbe commented Jul 4, 2024

blocked on wger-project/wger#1713

@rolandgeider
Copy link
Member

blocked on wger-project/wger#1713

have updated the test and the production server

ingredient details dialog:
 - give it close/continue buttons to load into selection
 - always use image property from loaded ingredient
   this is a bit slower, but:
   * more consistent (no need to support absolute vs relative URL's
     separately)
   * cleaner (no need to pass it thru explicitly)
   * more future proof: we will get rid of the dedicated
     /ingredient/search endpoint which gives us images before we load
     the full ingredient. in the future we will simply load the
     ingredients, completely, all at once.
   * allows for easier code reuse with barcode scan result dialog

barcode scan result dialog:
 - show image and detailed nutrition table
 - support a loading spinner
 - simplify error handling
 - deduplicate code between found & not found
 - share code with ingredient details dialog
lib/widgets/nutrition/ingredient_dialogs.dart Show resolved Hide resolved
@@ -353,7 +353,7 @@ class IngredientFormState extends State<IngredientForm> {
child: Column(
children: [
Text(
'Macros preview',
'Macros preview', // TODO fix l10n
Copy link
Member

Choose a reason for hiding this comment

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

l10n :)

),
),
if (snapshot.hasData && ingredient!.licenseObjectURl == null)
Text('Source: ${source!}'),
Copy link
Member

Choose a reason for hiding this comment

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

l10n

),
),
if (ingredient != null && ingredient.licenseObjectURl == null)
Text('Source: ${source!}'),
Copy link
Member

Choose a reason for hiding this comment

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

l10n

@Dieterbe Dieterbe merged commit 11a7c30 into master Jul 18, 2024
4 checks passed
@Dieterbe Dieterbe deleted the ingredient-details branch July 18, 2024 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants