PassioFoodItem
from PassioAdvisorFoodInfo
To display the food details, PassioFoodItem
is required.
Fetch PassioFoodItem
from PassioFoodDataInfo
We build a UI component to display macro-nutrients like calories, carbohydrates, protein, and fat. We get these macro nutrients for the selected size of the food.
The setSelectedQuantity()
function handles changes to the serving quantity. It calculates the corresponding weight based on the selected serving unit and updates the passioFoodItem
object accordingly.
For example, once user changes the quantity from a textfield or from a slider, we can call setSelectedQuantity()
function on passioFoodItem
.
The setSelectedUnit()
function handles changes to the serving unit.
For example, once user changes the unit (e.g. Packet
, Cup
, Gram
) from a list of units, we can call setSelectedQuantity()
function on passioFoodItem
.
To get list of all units for a food item: