From b2176f8b69f0f13c782478b59ffea288fa86e7e4 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Sat, 10 Oct 2026 20:04:19 +0200 Subject: [PATCH] =?UTF-8?q?app=20settings:=20"Custom=E2=80=A6"=20first=20i?= =?UTF-8?q?n=20the=20meal-time=20dropdowns?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At the end of the list it sat ~95 grid items down; now it is the first item, above 00:00. Test pins the order. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_015npsYVB2PdtWkG7MPAi4tn --- app/lib/widgets/meal_time_dropdown.dart | 3 ++- app/pubspec.yaml | 2 +- .../widgets/meal_schedule_editor_test.dart | 18 +++++++++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/app/lib/widgets/meal_time_dropdown.dart b/app/lib/widgets/meal_time_dropdown.dart index 71223df..f89e0bb 100644 --- a/app/lib/widgets/meal_time_dropdown.dart +++ b/app/lib/widgets/meal_time_dropdown.dart @@ -106,10 +106,11 @@ class MealTimeDropdown extends StatelessWidget { value: value, isDense: true, isExpanded: true, + // "Custom…" first: at the end it sat ~95 grid items down. items: [ + const DropdownMenuItem(value: _customValue, child: Text('Custom…')), for (final minute in options) DropdownMenuItem(value: minute, child: Text(slotLabel(minute))), - const DropdownMenuItem(value: _customValue, child: Text('Custom…')), ], onChanged: (minute) { if (minute == null) return; diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 8684a1d..d522a96 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -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.108+1 +version: 1.0.109+1 environment: sdk: ^3.12.2 diff --git a/app/test/widgets/meal_schedule_editor_test.dart b/app/test/widgets/meal_schedule_editor_test.dart index 4dc18d4..126d2a2 100644 --- a/app/test/widgets/meal_schedule_editor_test.dart +++ b/app/test/widgets/meal_schedule_editor_test.dart @@ -58,9 +58,11 @@ void main() { /// Picks "Custom…" from the open menu, typing [hhmm] in the time picker's /// keyboard mode. Future pickCustom(WidgetTester tester, String hh, String mm) async { + // The menu opens centred on the current value; "Custom…" is the first + // item, so it is reached by scrolling up. await tester.scrollUntilVisible( find.text('Custom…'), - 300, + -300, scrollable: find.byType(Scrollable).last, ); await tester.tap(find.text('Custom…').last); @@ -118,6 +120,20 @@ void main() { expect(find.text('07:23'), findsWidgets); }); + testWidgets('Custom… is the first item, above 00:00', (tester) async { + await pump(tester, _fiveMeals); + + await openDropdown(tester, 'First meal'); + await tester.scrollUntilVisible( + find.text('00:00'), + -300, + scrollable: find.byType(Scrollable).last, + ); + + final custom = tester.getTopLeft(find.text('Custom…').last).dy; + expect(custom, lessThan(tester.getTopLeft(find.text('00:00').last).dy)); + }); + testWidgets('a custom last meal before the first is clamped', (tester) async { await pump(tester, _fiveMeals);