fix(todo,ui): Today's day centred in its calendar, and the way back to today shows it

Today's tab drew its day centred at 16 of the calendar's 24 units, where
Lucide's SVG has its body's middle; its font draws the calendar a unit
higher (the top bar's stroke from 8 to 10, the foot's from 20 to 22,
measured with the real fonts), so the digits sat a unit and a half low.
halkyon_ui's new DayCalendarIcon centres them at 15, in Noto Sans set
explicitly, and its tests draw it with the real fonts at 16 to 32 pixels:
the digits centred in the body within half a unit, and 10, 20, 28 and 31
clear of the sides. Todo's TodayIcon keeps the midnight redraw around it.

The agenda's, the 3-day grid's and the month's way back to today showed
Lucide's calendar-1; it shows today's day in the same calendar now, as
Todoist's.

Whats-New: Today's date sits centred in its calendar icon, and the button back to today shows it too.
Whats-New-De: Das heutige Datum steht mittig in seinem Kalendersymbol, und der Knopf zurück zu heute zeigt es auch.
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-07 22:57:44 +01:00
commit 28e07dbf9d
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -1,36 +1,27 @@
import 'package:clock/clock.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:halkyon_todo_flutter/src/tabs/today_icon.dart';
import 'package:halkyon_ui/halkyon_ui.dart';
import 'package:material_ui/material_ui.dart';
void main() {
testWidgets("the day's digits stand centred below the calendar's line, "
"whatever the font's line box (the developer's review, 5 Nov 2026)", (
testWidgets("today's day of the month, in halkyon_ui's calendar, whose "
"digits halkyon_ui places (the developer's review, 7 Nov 2026)", (
tester,
) async {
await tester.pumpWidget(
const Directionality(
textDirection: TextDirection.ltr,
child: IconTheme(
data: IconThemeData(size: 24),
await withClock(Clock.fixed(DateTime(2026, 11, 28, 9)), () async {
await tester.pumpWidget(
const Directionality(
textDirection: TextDirection.ltr,
child: Center(child: TodayIcon()),
),
),
);
});
expect(
tester.widget<DayCalendarIcon>(find.byType(DayCalendarIcon)).day,
28,
);
final icon = tester.getTopLeft(find.byType(TodayIcon));
final day = find.text('${clock.now().day}');
final measured = TextPainter(
text: TextSpan(text: '5', style: tester.widget<Text>(day).style),
textDirection: TextDirection.ltr,
)..layout();
addTearDown(measured.dispose);
final baseline =
tester.getTopLeft(day).dy +
measured.computeDistanceToActualBaseline(TextBaseline.alphabetic) -
icon.dy;
// The digits, 0.714 of 9.6 units high, between the strokes at 11 and 21.
expect(baseline, moreOrLessEquals(19.43, epsilon: 0.01));
expect(find.text('28'), findsOneWidget);
});
}