fix(app): study faces centred in the card

The read-only view passed its alignment to the text alone, which the
editor lays out only as wide as itself, so a centred face stayed at the
start. It now aligns top-level paragraphs and headings that have no
alignment of their own; lists, quotes and the rest keep the start, and
an alignment chosen in the format bar wins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-08 14:14:39 +02:00
commit 7c00abcc05
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -138,6 +138,28 @@ void main() {
expect(find.textContaining('cat', findRichText: true), findsNothing);
});
testWidgets('the faces are centred in the card, and a tap on their text '
'shows and hides the answer too', (tester) async {
await cards.create(
'japanese',
CardContent(front: paragraph('猫'), back: paragraph('cat')),
);
await study(tester, width: 400);
final card = tester.getRect(find.byType(StudyCardSurface));
double centreOf(String text) =>
tester.getCenter(find.text(text, findRichText: true)).dx;
expect(centreOf('猫'), moreOrLessEquals(card.center.dx, epsilon: 1));
await tester.tap(find.text('猫', findRichText: true));
await tester.pumpAndSettle();
expect(centreOf('cat'), moreOrLessEquals(card.center.dx, epsilon: 1));
await tester.tap(find.text('cat', findRichText: true));
await tester.pumpAndSettle();
expect(find.textContaining('cat', findRichText: true), findsNothing);
});
testWidgets('on a phone, a card swiped right is rated Good, one let go '
'early springs back', (tester) async {
await cards.create(