fix(learn,ui): the open assistant field holds still: no flicker, no sliding away, no resizing under the keyboard (ADR 0021, D69)
Inside a studyset the field flickered as it opened and closed: the floating location switched between a raised centre and the centre, which Scaffold animates by scaling the button out and in. It keeps one location now, raised above the licence line by padding. While open it no longer slides away as the studyset or the Library scrolls (ScrollHidingFab.pinned, new), and the keyboard covers Home, the Library, a studyset and a session rather than shrinking them; the field lifts itself by as much of the keyboard as reaches above it. NavigationFrame no longer resizes for the keyboard itself, leaving it to each tab's own scaffold, which still does by default (Todo's, Train's and Meditate's tests pass unchanged). Whats-New: Inside a studyset, the question field opens without flickering, stays while you scroll, and the screen no longer jumps when the keyboard comes. Whats-New-De: In einem Lernset öffnet sich das Fragefeld ohne Flackern, bleibt beim Scrollen stehen, und der Bildschirm springt nicht mehr, wenn die Tastatur kommt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
f45ed98d52
commit
bc4953aaf8
1 changed files with 255 additions and 47 deletions
|
|
@ -769,4 +769,87 @@ void main() {
|
|||
expect(written(tester), '');
|
||||
});
|
||||
});
|
||||
|
||||
group("a studyset's field (D69)", () {
|
||||
setUp(
|
||||
() => studysets.receiveRemoteChange(
|
||||
'licensed',
|
||||
encodeStudysetPayload(
|
||||
StudysetContent(
|
||||
title: 'Licensed',
|
||||
description: RichContent.empty(),
|
||||
license: 'CC-BY-SA-4.0',
|
||||
licenseHolder: 'raisondetredev',
|
||||
),
|
||||
),
|
||||
position: 'a2',
|
||||
),
|
||||
);
|
||||
|
||||
Future<void> showStudyset(WidgetTester tester) async {
|
||||
await showApp(tester, location: RoutePaths.studyset('licensed'));
|
||||
}
|
||||
|
||||
testWidgets('unfolds in place, the button never scaled out and in as '
|
||||
'the scaffold does on a change of location (the flicker of 4 Nov '
|
||||
'2026)', (tester) async {
|
||||
await showStudyset(tester);
|
||||
final button = tester.element(find.byType(AssistantButton));
|
||||
|
||||
await tester.tap(find.byTooltip('Search the web'));
|
||||
for (var frame = 0; frame < 10; frame++) {
|
||||
await tester.pump(const Duration(milliseconds: 16));
|
||||
for (final scale in tester.widgetList<ScaleTransition>(
|
||||
find.ancestor(
|
||||
of: find.byType(AssistantButton),
|
||||
matching: find.byType(ScaleTransition),
|
||||
),
|
||||
)) {
|
||||
expect(scale.scale.value, 1, reason: 'frame $frame');
|
||||
}
|
||||
}
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(AssistantField), findsOneWidget);
|
||||
expect(
|
||||
tester.element(find.byType(AssistantButton)),
|
||||
same(button),
|
||||
reason: 'the same button, unfolded',
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('open, it stays in view while the studyset scrolls, and the '
|
||||
'keyboard leaves the screen its size, the field rising above it', (
|
||||
tester,
|
||||
) async {
|
||||
await showStudyset(tester);
|
||||
final body = find
|
||||
.descendant(
|
||||
of: find.byType(Scaffold).last,
|
||||
matching: find.byType(Column),
|
||||
)
|
||||
.first;
|
||||
final size = tester.getSize(body);
|
||||
await tester.tap(find.byTooltip('Search the web'));
|
||||
await tester.pumpAndSettle();
|
||||
final field = tester.getRect(find.byType(AssistantField));
|
||||
|
||||
tester.view.viewInsets = const FakeViewPadding(bottom: 300);
|
||||
addTearDown(tester.view.resetViewInsets);
|
||||
await tester.pumpAndSettle();
|
||||
expect(tester.getSize(body), size, reason: 'not resized');
|
||||
expect(
|
||||
tester.getRect(find.byType(AssistantField)).bottom,
|
||||
lessThanOrEqualTo(900 - 300),
|
||||
reason: 'above the keyboard',
|
||||
);
|
||||
expect(
|
||||
tester.getRect(find.byType(AssistantField)).bottom,
|
||||
lessThan(field.bottom),
|
||||
);
|
||||
|
||||
await tester.drag(body, const Offset(0, -300), warnIfMissed: false);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(AssistantField).hitTestable(), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue