flutter icon indicating copy to clipboard operation
flutter copied to clipboard

Error to add a new ingredient wieght

Open hhugoac opened this issue 11 months ago • 5 comments

Steps to Reproduce

  1. Go to the Nutritional plans and select one, then add a meal
  2. Click on the pencil to add an ingredient
  3. Search an ingredient and type the name
  4. In the weight field add a number less than 1.0 and the app sends an exception

Image Image Image Image

Expected results: An error message or hint into the textfield to send an explaining the error

Actual results: The result is that the page pop and didn't save the ingredient

Logs #1 NutritionPlansProvider.addMealItem (package:wger/providers/nutrition.dart:260:18) nutrition.dart:260 2 [log] Saved ingredient 'Meal One' to db cache [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: [Ensure this value is greater than or equal to 1.] #0 WgerBaseProvider.post (package:wger/providers/base_provider.dart:106:7) base_provider.dart:106 #1 NutritionPlansProvider.addMealItem (package:wger/providers/nutrition.dart:260:18) nutrition.dart:260

hhugoac avatar Jan 15 '25 20:01 hhugoac

I am new to open source and I want to try to solve this issue , can I fork it ?

arshmandal0725 avatar Jul 16 '25 10:07 arshmandal0725

Hmm this should be a numeric integer input rather than a text field.

Yes feel free to fork, make the change (and test it) and then file a pull request here.

Dieterbe avatar Jul 17 '25 07:07 Dieterbe

Note : I don't think it makes sense to log fractions of grams. There is no use for that AFAIK ?

Dieterbe avatar Jul 17 '25 07:07 Dieterbe

Hi, I'd love to work on this issue if it's still available. Please let me know if I can take it!

dhituval avatar Nov 05 '25 17:11 dhituval

@dhituval sure, go ahead. Just make the input an integer field, like Dieter suggested

rolandgeider avatar Nov 17 '25 10:11 rolandgeider