✨ Editable search data collections
This commit is contained in:
@ -28,13 +28,19 @@ class _FoodDetailsScreenState extends State<FoodDetailsScreen> {
|
||||
if (alert.configuration.isEmpty) return;
|
||||
|
||||
for (final item in alert.configuration) {
|
||||
bool isUndetected = true;
|
||||
bool isOutOfRange = false;
|
||||
double? difference;
|
||||
String name = 'undetected'.tr;
|
||||
String? unitName;
|
||||
double? current;
|
||||
for (final nutrient in widget.item.foodNutrients) {
|
||||
if (item.nutrientId != nutrient.nutrientId) continue;
|
||||
bool isOutOfRange = false;
|
||||
double? difference;
|
||||
bool isUndetected = false;
|
||||
name = nutrient.nutrientName;
|
||||
unitName = unitNameValues.reverse[nutrient.unitName];
|
||||
if (nutrient.value != null) {
|
||||
final value = nutrient.value ?? 0;
|
||||
final value = nutrient.value!;
|
||||
current = value;
|
||||
if (value > item.maxValue) {
|
||||
difference = value - item.maxValue;
|
||||
isOutOfRange = true;
|
||||
@ -42,20 +48,19 @@ class _FoodDetailsScreenState extends State<FoodDetailsScreen> {
|
||||
difference = value - item.minValue;
|
||||
isOutOfRange = true;
|
||||
}
|
||||
} else {
|
||||
isUndetected = true;
|
||||
isUndetected = false;
|
||||
}
|
||||
|
||||
_alertDetectResult.add(AlertDetectResult(
|
||||
config: item,
|
||||
name: nutrient.nutrientName,
|
||||
unitName: unitNameValues.reverse[nutrient.unitName],
|
||||
current: nutrient.value,
|
||||
difference: difference,
|
||||
isOutOfRange: isOutOfRange,
|
||||
isUndetected: isUndetected,
|
||||
));
|
||||
}
|
||||
|
||||
_alertDetectResult.add(AlertDetectResult(
|
||||
config: item,
|
||||
name: name,
|
||||
unitName: unitName,
|
||||
current: current,
|
||||
difference: difference,
|
||||
isOutOfRange: isOutOfRange,
|
||||
isUndetected: isUndetected,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user