Skip to content

Commit

Permalink
todo's
Browse files Browse the repository at this point in the history
  • Loading branch information
Dieterbe committed Jul 12, 2024
1 parent 2fe6a9e commit a6cd87c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/providers/nutrition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class NutritionPlansProvider with ChangeNotifier {
try {
plan = findById(planId);
} on NoSuchEntryException {
// TODO: remove this useless call, because we will fetch all details below
plan = await fetchAndSetPlanSparse(planId);
}

Expand All @@ -145,6 +146,7 @@ class NutritionPlansProvider with ChangeNotifier {
final List<MealItem> mealItems = [];
final meal = Meal.fromJson(mealData);

// TODO: we should add these ingredients to the ingredient cache
for (final mealItemData in mealData['meal_items']) {
final mealItem = MealItem.fromJson(mealItemData);

Expand Down Expand Up @@ -376,9 +378,10 @@ class NutritionPlansProvider with ChangeNotifier {

if (data['count'] == 0) {
return null;
} else {
return Ingredient.fromJson(data['results'][0]);
}
// TODO we should probably add it to ingredient cache.
// TODO: we could also use the ingredient cache for code searches
return Ingredient.fromJson(data['results'][0]);
}

/// Log meal to nutrition diary
Expand Down
1 change: 1 addition & 0 deletions lib/widgets/nutrition/forms.dart
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ class IngredientFormState extends State<IngredientForm> {
) {
if (snapshot.hasData) {
_mealItem.ingredient = snapshot.data!;
// here it could be nice to put the button to the popup
return MealItemValuesTile(
ingredient: _mealItem.ingredient,
nutritionalValues: _mealItem.nutritionalValues,
Expand Down
1 change: 1 addition & 0 deletions lib/widgets/nutrition/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ void showIngredientDetails(BuildContext context, int id, {String? image}) {

final url = context.read<NutritionPlansProvider>().baseProvider.auth.serverUrl;

// TODO: display source name and source URL for an ingredient in the UI
showDialog(
context: context,
builder: (context) => FutureBuilder<Ingredient>(
Expand Down
1 change: 1 addition & 0 deletions lib/widgets/nutrition/widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ class _IngredientTypeaheadState extends State<IngredientTypeahead> {
mainAxisSize: MainAxisSize.min,
children: [
Text(AppLocalizations.of(context).productFoundDescription(result.name)),
// TODO replace with full view instead of small popup
MealItemValuesTile(
ingredient: result,
nutritionalValues: result.nutritionalValues,
Expand Down

0 comments on commit a6cd87c

Please sign in to comment.