Open Lumen on a responsive bookshelf and land pending story work

- Start the app on a shelf of every installed book instead of the last
  book's home. Cards show the cover, translated metadata, available
  languages, restored patterns and either "Continue reading" or a way in.
- Keep each book's saved route: the shelf is never written to
  flutter_screen, so choosing a book resumes its own leaf.
- Lay the shelf out responsively: dense single-column cards on phones,
  a two-column grid from 720 logical pixels, a centred 860 px column on
  tablets and a chevron that exists in the bundled handwriting font.
- Keep Settings reachable from the shelf and let the home page's story
  library button open the shelf instead of a dialog.
- Add tool/shelf_screenshots_test.dart, which renders the shelf at phone
  and tablet metrics, checks that every card and Settings stay reachable
  without overflow, and writes artifacts/library/shelf-*.png.
- Commit the pending Midnight Invitation package (campaign, notebook,
  narration and artwork), cast drama and ambience tooling, region
  selection, phone/tablet integration coverage and related docs.

flutter analyze is clean and all 74 widget/domain tests pass.
This commit is contained in:
Hadrian Burkhardt
2026-11-05 14:29:50 +01:00
parent d45cd0698a
commit 0718e3f252
149 changed files with 16875 additions and 393 deletions
+68 -12
View File
@@ -47,6 +47,7 @@ void main() {
await tap('Story library');
await tap('The paper boat');
expect(g.book.id, 'paper-boat');
expect(find.text('The paper boat').hitTestable(), findsOneWidget);
await tap('Open The paper boat · 0 / 1');
expect(g.storyPage.id, 'boat.entry');
await tap('Next leaf →');
@@ -54,30 +55,85 @@ void main() {
await tester.tap(find.byKey(const ValueKey('cell-0')));
await tester.pumpAndSettle();
final marks = List<int>.of(g.cells);
await tap('Bookmark');
expect(find.text('Contents'), findsNothing);
expect(find.text('Bookmark'), findsNothing);
expect(find.text('Language'), findsNothing);
expect(find.text('Close book'), findsNothing);
await tester.binding.handlePopRoute();
await tester.pumpAndSettle();
expect(g.screen, Screen.home);
await tap('Settings');
await tap('Language');
await tap('Deutsch');
expect(g.book.language, 'de');
expect(g.screen, Screen.home);
g.openNotebook();
await tester.pumpAndSettle();
expect(g.storyPage.id, 'boat.puzzle');
expect(g.cells, marks);
expect(g.canUndo, true);
expect(find.text('Eine kleine Überfahrt'), findsOneWidget);
expect(find.text('Nächste Seite →'), findsOneWidget);
expect(g.progress.text('notebook_manual_bookmark'), 'boat.puzzle');
await tap('Buch schließen');
await tester.binding.handlePopRoute();
await tester.pumpAndSettle();
expect(g.screen, Screen.home);
expect(find.text('Einstellungen'), findsOneWidget);
await tap('Geschichtenbibliothek');
expect(
find.descendant(
of: find.byType(AlertDialog),
matching: find.text('Das Papierboot'),
),
findsOneWidget,
);
expect(g.screen, Screen.library);
expect(find.text('Wähle ein Buch'), findsOneWidget);
expect(find.text('Das Papierboot'), findsOneWidget);
expect(tester.takeException(), isNull);
await tester.pumpWidget(const SizedBox());
},
);
testWidgets('the first window is the bookshelf and opens a chosen book', (
tester,
) async {
tester.view.physicalSize = const Size(600, 960);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
final library = (await tester.runAsync(StoryLibrary.load))!;
await tester.runAsync(() async {
for (final story in library.stories) {
for (final language in story.languages.keys) {
await library.open(story.id, language: language);
}
}
});
final book = (await tester.runAsync(() => library.open('mara-island')))!;
final g = Game(book, Progress.memory({'language': 'en'}), library: library)
..showLibrary();
await tester.pumpWidget(LumenApp(game: g, adsEnabled: false));
// The shelf loads books through futures created outside the fake async
// zone, so give the real event loop a turn before checking the cards.
for (var i = 0; i < 3; i++) {
await tester.runAsync(
() => Future<void>.delayed(const Duration(milliseconds: 20)),
);
await tester.pump();
}
expect(g.screen, Screen.library);
expect(find.byKey(const ValueKey('library')), findsOneWidget);
for (final story in library.stories) {
expect(find.text(story.title), findsOneWidget);
}
expect(find.text('Open this book ›'), findsNWidgets(3));
final boat = find.text('The paper boat');
await tester.ensureVisible(boat);
await tester.pumpAndSettle();
await tester.tap(boat);
await tester.runAsync(
() => Future<void>.delayed(const Duration(milliseconds: 20)),
);
await tester.pumpAndSettle();
expect(g.book.id, 'paper-boat');
expect(g.screen, Screen.home);
expect(find.text('Open The paper boat · 0 / 1'), findsOneWidget);
expect(tester.takeException(), isNull);
await tester.pumpWidget(const SizedBox());
});
testWidgets(
'German story pages fit portrait and landscape with larger text',
(tester) async {
@@ -101,7 +157,7 @@ void main() {
for (var i = 0; i < book.pages.length; i++) {
g.showStory(i);
await tester.pumpAndSettle();
expect(find.text('Sprache').hitTestable(), findsOneWidget);
expect(find.text('Sprache'), findsNothing);
expect(
find
.text(i == 2 ? 'Zum Inhaltsverzeichnis' : 'Nächste Seite →')
@@ -151,7 +207,7 @@ void main() {
final heading = find.text('البداية');
expect(Directionality.of(tester.element(heading)), TextDirection.rtl);
expect(tester.widget<Text>(heading).style?.fontFamily, 'sans-serif');
expect(find.text('اللغة'), findsOneWidget);
expect(find.text('اللغة'), findsNothing);
g.startCampaign(0);
await tester.pumpAndSettle();
expect(