fix(card): in the browser's detail view the list follows the card shown
Next and Previous changed the card beside the list, but the list stayed where it was, so the card shown soon lay outside it. The list now scrolls the card's tile into view: at its end going down, at its start going up, and near it first where the tile lies too far to be built. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MMm7usAo6q9ZZRoPkWjoxi Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
3181223940
commit
7a2f1a96d9
1 changed files with 121 additions and 11 deletions
|
|
@ -260,6 +260,40 @@ void main() {
|
|||
expect(find.text('Tokyo', findRichText: true), findsWidgets);
|
||||
});
|
||||
|
||||
testWidgets('in the detail view the list follows the card shown, down '
|
||||
'and back up', (tester) async {
|
||||
for (var i = 1; i <= 40; i++) {
|
||||
await cards.create(
|
||||
'japanese',
|
||||
CardContent(
|
||||
front: RichContent.plain('Question $i'),
|
||||
back: RichContent.plain('Answer $i'),
|
||||
),
|
||||
);
|
||||
}
|
||||
await show(tester);
|
||||
await tester.tap(find.byTooltip('Detail'));
|
||||
await tester.pumpAndSettle();
|
||||
final list = tester.getRect(find.byType(ListView).first);
|
||||
void expectInView(String front) {
|
||||
final tile = tester.getRect(find.text(front).first);
|
||||
expect(tile.top, greaterThanOrEqualTo(list.top));
|
||||
expect(tile.bottom, lessThanOrEqualTo(list.bottom));
|
||||
}
|
||||
|
||||
// From the first of the 40, made before the three of every test.
|
||||
for (var i = 0; i < 38; i++) {
|
||||
await tester.tap(find.byTooltip('Next'));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
expectInView('Question 39');
|
||||
for (var i = 0; i < 30; i++) {
|
||||
await tester.tap(find.byTooltip('Previous'));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
expectInView('Question 9');
|
||||
});
|
||||
|
||||
testWidgets('on a phone, what can be done to the chosen cards sits at '
|
||||
"the screen's foot, and one card shows above a strip of them", (
|
||||
tester,
|
||||
|
|
|
|||
Loading…
Reference in a new issue