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
+72
View File
@@ -0,0 +1,72 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:lumen/domain/book.dart';
import 'package:lumen/domain/game.dart';
import 'package:lumen/domain/library.dart';
import 'package:lumen/main.dart';
import 'package:lumen/services/progress.dart';
void main() {
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
testWidgets(
'selected region keeps pencil marks visible in both orientations',
(tester) async {
expect(const bool.fromEnvironment('QA_TEST'), true);
final library = await StoryLibrary.load();
final book = await library.open('midnight-invitation');
final game = Game(book, Progress.memory(), library: library);
game.showStory(book.pageFor(2, StoryPageType.puzzle));
await tester.pumpWidget(LumenApp(game: game, adsEnabled: false));
await tester.pumpAndSettle();
await binding.convertFlutterSurfaceToImage();
for (final orientation in [
DeviceOrientation.portraitUp,
DeviceOrientation.landscapeLeft,
]) {
await SystemChrome.setPreferredOrientations([orientation]);
final portrait = orientation == DeviceOrientation.portraitUp;
for (var i = 0; i < 30; i++) {
await tester.pump(const Duration(milliseconds: 100));
if ((tester.view.physicalSize.height >
tester.view.physicalSize.width) ==
portrait) {
break;
}
}
await tester.pumpAndSettle();
await tester.ensureVisible(find.byKey(const ValueKey('area-1')));
await tester.tap(find.byKey(const ValueKey('area-1')));
await tester.pumpAndSettle();
final p = game.puzzle!;
final region = p.regions[1];
final targets = List.generate(p.size * p.size, (i) => i)
.where((i) => region.contains(i, p.size) && !p.given[i])
.take(2)
.toList();
for (var i = 0; i < targets.length; i++) {
final cell = targets[i];
final finder = find.byKey(ValueKey('cell-$cell'));
await tester.ensureVisible(finder);
while (game.cells[cell] != i + 1) {
await tester.tap(finder);
await tester.pumpAndSettle();
}
}
expect(find.text('Undo a mark'), findsNothing);
expect(find.image(AssetImage(book.paperAsset!)), findsOneWidget);
await tester.ensureVisible(
find.byKey(const ValueKey('selected-region-outline')),
);
await tester.pumpAndSettle();
await binding.takeScreenshot(
'halloween-region-selected-${portrait ? 'portrait' : 'landscape'}',
);
expect(tester.takeException(), isNull);
}
await tester.pumpWidget(const SizedBox());
await SystemChrome.setPreferredOrientations([]);
},
);
}