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:
+24
-1
@@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
|
||||
|
||||
import 'puzzle.dart';
|
||||
import 'library.dart';
|
||||
import 'soundscape.dart';
|
||||
|
||||
class CampaignLevel {
|
||||
CampaignLevel(Map<String, dynamic> data)
|
||||
@@ -97,13 +98,15 @@ class Book {
|
||||
this.defaultLanguage = 'en',
|
||||
this.presentation = 'mara',
|
||||
this.coverAsset = 'assets/artwork/home-notebook-cover-v2.png',
|
||||
this.paperAsset,
|
||||
this.continueAt = 4,
|
||||
this.initiallyAccessible = 3,
|
||||
this.fontFamily = 'MaraHand',
|
||||
this.copy = const {},
|
||||
this.atmosphere = const {},
|
||||
});
|
||||
final String id, title, description, language, defaultLanguage, presentation;
|
||||
final String? coverAsset, fontFamily;
|
||||
final String? coverAsset, paperAsset, fontFamily;
|
||||
final int? continueAt;
|
||||
final int initiallyAccessible;
|
||||
final Map<String, String> copy;
|
||||
@@ -111,6 +114,7 @@ class Book {
|
||||
final List<CampaignLevel> levels;
|
||||
final List<StoryPage> pages;
|
||||
final Map<String, dynamic> tracks;
|
||||
final Map<String, Soundscape> atmosphere;
|
||||
bool get isMara => presentation == 'mara';
|
||||
List<String> get chapters => levels.map((l) => l.chapterId).toSet().toList();
|
||||
List<int> chapterLevels(int chapter) => [
|
||||
@@ -281,11 +285,29 @@ class Book {
|
||||
final tracks = trackPath == null
|
||||
? <String, dynamic>{}
|
||||
: Map<String, dynamic>.from((await read(trackPath))['tracks']);
|
||||
final atmosphere = <String, Soundscape>{};
|
||||
if (definition.atmosphereAsset != null) {
|
||||
final data = await read(definition.atmosphereAsset!);
|
||||
final scenes = data['scenes'] as Map;
|
||||
final pageIds = pages.map((p) => p.id).toSet();
|
||||
for (final entry in (data['pages'] as Map).entries) {
|
||||
final asset = scenes[entry.value]?['asset'];
|
||||
if (!pageIds.contains(entry.key) ||
|
||||
asset is! String ||
|
||||
!asset.startsWith('assets/') ||
|
||||
asset.contains('..') ||
|
||||
!asset.endsWith('.wav')) {
|
||||
throw FormatException('Invalid atmosphere: ${entry.key}');
|
||||
}
|
||||
atmosphere[entry.key as String] = Soundscape(asset);
|
||||
}
|
||||
}
|
||||
return Book(
|
||||
translation['premise'] as String? ?? campaign['premise'],
|
||||
levels,
|
||||
pages,
|
||||
tracks,
|
||||
atmosphere: Map.unmodifiable(atmosphere),
|
||||
id: definition.id,
|
||||
title: translation['title'] as String? ?? definition.title,
|
||||
description:
|
||||
@@ -294,6 +316,7 @@ class Book {
|
||||
defaultLanguage: definition.defaultLanguage,
|
||||
presentation: definition.presentation,
|
||||
coverAsset: translation['coverAsset'] as String? ?? definition.coverAsset,
|
||||
paperAsset: translation['paperAsset'] as String? ?? definition.paperAsset,
|
||||
continueAt: definition.continueAt,
|
||||
initiallyAccessible: definition.initiallyAccessible.clamp(
|
||||
0,
|
||||
|
||||
Reference in New Issue
Block a user