fix(todo): the calendar's arrows stay put at the left

The month's Flexible and the Spacer shared what was left of the row, so
the arrows sat somewhere in the middle and moved as the way back to
today showed. They come first now, where nothing beside them moves them.

Whats-New: The calendar's arrows in Upcoming stay in one place at the left.
Whats-New-De: Die Pfeile im Kalender unter Demnächst bleiben links an ihrem Platz.

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-05 19:07:08 +01:00
commit 8628d80d89
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64
2 changed files with 62 additions and 25 deletions

View file

@ -152,33 +152,10 @@ class _HourGridState() extends State<HourGrid> {
if (several)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
// The arrows first, where neither the month's length nor the way
// back to today can move them.
child: Row(
children: [
Flexible(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Text(
DateFormat.yMMMM(locale).format(start.toDate()),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.titleMedium,
),
),
),
if (start != today)
IconButton(
tooltip: l10n.weekToday,
icon: const Icon(LucideIcons.calendar1),
color: theme.colorScheme.primary,
onPressed: () => _go(today),
),
const Spacer(),
if (overdue.isNotEmpty)
TextButton(
key: HourGrid.overdueKey,
onPressed: () => _showOverdue(context),
child: Text(l10n.overdue),
),
IconButton(
tooltip: l10n.daysPrevious,
icon: const Icon(LucideIcons.chevronLeft),
@ -191,6 +168,36 @@ class _HourGridState() extends State<HourGrid> {
icon: const Icon(LucideIcons.chevronRight),
onPressed: () => _go(start.plus(count)),
),
Expanded(
child: Row(
children: [
Flexible(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Text(
DateFormat.yMMMM(locale).format(start.toDate()),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.titleMedium,
),
),
),
if (start != today)
IconButton(
tooltip: l10n.weekToday,
icon: const Icon(LucideIcons.calendar1),
color: theme.colorScheme.primary,
onPressed: () => _go(today),
),
],
),
),
if (overdue.isNotEmpty)
TextButton(
key: HourGrid.overdueKey,
onPressed: () => _showOverdue(context),
child: Text(l10n.overdue),
),
],
),
),

View file

@ -1049,6 +1049,36 @@ void main() {
await done(tester);
}
testWidgets('the arrows stay at the left, whatever the way back to '
'today or what is overdue beside them', (tester) async {
await start(tester, usedBefore: true);
await threeDay(tester);
final later = find.byTooltip('Later days');
final atToday = tester.getTopLeft(later);
expect(
atToday.dx,
lessThan(tester.getTopLeft(find.byType(HourGrid)).dx + 80),
);
await tester.tap(later);
await tester.pumpAndSettle();
expect(find.byTooltip('Back to today'), findsOneWidget);
expect(tester.getTopLeft(later), atToday);
await tester.tap(find.byTooltip('Back to today'));
await tester.pumpAndSettle();
await seed(
tester,
TaskContent(
title: 'Late',
projectId: inbox(),
date: TaskDate(Day.of(DateTime.now()).plus(-3)),
),
);
expect(find.byKey(HourGrid.overdueKey), findsOneWidget);
expect(tester.getTopLeft(later), atToday);
});
testWidgets('3-day shows today and the next two days, a timed task as '
'a block and one without a time all day; kept in the settings, '
'sealed', (tester) async {