Prepare Android release and refine bookshelf
This commit is contained in:
+90
-54
@@ -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),
|
||||
|
||||
@@ -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
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user