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>
74 lines
2 KiB
Dart
74 lines
2 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:halkyon_ui/halkyon_ui.dart';
|
|
import 'package:material_ui/material_ui.dart';
|
|
|
|
void main() {
|
|
/// A list of [lines] with a button that hides while reading onwards.
|
|
Future<void> show(
|
|
WidgetTester tester, {
|
|
int lines = 100,
|
|
bool pinned = false,
|
|
}) async {
|
|
tester.view.physicalSize = const Size(400, 800);
|
|
tester.view.devicePixelRatio = 1;
|
|
addTearDown(tester.view.reset);
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
home: ScrollHidingFab(
|
|
pinned: pinned,
|
|
builder: (context, fab) => Scaffold(
|
|
floatingActionButton: fab,
|
|
body: ListView(
|
|
children: [
|
|
for (var i = 0; i < lines; i++)
|
|
SizedBox(height: 48, child: Text('Line $i')),
|
|
],
|
|
),
|
|
),
|
|
fab: FloatingActionButton(
|
|
tooltip: 'New studyset',
|
|
onPressed: () {},
|
|
child: const Icon(Icons.add),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Finder fab() => find.byTooltip('New studyset').hitTestable();
|
|
|
|
testWidgets('hides while scrolling down and returns when scrolling up', (
|
|
tester,
|
|
) async {
|
|
await show(tester);
|
|
expect(fab(), findsOneWidget);
|
|
|
|
await tester.drag(find.byType(ListView), const Offset(0, -300));
|
|
await tester.pumpAndSettle();
|
|
expect(fab(), findsNothing);
|
|
|
|
await tester.drag(find.byType(ListView), const Offset(0, 100));
|
|
await tester.pumpAndSettle();
|
|
expect(fab(), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('stays when the list fits without scrolling', (tester) async {
|
|
await show(tester, lines: 3);
|
|
|
|
await tester.drag(find.byType(ListView), const Offset(0, -300));
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(fab(), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('stays while pinned, as a field being written in', (
|
|
tester,
|
|
) async {
|
|
await show(tester, pinned: true);
|
|
|
|
await tester.drag(find.byType(ListView), const Offset(0, -300));
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(fab(), findsOneWidget);
|
|
});
|
|
}
|