Prepare Android release and refine bookshelf

This commit is contained in:
Hadrian Burkhardt
2026-11-15 16:20:17 +01:00
parent fc71accb38
commit 062c798fcc
15 changed files with 530 additions and 193 deletions
+13 -64
View File
@@ -29,6 +29,7 @@ import 'services/narrator.dart';
import 'services/progress.dart';
import 'ui/board.dart';
import 'ui/library.dart';
import 'ui/licenses.dart';
import 'ui/discovery.dart';
import 'ui/paper.dart';
@@ -835,42 +836,7 @@ class _NotebookState extends State<Notebook> with WidgetsBindingObserver {
],
),
divider(),
folio('A SMALL DAILY RITUAL'),
action('Island postcards', g.showPostcards),
writing(
DateFormat(
'EEEE, d MMMM',
Localizations.localeOf(context).languageCode,
).format(DateTime.now()),
size: 27,
),
action(
'Play today’s puzzle →',
() => g.startDaily(DateTime.now()),
),
gap(),
folio('BY THE COTTAGE WINDOW'),
writing(
'A few spare pages for practice. For overlapping-area puzzles, follow the notebook’s story.',
size: 22,
color: muted,
),
action(
'Difficulty · ${g.difficulty.label} ▾',
chooseDifficulty,
),
action(
'Practice · ${g.difficulty.label} · Level ${g.practiceLevel}',
() => unawaited(g.startPractice()),
),
action('How to play', rules),
action(
'Open-source licenses',
() => showLicensePage(
context: context,
applicationName: 'Lumen',
),
),
gap(),
writing(
'Leave a light in the window.',
@@ -896,6 +862,7 @@ class _NotebookState extends State<Notebook> with WidgetsBindingObserver {
('Sound & atmosphere', soundSettings),
('Recording speed', speed),
('Privacy & advertising', privacy),
('Open-source licenses', openSourceLicenses),
if (kDebugMode || appFlavor == 'qa' || appFlavor == 'check')
('Playtest report', playtestReport),
])
@@ -910,6 +877,10 @@ class _NotebookState extends State<Notebook> with WidgetsBindingObserver {
),
);
void openSourceLicenses() => Navigator.of(
context,
).push(MaterialPageRoute<void>(builder: (_) => const OpenSourceLicenses()));
Future<void> playtestReport() => showDialog<void>(
context: context,
builder: (c) => AlertDialog(
@@ -1921,40 +1892,18 @@ class _NotebookState extends State<Notebook> with WidgetsBindingObserver {
);
}
Future<void> chooseDifficulty() async {
await showDialog<void>(
context: context,
builder: (c) => SimpleDialog(
title: CopyText('Classic practice pace', style: hand(29)),
children: [
for (final d in Difficulty.values)
SimpleDialogOption(
onPressed: () {
g.selectDifficulty(d);
Navigator.pop(c);
},
child: CopyText(
'${CopyScope.text(context, d.label)} — ${CopyScope.text(context, d.description)}',
style: hand(23),
),
),
],
),
);
}
void rules() {
final text = CopyScope.text(
final rulesText = CopyScope.text(
context,
'Light exactly as many cells as the number beside each row and above each column.\n\nTap to cycle: empty → light → crossed out → empty. Mark every cell to finish. Small dots mark fixed clues.\n\nA, B and C are overlapping areas with their own totals. Shared cells count in both areas. Compare clues and subtract their shared parts to find new deductions.\n\nEvery story grid reveals an object. Later pages require area comparisons; all are solvable without guessing. Classic practice grades the length of simpler row and column chains.\n\nWatch a rewarded ad for each explained hint. Hints are optional, and your puzzle remains available if no ad can be shown. Streaks count consecutive daily completions on this device.',
'Light the number of cells shown beside each row and above each column. Tap a cell to cycle through light, cross and empty. Mark every cell to finish; dotted cells are fixed clues.\n\nSome puzzles have overlapping areas with their own totals. A shared cell counts in every area it belongs to. Compare the totals to work out which cells to light.\n\nSpecial symbols add clues: matching stars have the same state; exactly one of a matching pair of lanterns is lit; and exactly two touching footprints are lit. Some totals are hidden: use the clue on the page to find them.\n\nStory puzzles reveal memories. Find a daily puzzle or explore island postcards from the bookshelf.',
);
message(
'Find the light',
final hintText = CopyScope.text(
context,
kIsWeb
? '${text.substring(0, text.lastIndexOf('\n\n'))}\n\n${CopyScope.text(context, 'Hints are free in this browser playtest. Each hint reveals one cell and explains the deduction. Streaks count consecutive daily completions in this browser.')}'
: text,
close: 'Got it',
? 'Hints are free in this browser playtest. Each hint reveals one cell and explains the deduction. Streaks count consecutive daily completions in this browser.'
: 'Hints are optional. Watch a rewarded ad to reveal a cell and its explanation; your puzzle remains available if no ad can be shown. Streaks count consecutive daily completions on this device.',
);
message('Find the light', '$rulesText\n\n$hintText', close: 'Got it');
}
Future<void> privacy() async {
+10 -1
View File
@@ -43,8 +43,17 @@ class Ads {
defaultTargetPlatform == TargetPlatform.iOS);
Future<void> start() async {
if (!supported) return;
// Until neutral age screening is implemented, treat all users as children
// and configure the SDK before consent or ad initialization.
await MobileAds.instance.updateRequestConfiguration(
RequestConfiguration(
ageRestrictedTreatment: AgeRestrictedTreatment.child,
maxAdContentRating: MaxAdContentRating.g,
),
);
if (_disposed) return;
ConsentInformation.instance.requestConsentInfoUpdate(
ConsentRequestParameters(),
ConsentRequestParameters(tagForUnderAgeOfConsent: true),
() {
ConsentForm.loadAndShowConsentFormIfRequired((_) => _initialize());
},
+90 -54
View File
@@ -139,66 +139,102 @@ class LibraryBookCard extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// A cloth-bound cover with a recessed illustrated panel. The
// artwork keeps its natural proportions inside each book.
Container(
height: 276,
padding: const EdgeInsets.fromLTRB(22, 20, 14, 20),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [cloth, Color.lerp(cloth, Colors.black, .2)!],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
boxShadow: [
BoxShadow(
color: cloth.withValues(alpha: .22),
offset: const Offset(0, 10),
blurRadius: 16,
spreadRadius: -5,
),
],
border: Border(
left: BorderSide(
color: Color.lerp(cloth, Colors.black, .35)!,
width: 7,
),
right: BorderSide(color: light, width: 3),
),
),
child: Container(
padding: const EdgeInsets.all(14),
decoration: BoxDecoration(
border: Border.all(color: light.withValues(alpha: .4)),
),
child: Column(
children: [
Icon(
Icons.auto_awesome_outlined,
size: 18,
color: light,
),
const SizedBox(height: 12),
Expanded(
child: story.coverAsset == null
? Icon(Icons.menu_book, size: 64, color: light)
: Image.asset(
artworkAsset(story.coverAsset!),
fit: BoxFit.contain,
excludeFromSemantics: true,
errorBuilder: (_, _, _) => Icon(
Icons.menu_book,
size: 64,
color: light,
if (story.id == 'mara-island' && story.coverAsset != null)
Center(
child: AspectRatio(
aspectRatio: 1.5,
child: Stack(
fit: StackFit.expand,
children: [
Image.asset(
artworkAsset(story.coverAsset!),
fit: BoxFit.contain,
excludeFromSemantics: true,
errorBuilder: (_, _, _) =>
Icon(Icons.menu_book, size: 64, color: light),
),
Center(
child: FractionallySizedBox(
widthFactor: .49,
child: ExcludeSemantics(
child: FittedBox(
fit: BoxFit.scaleDown,
child: CopyText(
'Mara’s\nisland notebook',
textAlign: TextAlign.center,
style: const TextStyle(
fontFamily: 'MaraHand',
fontSize: 28,
color: Color(0xff5e5140),
),
),
),
),
),
),
],
),
),
)
else
Container(
height: 276,
padding: const EdgeInsets.fromLTRB(22, 20, 14, 20),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [cloth, Color.lerp(cloth, Colors.black, .2)!],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
boxShadow: [
BoxShadow(
color: cloth.withValues(alpha: .22),
offset: const Offset(0, 10),
blurRadius: 16,
spreadRadius: -5,
),
const SizedBox(height: 12),
SizedBox(width: 38, child: Divider(color: light)),
],
border: Border(
left: BorderSide(
color: Color.lerp(cloth, Colors.black, .35)!,
width: 7,
),
right: BorderSide(color: light, width: 3),
),
),
child: Container(
padding: const EdgeInsets.all(14),
decoration: BoxDecoration(
border: Border.all(color: light.withValues(alpha: .4)),
),
child: Column(
children: [
Icon(
Icons.auto_awesome_outlined,
size: 18,
color: light,
),
const SizedBox(height: 12),
Expanded(
child: story.coverAsset == null
? Icon(Icons.menu_book, size: 64, color: light)
: Image.asset(
artworkAsset(story.coverAsset!),
fit: BoxFit.contain,
excludeFromSemantics: true,
errorBuilder: (_, _, _) => Icon(
Icons.menu_book,
size: 64,
color: light,
),
),
),
const SizedBox(height: 12),
SizedBox(width: 38, child: Divider(color: light)),
],
),
),
),
),
const SizedBox(height: 24),
CopyText(story.title, style: _type(25, serif: true)),
const SizedBox(height: 10),
+71
View File
@@ -0,0 +1,71 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'translation.dart';
/// Group all distinct notices by component, removing exact duplicates.
Future<Map<String, Set<String>>> collectLicenseNotices(
Stream<LicenseEntry> entries,
) async {
final notices = <String, Set<String>>{};
await for (final entry in entries) {
final text = entry.paragraphs.map((p) => p.text).join('\n\n').trim();
if (text.isEmpty) continue;
for (final package in entry.packages.toSet()) {
notices.putIfAbsent(package, () => <String>{}).add(text);
}
}
return notices;
}
class OpenSourceLicenses extends StatefulWidget {
const OpenSourceLicenses({super.key});
@override
State<OpenSourceLicenses> createState() => _OpenSourceLicensesState();
}
class _OpenSourceLicensesState extends State<OpenSourceLicenses> {
late final notices = collectLicenseNotices(LicenseRegistry.licenses);
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(title: const CopyText('Open-source licenses')),
body: FutureBuilder<Map<String, Set<String>>>(
future: notices,
builder: (context, snapshot) {
if (snapshot.hasError) {
return const Center(child: CopyText('Licenses could not be loaded.'));
}
if (!snapshot.hasData) {
return const Center(child: CircularProgressIndicator());
}
final entries = snapshot.data!.entries.toList()
..sort((a, b) => a.key.toLowerCase().compareTo(b.key.toLowerCase()));
return ListView(
padding: const EdgeInsets.all(20),
children: [
const CopyText(
'Lumen uses open-source software and fonts. Choose a component to read its notices.',
),
const SizedBox(height: 16),
for (final entry in entries)
Card(
child: ExpansionTile(
title: Text(entry.key),
subtitle: const CopyText('View license notice'),
children: [
for (final notice in entry.value)
Padding(
padding: const EdgeInsets.all(16),
child: SelectableText(notice),
),
],
),
),
],
);
},
),
);
}
+40 -18
View File
@@ -98,27 +98,49 @@ class ShelfActivities extends StatelessWidget {
style: const TextStyle(fontFamily: 'sans-serif', fontSize: 15),
),
const SizedBox(height: 12),
Wrap(
spacing: 12,
runSpacing: 8,
children: [
FilledButton.icon(
key: const ValueKey('shelf-daily'),
onPressed: () => game.startDaily(DateTime.now()),
icon: Icon(
game.todaySolved ? Icons.check : Icons.wb_sunny_outlined,
),
label: CopyText(
game.todaySolved ? 'Revisit today’s puzzle' : 'Today’s puzzle',
SizedBox(
width: double.infinity,
child: FilledButton.icon(
key: const ValueKey('shelf-daily'),
onPressed: () => game.startDaily(DateTime.now()),
style: FilledButton.styleFrom(
minimumSize: const Size(0, 64),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
),
icon: Icon(
game.todaySolved ? Icons.check : Icons.wb_sunny_outlined,
size: 24,
),
label: CopyText(
game.todaySolved ? 'Revisit today’s puzzle' : 'Today’s puzzle',
style: const TextStyle(
fontFamily: 'sans-serif',
fontSize: 20,
fontWeight: FontWeight.w600,
),
),
OutlinedButton.icon(
key: const ValueKey('shelf-postcards'),
onPressed: onPostcards,
icon: const Icon(Icons.local_post_office_outlined),
label: const CopyText('Island postcards'),
),
),
const SizedBox(height: 12),
SizedBox(
width: double.infinity,
child: OutlinedButton.icon(
key: const ValueKey('shelf-postcards'),
onPressed: onPostcards,
style: OutlinedButton.styleFrom(
minimumSize: const Size(0, 64),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
),
],
icon: const Icon(Icons.local_post_office_outlined, size: 24),
label: const CopyText(
'Island postcards',
style: TextStyle(
fontFamily: 'sans-serif',
fontSize: 20,
fontWeight: FontWeight.w600,
),
),
),
),
const SizedBox(height: 8),
CopyText(