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);