fix(todo): a time picked in the date sheet kept however the sheet closes

The date sheet returned a date only from its days and No date: a time or
a duration picked and the sheet then closed by its X, a swipe or a tap
beside it gave nothing back, so the task kept no time. The sheet now
keeps the date the time makes as it is picked, on the task's day or
today where it had none (as Todoist), and pickTaskDate returns it when
the sheet closes without a choice. Quick add uses the same sheet.

Whats-New: A time picked for a task's date is kept, however you close the Date sheet.
Whats-New-De: Eine Uhrzeit für das Datum einer Aufgabe bleibt, wie auch immer du das Blatt „Datum“ schließt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-04 20:34:48 +01:00
commit 33917c6042
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -1691,6 +1691,79 @@ void main() {
);
});
group('a time picked counts however the date sheet closes (the '
"developer's review, 4 Nov 2026)", () {
testWidgets("in a task's sheet: on its day, or today where it had "
'none, as Todoist', (tester) async {
final today = Day.of(DateTime.now());
final tomorrow = today.plus(1);
await start(tester, usedBefore: true);
await seed(tester, TaskContent(title: 'Stretch', projectId: inbox()));
await seed(
tester,
TaskContent(
title: 'Write',
projectId: inbox(),
date: TaskDate(tomorrow),
),
);
await goTab(tester, 'Inbox');
await tester.tap(find.text('Stretch'));
await tester.pumpAndSettle();
await tester.tap(find.text('No date').last);
await tester.pumpAndSettle();
await tester.tap(find.text('Time'));
await tester.pumpAndSettle();
await tester.tap(find.text('OK'));
await tester.pumpAndSettle();
await tester.tap(find.byTooltip('Close').last);
await tester.pumpAndSettle();
await closeTaskSheet(tester);
await tester.tap(find.text('Write'));
await tester.pumpAndSettle();
await tester.tap(find.text('Tomorrow').last);
await tester.pumpAndSettle();
await tester.tap(find.text('Time'));
await tester.pumpAndSettle();
await tester.tap(find.text('OK'));
await tester.pumpAndSettle();
// Closed by a tap beside it, as the task's sheet.
await tester.tapAt(const Offset(20, 20));
await tester.pumpAndSettle();
final stored = await tester.runAsync(() => tasks().all());
TaskDate? dateOf(String title) =>
stored!.firstWhere((t) => t.content?.title == title).content?.date;
expect(dateOf('Stretch'), TaskDate(today, time: 9 * 60));
expect(dateOf('Write'), TaskDate(tomorrow, time: 9 * 60));
});
testWidgets('in quick add too', (tester) async {
final today = Day.of(DateTime.now());
await start(tester, usedBefore: true);
await goTab(tester, 'Inbox');
await tester.tap(find.byTooltip('Add task'));
await tester.pumpAndSettle();
await tester.enterText(find.byType(TextField).first, 'Call');
await tester.pump();
await tester.tap(find.byTooltip('Date'));
await tester.pumpAndSettle();
await tester.tap(find.text('Time'));
await tester.pumpAndSettle();
await tester.tap(find.text('OK'));
await tester.pumpAndSettle();
await tester.tap(find.byTooltip('Close').last);
await tester.pumpAndSettle();
await tester.tap(find.byTooltip('Add'));
await tester.pumpAndSettle();
final stored = await tester.runAsync(() => tasks().all());
expect(stored!.single.content?.date, TaskDate(today, time: 9 * 60));
});
});
testWidgets("Today names a task's project and section on the line of "
'its date, at its end', (tester) async {
final today = Day.of(DateTime.now());