@@ -19,11 +19,12 @@ class MacronutrientsTable extends StatelessWidget {
19
19
Widget build (BuildContext context) {
20
20
final loc = AppLocalizations .of (context);
21
21
22
- Widget columnHeader (String title) => Padding (
22
+ Widget columnHeader (bool left, String title) => Padding (
23
23
padding: const EdgeInsets .symmetric (vertical: tablePadding),
24
24
child: Text (
25
25
title,
26
26
style: const TextStyle (fontWeight: FontWeight .bold),
27
+ textAlign: left ? TextAlign .left : TextAlign .right,
27
28
),
28
29
);
29
30
@@ -37,11 +38,15 @@ class MacronutrientsTable extends StatelessWidget {
37
38
padding: EdgeInsets .symmetric (vertical: tablePadding, horizontal: indent * 12 ),
38
39
child: Text (title),
39
40
),
40
- Text (goal == null
41
- ? ''
42
- : (g ? loc.gValue (goal.toStringAsFixed (0 )) : loc.kcalValue (goal.toStringAsFixed (0 )))),
43
- Text (pct != null ? pct.toStringAsFixed (1 ) : '' ),
44
- Text (perkg != null ? perkg.toStringAsFixed (1 ) : '' ),
41
+ Text (
42
+ goal == null
43
+ ? ''
44
+ : (g
45
+ ? loc.gValue (goal.toStringAsFixed (0 ))
46
+ : loc.kcalValue (goal.toStringAsFixed (0 ))),
47
+ textAlign: TextAlign .right),
48
+ Text (pct != null ? pct.toStringAsFixed (1 ) : '' , textAlign: TextAlign .right),
49
+ Text (perkg != null ? perkg.toStringAsFixed (1 ) : '' , textAlign: TextAlign .right),
45
50
],
46
51
);
47
52
}
@@ -58,10 +63,10 @@ class MacronutrientsTable extends StatelessWidget {
58
63
children: [
59
64
TableRow (
60
65
children: [
61
- columnHeader (loc.macronutrients),
62
- columnHeader (loc.total),
63
- columnHeader (loc.percentEnergy),
64
- columnHeader (loc.gPerBodyKg),
66
+ columnHeader (true , loc.macronutrients),
67
+ columnHeader (false , loc.total),
68
+ columnHeader (false , loc.percentEnergy),
69
+ columnHeader (false , loc.gPerBodyKg),
65
70
],
66
71
),
67
72
macroRow (0 , false , loc.energy, (NutritionalGoals ng) => ng.energy),
0 commit comments