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:
+177
-105
@@ -6,6 +6,42 @@ import '../domain/puzzle.dart';
|
||||
import 'paper.dart';
|
||||
import 'translation.dart';
|
||||
|
||||
const regionInk = Color(0xff84421f);
|
||||
|
||||
class RegionButton extends StatelessWidget {
|
||||
const RegionButton({
|
||||
super.key,
|
||||
required this.label,
|
||||
required this.onPressed,
|
||||
required this.selected,
|
||||
});
|
||||
final String label;
|
||||
final VoidCallback onPressed;
|
||||
final bool selected;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => PageSwipeBlocker(
|
||||
child: Semantics(
|
||||
selected: selected,
|
||||
child: TextButton(
|
||||
onPressed: onPressed,
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: selected ? cream : regionInk,
|
||||
backgroundColor: selected ? regionInk : cream.withValues(alpha: .5),
|
||||
textStyle: hand(21).copyWith(
|
||||
fontWeight: selected ? FontWeight.bold : FontWeight.normal,
|
||||
),
|
||||
minimumSize: const Size(48, 48),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
|
||||
side: BorderSide(color: regionInk, width: selected ? 2.4 : 1),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(6)),
|
||||
),
|
||||
child: CopyText(label),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class Board extends StatelessWidget {
|
||||
const Board({
|
||||
super.key,
|
||||
@@ -57,120 +93,156 @@ class Board extends StatelessWidget {
|
||||
indices.where((i) => cells[i] == 1).length == total;
|
||||
return Align(
|
||||
alignment: Alignment.center,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: u, height: u),
|
||||
for (var col = 0; col < n; col++)
|
||||
clue(
|
||||
'${puzzle.cols[col]}',
|
||||
complete(
|
||||
List.generate(n, (i) => i * n + col),
|
||||
puzzle.cols[col],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
for (var row = 0; row < n; row++)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
child: SizedBox(
|
||||
width: (n + 1) * u,
|
||||
height: (n + 1) * u,
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
clue(
|
||||
'${puzzle.rows[row]}',
|
||||
complete(
|
||||
List.generate(n, (i) => row * n + i),
|
||||
puzzle.rows[row],
|
||||
),
|
||||
),
|
||||
for (var col = 0; col < n; col++)
|
||||
Builder(
|
||||
builder: (context) {
|
||||
final i = row * n + col,
|
||||
value = cells[i],
|
||||
fixed = puzzle.given[i],
|
||||
inside = r?.contains(i, n) ?? false;
|
||||
final state = value == 0
|
||||
? 'empty'
|
||||
: value == 1
|
||||
? 'lit'
|
||||
: 'crossed out';
|
||||
return Semantics(
|
||||
label: CopyScope.text(
|
||||
context,
|
||||
'Row ${row + 1}, column ${col + 1}, $state${fixed ? ', fixed clue' : ''}',
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: u, height: u),
|
||||
for (var col = 0; col < n; col++)
|
||||
clue(
|
||||
'${puzzle.cols[col]}',
|
||||
complete(
|
||||
List.generate(n, (i) => i * n + col),
|
||||
puzzle.cols[col],
|
||||
),
|
||||
button: !fixed && !won,
|
||||
enabled: !fixed && !won,
|
||||
onTap: fixed || won
|
||||
? null
|
||||
: () => onMark(i),
|
||||
excludeSemantics: true,
|
||||
child: GestureDetector(
|
||||
key: ValueKey('cell-$i'),
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: fixed || won
|
||||
? null
|
||||
: () => onMark(i),
|
||||
child: SizedBox(
|
||||
width: u,
|
||||
height: u,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(2),
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: inside
|
||||
? amber.withValues(alpha: .22)
|
||||
: Colors.transparent,
|
||||
borderRadius:
|
||||
BorderRadius.circular(2),
|
||||
border: Border.all(
|
||||
color: inside
|
||||
? const Color(0xffaa5b2a)
|
||||
: muted.withValues(
|
||||
alpha: .48,
|
||||
),
|
||||
width: inside ? 1.4 : .65,
|
||||
),
|
||||
],
|
||||
),
|
||||
for (var row = 0; row < n; row++)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
clue(
|
||||
'${puzzle.rows[row]}',
|
||||
complete(
|
||||
List.generate(n, (i) => row * n + i),
|
||||
puzzle.rows[row],
|
||||
),
|
||||
),
|
||||
for (var col = 0; col < n; col++)
|
||||
Builder(
|
||||
builder: (context) {
|
||||
final i = row * n + col,
|
||||
value = cells[i],
|
||||
fixed = puzzle.given[i],
|
||||
inside = r?.contains(i, n) ?? false;
|
||||
final state = value == 0
|
||||
? 'empty'
|
||||
: value == 1
|
||||
? 'lit'
|
||||
: 'crossed out';
|
||||
return Semantics(
|
||||
selected: inside,
|
||||
label: CopyScope.text(
|
||||
context,
|
||||
'Row ${row + 1}, column ${col + 1}, $state${fixed ? ', fixed clue' : ''}',
|
||||
),
|
||||
button: !fixed && !won,
|
||||
enabled: !fixed && !won,
|
||||
onTap: fixed || won
|
||||
? null
|
||||
: () => onMark(i),
|
||||
excludeSemantics: true,
|
||||
child: GestureDetector(
|
||||
key: ValueKey('cell-$i'),
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: fixed || won
|
||||
? null
|
||||
: () => onMark(i),
|
||||
child: SizedBox(
|
||||
width: u,
|
||||
height: u,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(
|
||||
2,
|
||||
),
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: inside
|
||||
? amber.withValues(
|
||||
alpha: .38,
|
||||
)
|
||||
: Colors.transparent,
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
2,
|
||||
),
|
||||
border: Border.all(
|
||||
color: inside
|
||||
? regionInk
|
||||
: muted.withValues(
|
||||
alpha: .48,
|
||||
),
|
||||
width: inside ? 1.4 : .65,
|
||||
),
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
if (value != 0)
|
||||
Positioned.fill(
|
||||
child: CustomPaint(
|
||||
painter: PencilMark(
|
||||
value: value,
|
||||
variation: i,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (fixed)
|
||||
Positioned(
|
||||
right: 3,
|
||||
bottom: 3,
|
||||
child: Container(
|
||||
width: 4,
|
||||
height: 4,
|
||||
decoration:
|
||||
BoxDecoration(
|
||||
color: muted,
|
||||
shape: BoxShape
|
||||
.circle,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
if (value != 0)
|
||||
Positioned.fill(
|
||||
child: CustomPaint(
|
||||
painter: PencilMark(
|
||||
value: value,
|
||||
variation: i,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (fixed)
|
||||
Positioned(
|
||||
right: 3,
|
||||
bottom: 3,
|
||||
child: Container(
|
||||
width: 4,
|
||||
height: 4,
|
||||
decoration: BoxDecoration(
|
||||
color: muted,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
if (r != null)
|
||||
Positioned(
|
||||
left: u * (1 + r.left),
|
||||
top: u * (1 + r.top),
|
||||
width: u * r.width,
|
||||
height: u * r.height,
|
||||
child: IgnorePointer(
|
||||
child: DecoratedBox(
|
||||
key: const ValueKey('selected-region-outline'),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: regionInk,
|
||||
width: 3.2,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user