@@ -17,6 +17,8 @@ class MacronutrientsTable extends StatelessWidget {
17
17
18
18
@override
19
19
Widget build (BuildContext context) {
20
+ final loc = AppLocalizations .of (context);
21
+
20
22
return Table (
21
23
defaultVerticalAlignment: TableCellVerticalAlignment .middle,
22
24
border: TableBorder (
@@ -32,20 +34,20 @@ class MacronutrientsTable extends StatelessWidget {
32
34
Padding (
33
35
padding: const EdgeInsets .symmetric (vertical: tablePadding),
34
36
child: Text (
35
- AppLocalizations . of (context) .macronutrients,
37
+ loc .macronutrients,
36
38
style: const TextStyle (fontWeight: FontWeight .bold),
37
39
),
38
40
),
39
41
Text (
40
- AppLocalizations . of (context) .total,
42
+ loc .total,
41
43
style: const TextStyle (fontWeight: FontWeight .bold),
42
44
),
43
45
Text (
44
- AppLocalizations . of (context) .percentEnergy,
46
+ loc .percentEnergy,
45
47
style: const TextStyle (fontWeight: FontWeight .bold),
46
48
),
47
49
Text (
48
- AppLocalizations . of (context) .gPerBodyKg,
50
+ loc .gPerBodyKg,
49
51
style: const TextStyle (fontWeight: FontWeight .bold),
50
52
),
51
53
],
@@ -54,11 +56,11 @@ class MacronutrientsTable extends StatelessWidget {
54
56
children: [
55
57
Padding (
56
58
padding: const EdgeInsets .symmetric (vertical: tablePadding),
57
- child: Text (AppLocalizations . of (context) .energy),
59
+ child: Text (loc .energy),
58
60
),
59
61
Text (
60
62
nutritionalGoals.energy != null
61
- ? nutritionalGoals.energy! .toStringAsFixed (0 ) + AppLocalizations . of (context).kcal
63
+ ? loc. kcalValue ( nutritionalGoals.energy! .toStringAsFixed (0 ))
62
64
: '' ,
63
65
),
64
66
const Text ('' ),
@@ -69,10 +71,10 @@ class MacronutrientsTable extends StatelessWidget {
69
71
children: [
70
72
Padding (
71
73
padding: const EdgeInsets .symmetric (vertical: tablePadding),
72
- child: Text (AppLocalizations . of (context) .protein),
74
+ child: Text (loc .protein),
73
75
),
74
76
Text (nutritionalGoals.protein != null
75
- ? nutritionalGoals.protein! .toStringAsFixed (0 ) + AppLocalizations . of (context).g
77
+ ? loc. gValue ( nutritionalGoals.protein! .toStringAsFixed (0 ))
76
78
: '' ),
77
79
Text (plannedValuesPercentage.protein != null
78
80
? plannedValuesPercentage.protein! .toStringAsFixed (1 )
@@ -86,11 +88,10 @@ class MacronutrientsTable extends StatelessWidget {
86
88
children: [
87
89
Padding (
88
90
padding: const EdgeInsets .symmetric (vertical: tablePadding),
89
- child: Text (AppLocalizations . of (context) .carbohydrates),
91
+ child: Text (loc .carbohydrates),
90
92
),
91
93
Text (nutritionalGoals.carbohydrates != null
92
- ? nutritionalGoals.carbohydrates! .toStringAsFixed (0 ) +
93
- AppLocalizations .of (context).g
94
+ ? loc.gValue (nutritionalGoals.carbohydrates! .toStringAsFixed (0 ))
94
95
: '' ),
95
96
Text (plannedValuesPercentage.carbohydrates != null
96
97
? plannedValuesPercentage.carbohydrates! .toStringAsFixed (1 )
@@ -104,24 +105,23 @@ class MacronutrientsTable extends StatelessWidget {
104
105
children: [
105
106
Padding (
106
107
padding: const EdgeInsets .symmetric (vertical: tablePadding, horizontal: 12 ),
107
- child: Text (AppLocalizations . of (context) .sugars),
108
+ child: Text (loc .sugars),
108
109
),
109
110
const Text ('' ),
110
111
const Text ('' ),
111
112
Text (nutritionalGoals.carbohydratesSugar != null
112
- ? nutritionalGoals.carbohydratesSugar! .toStringAsFixed (0 ) +
113
- AppLocalizations .of (context).g
113
+ ? loc.gValue (nutritionalGoals.carbohydratesSugar! .toStringAsFixed (0 ))
114
114
: '' ),
115
115
],
116
116
),
117
117
TableRow (
118
118
children: [
119
119
Padding (
120
120
padding: const EdgeInsets .symmetric (vertical: tablePadding),
121
- child: Text (AppLocalizations . of (context) .fat),
121
+ child: Text (loc .fat),
122
122
),
123
123
Text (nutritionalGoals.fat != null
124
- ? nutritionalGoals.fat! .toStringAsFixed (0 ) + AppLocalizations . of (context).g
124
+ ? loc. gValue ( nutritionalGoals.fat! .toStringAsFixed (0 ))
125
125
: '' ),
126
126
Text (plannedValuesPercentage.fat != null
127
127
? plannedValuesPercentage.fat! .toStringAsFixed (1 )
@@ -135,38 +135,38 @@ class MacronutrientsTable extends StatelessWidget {
135
135
children: [
136
136
Padding (
137
137
padding: const EdgeInsets .symmetric (vertical: tablePadding, horizontal: 12 ),
138
- child: Text (AppLocalizations . of (context) .saturatedFat),
138
+ child: Text (loc .saturatedFat),
139
139
),
140
140
const Text ('' ),
141
141
const Text ('' ),
142
142
Text (nutritionalGoals.fatSaturated != null
143
- ? nutritionalGoals.fatSaturated! .toStringAsFixed (0 ) + AppLocalizations . of (context).g
143
+ ? loc. gValue ( nutritionalGoals.fatSaturated! .toStringAsFixed (0 ))
144
144
: '' ),
145
145
],
146
146
),
147
147
TableRow (
148
148
children: [
149
149
Padding (
150
150
padding: const EdgeInsets .symmetric (vertical: tablePadding),
151
- child: Text (AppLocalizations . of (context) .fiber),
151
+ child: Text (loc .fiber),
152
152
),
153
153
const Text ('' ),
154
154
const Text ('' ),
155
155
Text (nutritionalGoals.fiber != null
156
- ? nutritionalGoals.fiber! .toStringAsFixed (0 ) + AppLocalizations . of (context).g
156
+ ? loc. gValue ( nutritionalGoals.fiber! .toStringAsFixed (0 ))
157
157
: '' ),
158
158
],
159
159
),
160
160
TableRow (
161
161
children: [
162
162
Padding (
163
163
padding: const EdgeInsets .symmetric (vertical: tablePadding),
164
- child: Text (AppLocalizations . of (context) .sodium),
164
+ child: Text (loc .sodium),
165
165
),
166
166
const Text ('' ),
167
167
const Text ('' ),
168
168
Text (nutritionalGoals.sodium != null
169
- ? nutritionalGoals.sodium! .toStringAsFixed (0 ) + AppLocalizations . of (context).g
169
+ ? loc. gValue ( nutritionalGoals.sodium! .toStringAsFixed (0 ))
170
170
: '' ),
171
171
],
172
172
),
0 commit comments