From a87f4d3829b8b81cf7e6b98afe38d82c65a2b3a5 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Sat, 7 Nov 2026 21:36:24 +0100 Subject: [PATCH] Show workout log notes in the day logs --- .../widgets/logs/day_logs_container.dart | 27 ++++++++++++------- .../screens/routine_logs_screen_test.dart | 26 ++++++++++++++---- 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/lib/features/routines/widgets/logs/day_logs_container.dart b/lib/features/routines/widgets/logs/day_logs_container.dart index fffe56115..b6390102f 100644 --- a/lib/features/routines/widgets/logs/day_logs_container.dart +++ b/lib/features/routines/widgets/logs/day_logs_container.dart @@ -19,6 +19,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:material_ui/material_ui.dart'; import 'package:wger/core/date.dart'; +import 'package:wger/core/widgets/core.dart'; import 'package:wger/features/account/providers/user_profile_notifier.dart'; import 'package:wger/features/routines/models/routine.dart'; import 'package:wger/features/routines/models/session.dart'; @@ -109,16 +110,24 @@ class SessionLogWidget extends ConsumerWidget { (log) => Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - children: [ - if (prTrophies.any((t) => t.contextData?.logId == log.id)) - Icon( - Icons.emoji_events, - color: theme.colorScheme.primary, - size: 20, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + if (prTrophies.any((t) => t.contextData?.logId == log.id)) + Icon( + Icons.emoji_events, + color: theme.colorScheme.primary, + size: 20, + ), + Text(log.repTextNoNl(context)), + ], ), - Text(log.repTextNoNl(context)), - ], + if (log.notes != null) MutedText(log.notes!), + ], + ), ), Row( mainAxisSize: MainAxisSize.min, diff --git a/test/features/routines/screens/routine_logs_screen_test.dart b/test/features/routines/screens/routine_logs_screen_test.dart index 0af323a27..a2a64b165 100644 --- a/test/features/routines/screens/routine_logs_screen_test.dart +++ b/test/features/routines/screens/routine_logs_screen_test.dart @@ -369,8 +369,10 @@ void main() { }); }); - group('Edit dialog notes', () { - Future openEditDialog(WidgetTester tester) async { + group('Notes', () { + final notesField = find.byKey(const ValueKey('edit-notes-widget')); + + Future showDayLogs(WidgetTester tester) async { tester.view.physicalSize = const Size(500, 1200); tester.view.devicePixelRatio = 1.0; addTearDown(tester.view.reset); @@ -380,7 +382,10 @@ void main() { await tester.pumpAndSettle(); await tester.drag(find.byType(ListView), const Offset(0, -500)); await tester.pumpAndSettle(); + } + Future openEditDialog(WidgetTester tester) async { + await showDayLogs(tester); await tester.tap(find.byKey(const ValueKey('edit-log-1'))); await tester.pumpAndSettle(); } @@ -391,11 +396,22 @@ void main() { return verify(mockWorkoutLogRepository.updateLocalDrift(captureAny)).captured.single as Log; } + testWidgets('the day logs show the notes under their set', (WidgetTester tester) async { + for (final log in routine.sessions[0].logs.where((l) => l.id == '1')) { + log.notes = 'Paused reps'; + } + + await withClock(Clock.fixed(DateTime(2025, 3, 29)), () async { + await showDayLogs(tester); + expect(find.text('Paused reps'), findsOneWidget); + }); + }); + testWidgets('saves the entered notes', (WidgetTester tester) async { await withClock(Clock.fixed(DateTime(2025, 3, 29)), () async { await openEditDialog(tester); - await tester.enterText(find.byKey(const ValueKey('edit-notes-widget')), 'Grip slipped'); + await tester.enterText(notesField, 'Grip slipped'); await tester.pump(); expect((await saveAndCapture(tester)).notes, 'Grip slipped'); @@ -409,9 +425,9 @@ void main() { await withClock(Clock.fixed(DateTime(2025, 3, 29)), () async { await openEditDialog(tester); - expect(find.text('Paused reps'), findsOneWidget); + expect(find.descendant(of: notesField, matching: find.text('Paused reps')), findsOneWidget); - await tester.enterText(find.byKey(const ValueKey('edit-notes-widget')), ' '); + await tester.enterText(notesField, ' '); await tester.pump(); expect((await saveAndCapture(tester)).notes, isNull);