Skip to content

Commit 6a49771

Browse files
committed
put energy goal above others instead of between basic and advanced goals
1 parent 4082a59 commit 6a49771

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/widgets/nutrition/charts.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ class FlNutritionalPlanGoalWidgetState extends State<FlNutritionalPlanGoalWidget
9595
// if none goes over, 100% means fill all available space
9696
final maxVal = [
9797
1.0,
98+
if (goals.energy != null && goals.energy! > 0) today.energy / goals.energy!,
9899
if (goals.protein != null && goals.protein! > 0) today.protein / goals.protein!,
99100
if (goals.carbohydrates != null && goals.carbohydrates! > 0)
100101
today.carbohydrates / goals.carbohydrates!,
101102
if (goals.fat != null && goals.fat! > 0) today.fat / goals.fat!,
102-
if (goals.energy != null && goals.energy! > 0) today.energy / goals.energy!,
103103
if (goals.fiber != null && goals.fiber! > 0) today.fiber / goals.fiber!,
104104
].reduce(max);
105105

@@ -112,6 +112,11 @@ class FlNutritionalPlanGoalWidgetState extends State<FlNutritionalPlanGoalWidget
112112
return Column(
113113
crossAxisAlignment: CrossAxisAlignment.start,
114114
children: <Widget>[
115+
Text(fmtMacro(AppLocalizations.of(context).energy, today.energy, goals.energy,
116+
AppLocalizations.of(context).kcal)),
117+
const SizedBox(height: 2),
118+
_diyGauge(context, normWidth, goals.energy, today.energy),
119+
const SizedBox(height: 8),
115120
Text(fmtMacro(AppLocalizations.of(context).protein, today.protein, goals.protein,
116121
AppLocalizations.of(context).g)),
117122
const SizedBox(height: 2),
@@ -126,11 +131,6 @@ class FlNutritionalPlanGoalWidgetState extends State<FlNutritionalPlanGoalWidget
126131
AppLocalizations.of(context).g)),
127132
const SizedBox(height: 2),
128133
_diyGauge(context, normWidth, goals.fat, today.fat),
129-
const SizedBox(height: 8),
130-
Text(fmtMacro(AppLocalizations.of(context).energy, today.energy, goals.energy,
131-
AppLocalizations.of(context).kcal)),
132-
const SizedBox(height: 2),
133-
_diyGauge(context, normWidth, goals.energy, today.energy),
134134
// optionally display the advanced macro goals:
135135
if (goals.fiber != null)
136136
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [

0 commit comments

Comments
 (0)