Skip to content

Commit 3e459fa

Browse files
committed
alignment tweaks
1 parent cf82faa commit 3e459fa

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

lib/widgets/nutrition/macro_nutrients_table.dart

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ class MacronutrientsTable extends StatelessWidget {
1919
Widget build(BuildContext context) {
2020
final loc = AppLocalizations.of(context);
2121

22-
Widget columnHeader(String title) => Padding(
22+
Widget columnHeader(bool left, String title) => Padding(
2323
padding: const EdgeInsets.symmetric(vertical: tablePadding),
2424
child: Text(
2525
title,
2626
style: const TextStyle(fontWeight: FontWeight.bold),
27+
textAlign: left ? TextAlign.left : TextAlign.right,
2728
),
2829
);
2930

@@ -37,11 +38,15 @@ class MacronutrientsTable extends StatelessWidget {
3738
padding: EdgeInsets.symmetric(vertical: tablePadding, horizontal: indent * 12),
3839
child: Text(title),
3940
),
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),
4550
],
4651
);
4752
}
@@ -58,10 +63,10 @@ class MacronutrientsTable extends StatelessWidget {
5863
children: [
5964
TableRow(
6065
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),
6570
],
6671
),
6772
macroRow(0, false, loc.energy, (NutritionalGoals ng) => ng.energy),

0 commit comments

Comments
 (0)