don't show g-per-bodyweight-kg on ingredient details popups

This commit is contained in:
Dieter Plaetinck
2024-07-03 21:09:37 +03:00
parent 395d40ce9a
commit 2d27281a1d
2 changed files with 7 additions and 4 deletions

View File

@@ -141,7 +141,7 @@ void showIngredientDetails(BuildContext context, int id, {String? image}) {
child: MacronutrientsTable(
nutritionalGoals: goals!,
plannedValuesPercentage: goals.energyPercentage(),
nutritionalGoalsGperKg: null,
showGperKg: false,
),
),
],

View File

@@ -7,13 +7,15 @@ class MacronutrientsTable extends StatelessWidget {
super.key,
required this.nutritionalGoals,
required this.plannedValuesPercentage,
required this.nutritionalGoalsGperKg,
this.nutritionalGoalsGperKg,
this.showGperKg = true,
});
static const double tablePadding = 7;
final NutritionalGoals nutritionalGoals;
final NutritionalGoals plannedValuesPercentage;
final NutritionalGoals? nutritionalGoalsGperKg;
final bool showGperKg;
@override
Widget build(BuildContext context) {
@@ -42,7 +44,8 @@ class MacronutrientsTable extends StatelessWidget {
),
Text(goal != null ? valFn(goal.toStringAsFixed(0)) : '', textAlign: TextAlign.right),
Text(pct != null ? pct.toStringAsFixed(1) : '', textAlign: TextAlign.right),
Text(perkg != null ? perkg.toStringAsFixed(1) : '', textAlign: TextAlign.right),
if (showGperKg)
Text(perkg != null ? perkg.toStringAsFixed(1) : '', textAlign: TextAlign.right),
],
);
}
@@ -62,7 +65,7 @@ class MacronutrientsTable extends StatelessWidget {
columnHeader(true, loc.macronutrients),
columnHeader(false, loc.total),
columnHeader(false, loc.percentEnergy),
columnHeader(false, loc.gPerBodyKg),
if (showGperKg) columnHeader(false, loc.gPerBodyKg),
],
),
macroRow(0, false, loc.energy, (NutritionalGoals ng) => ng.energy),