Workout rows show a kind icon, not label
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
file-length / file length <= 250 lines (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint) (push) Waiting to run
Tests / test (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Krzysztof Rudnicki 2026-11-10 17:17:09 +01:00
parent e7ef648757
commit 957ddc7ddc
6 changed files with 55 additions and 11 deletions

View File

@ -7,6 +7,7 @@ import 'package:diet_guard_app/ui/macro_kind.dart';
import 'package:diet_guard_app/ui/theme.dart';
import 'package:diet_guard_app/widgets/body/body_section.dart';
import 'package:diet_guard_app/widgets/body/formula_figure.dart';
import 'package:diet_guard_app/widgets/body/workout_kind_icon.dart';
import 'package:flutter/material.dart';
/// How many of the newest sessions to list.
@ -185,7 +186,22 @@ class _SessionTile extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('${session.day} ${session.label}'),
Row(
children: [
Text(session.day),
const SizedBox(width: AppSpacing.sm),
Icon(
kindIcon(session.kind),
size: 16,
color: muted,
semanticLabel: session.label,
),
if (session.source == 'manual') ...[
const SizedBox(width: AppSpacing.sm),
Flexible(child: Text(session.label)),
],
],
),
Row(
children: [
Icon(

View File

@ -0,0 +1,13 @@
/// Returns the activity-type icon for [kind].
library;
import 'package:flutter/material.dart';
/// Activity kind icons used by _SessionTile (in `activity_card.dart`).
IconData kindIcon(String kind) => switch (kind) {
'run' => Icons.directions_run,
'walk' => Icons.directions_walk,
'cycle' => Icons.directions_bike,
'strength' => Icons.fitness_center,
_ => Icons.sports,
};

View File

@ -2,7 +2,7 @@ name: diet_guard_app
description: "Companion phone app for diet_guard: log meals on the go."
publish_to: 'none'
version: 1.0.149+1
version: 1.0.150+1
environment:
sdk: ^3.12.2

View File

@ -1,5 +1,6 @@
// Guard: the Body screen, every tile sheet and the activity-method chooser
// paint no words (only numbers, unit symbols, MET and workout labels).
// Workout labels are content only for manual workouts (source == 'manual').
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
@ -12,10 +13,9 @@ import 'screens/body_screen_support.dart';
/// proper names of the BMI / ideal-weight / BMR formulas that label their
/// figures (DOUBT rows in keep.md: kept from the first pilot, outside the
/// activity sheet). Activity formulas (ACSM, Per-km) are NOT here: that sheet
/// and its chooser show glyphs only.
/// and its chooser show glyphs only. Only manual workouts carry human content.
const Set<String> _workouts = {
'Evening run',
'StrongLifts A',
'walk to the shop',
'Harris-Benedict (revised 1984)',
'Peterson (BMI 22)',
'Mifflin-St Jeor',
@ -41,8 +41,8 @@ void main() {
expect(wordsIn('70.0 kg'), isEmpty);
expect(wordsIn('265 MET'), isEmpty);
expect(wordsIn('Measured (ACSM)'), isNotEmpty);
expect(wordsIn('Evening run 4 km', content: _workouts), ['km']);
expect(wordsIn('Evening run', content: _workouts), isEmpty);
expect(wordsIn('walk to the shop 4 km', content: _workouts), ['km']);
expect(wordsIn('walk to the shop', content: _workouts), isEmpty);
});
testWidgets('canary: a painted word fails the guard', (tester) async {

View File

@ -70,16 +70,24 @@ Future<void> seedPerson(MemoryDocStore store, {Object? goal}) async {
'kind': 'run',
'min': 60,
'km': 10,
'label': 'Evening run',
'label': 'Running 10.0 km',
'src': 'runnerup',
},
{
'day': yesterdayKey(),
'kind': 'strength',
'min': 80,
'label': 'StrongLifts A',
'label': 'StrongLifts workout A (80 min, all succeeded)',
'src': 'screen-locker',
},
{
'day': yesterdayKey(),
'kind': 'walk',
'min': 30,
'km': 2,
'label': 'walk to the shop',
'src': 'manual',
},
],
},
});

View File

@ -133,8 +133,15 @@ void main() {
byIconLabel('Mean daily exercise, last 1 full days:'),
findsOneWidget,
);
expect(find.textContaining('Evening run'), findsOneWidget);
expect(find.textContaining('StrongLifts A'), findsOneWidget);
expect(
byIconLabel('Running 10.0 km'),
findsOneWidget,
);
expect(
byIconLabel('StrongLifts workout A (80 min, all succeeded)'),
findsOneWidget,
);
expect(find.textContaining('walk to the shop'), findsOneWidget);
expect(byIconLabel('Connect Health Connect steps'), findsNothing);
});