Skip to content

Offline gym log for Android. No account, no ads, no internet.

Polish nutrition sheets

InlitXe419cf2e32f6
diff --git a/lib/screens/nutrition/cards.dart b/lib/screens/nutrition/cards.dart
index 536ab92..d862e0d 100644
--- a/lib/screens/nutrition/cards.dart
+++ b/lib/screens/nutrition/cards.dart
@@ -1564,7 +1564,7 @@ class _SupplementEditorState extends State<_SupplementEditor> with _StickerDraft
selected: fromCustom,
onTap: () async {
final d = await _date(_from, _today);
- if (d == null) return;
+ if (d == null || !mounted) return;
setState(() {
_from = d;
final u = _until;
@@ -1584,7 +1584,7 @@ class _SupplementEditorState extends State<_SupplementEditor> with _StickerDraft
selected: untilCustom,
onTap: () async {
final d = await _date(_until ?? plus(13), _from);
- if (d != null) setState(() => _until = d);
+ if (d != null && mounted) setState(() => _until = d);
},
),
]),
@@ -1769,7 +1769,7 @@ class _WeekTile extends StatelessWidget {
color: gc.accent,
title: t.weekAverage,
value: w == null ? '—' : '${fit.energyOf(w.kcal)}',
- unit: w == null ? '' : fit.energyUnit,
+ unit: w == null ? '' : t.perDayUnit(fit.energyUnit),
lines: w == null ? [t.weekNoData] : [t.weekProteinAvg(w.protein), t.weekDaysOnTarget(w.kcalMet, w.days)],
chart: w == null
? null
diff --git a/lib/screens/nutrition/meals.dart b/lib/screens/nutrition/meals.dart
index 4413a09..4b26037 100644
--- a/lib/screens/nutrition/meals.dart
+++ b/lib/screens/nutrition/meals.dart
@@ -772,7 +772,7 @@ class _MacroPill extends StatelessWidget {
child: Text(letter, style: AppTheme.f(8.5, weight: FontWeight.w900, color: color)),
),
const SizedBox(width: 4),
- Text('${_g(value)}g', style: AppTheme.f(11, weight: FontWeight.w700, color: gc.text)),
+ Text('${value.round()}g', style: AppTheme.f(11, weight: FontWeight.w700, color: gc.text)),
]),
);
}
diff --git a/lib/screens/nutrition/prep.dart b/lib/screens/nutrition/prep.dart
index 6a6c22a..3447deb 100644
--- a/lib/screens/nutrition/prep.dart
+++ b/lib/screens/nutrition/prep.dart
@@ -328,7 +328,7 @@ class _BatchLogSheetState extends State<_BatchLogSheet> {
final k = fit.isLb ? _ozOf(false) : 1.0;
final v = await askNumber(context,
title: t.amountIn(_amtUnit(false)), initial: fmt((_grams / k * 10).round() / 10), decimal: true);
- if (v != null && v > 0) setState(() => _grams = (v * k).clamp(1, b.leftGrams).toDouble());
+ if (v != null && v > 0 && mounted) setState(() => _grams = (v * k).clamp(1, b.leftGrams).toDouble());
},
),
),