generated from dellevin/template
更新readme
This commit is contained in:
@@ -629,7 +629,7 @@ class _BookDetailPageState extends State<BookDetailPage> {
|
||||
final isOverlay = _detailStyle == 1;
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
|
||||
padding: EdgeInsets.symmetric(horizontal: 24, vertical: isOverlay ? 5 : 16),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -662,7 +662,7 @@ class _BookDetailPageState extends State<BookDetailPage> {
|
||||
final isOverlay = _detailStyle == 1;
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
|
||||
padding: EdgeInsets.symmetric(horizontal: 24, vertical: isOverlay ? 5 : 16),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -695,7 +695,7 @@ class _BookDetailPageState extends State<BookDetailPage> {
|
||||
final isOverlay = _detailStyle == 1;
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
|
||||
padding: EdgeInsets.symmetric(horizontal: 24, vertical: isOverlay ? 5 : 16),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -728,7 +728,7 @@ class _BookDetailPageState extends State<BookDetailPage> {
|
||||
final isOverlay = _detailStyle == 1;
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
|
||||
padding: EdgeInsets.symmetric(horizontal: 24, vertical: isOverlay ? 5 : 16),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -760,7 +760,7 @@ class _BookDetailPageState extends State<BookDetailPage> {
|
||||
Widget _buildGenresSection(Book book) {
|
||||
final isOverlay = _detailStyle == 1;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
|
||||
padding: EdgeInsets.symmetric(horizontal: 24, vertical: isOverlay ? 5 : 16),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
306
lib/pages/changelog_page.dart
Normal file
306
lib/pages/changelog_page.dart
Normal file
@@ -0,0 +1,306 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import '../utils/changelog_service.dart';
|
||||
|
||||
/// 更新日志页面
|
||||
class ChangelogPage extends StatefulWidget {
|
||||
const ChangelogPage({super.key});
|
||||
|
||||
@override
|
||||
State<ChangelogPage> createState() => _ChangelogPageState();
|
||||
}
|
||||
|
||||
class _ChangelogPageState extends State<ChangelogPage> {
|
||||
List<ChangelogItem>? _items;
|
||||
bool _loading = true;
|
||||
bool _checking = false;
|
||||
static const _websiteUrl = 'https://mooknote.iletter.top/#/';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_load();
|
||||
}
|
||||
|
||||
Future<void> _load() async {
|
||||
final items = await ChangelogService.fetchChangelog();
|
||||
if (mounted) setState(() { _items = items; _loading = false; });
|
||||
}
|
||||
|
||||
Future<void> _checkUpdate() async {
|
||||
setState(() => _checking = true);
|
||||
try {
|
||||
final hasUpdate = await ChangelogService.hasUpdate();
|
||||
if (!mounted) return;
|
||||
final info = await PackageInfo.fromPlatform();
|
||||
final localVersion = 'v${info.version}';
|
||||
if (!mounted) return;
|
||||
if (hasUpdate) {
|
||||
final latest = _items != null && _items!.isNotEmpty
|
||||
? _items!.first.version
|
||||
: '新版本';
|
||||
final latestVersion = await ChangelogService.fetchLatestVersion();
|
||||
_showUpdateDialog(
|
||||
version: latestVersion ?? latest,
|
||||
localVersion: localVersion,
|
||||
);
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
content: Text('已是最新版本(当前 $localVersion)'),
|
||||
duration: const Duration(seconds: 2),
|
||||
));
|
||||
}
|
||||
} catch (_) {}
|
||||
if (mounted) setState(() => _checking = false);
|
||||
}
|
||||
|
||||
void _showUpdateDialog({required String version, String? localVersion}) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
backgroundColor: colors.surface,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
||||
title: Row(children: [
|
||||
Icon(Icons.system_update_outlined, color: colors.primary, size: 24),
|
||||
const SizedBox(width: 10),
|
||||
Text('发现新版本', style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: colors.onSurface)),
|
||||
]),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (localVersion != null) ...[
|
||||
Text('当前版本:$localVersion',
|
||||
style: TextStyle(fontSize: 12, color: colors.onSurface.withValues(alpha: 0.35))),
|
||||
const SizedBox(height: 6),
|
||||
],
|
||||
Text('最新版本 $version 已发布,是否下载更新?',
|
||||
style: TextStyle(fontSize: 14, color: colors.onSurface.withValues(alpha: 0.6), height: 1.5)),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx),
|
||||
child: Text('稍后再说', style: TextStyle(color: colors.onSurface.withValues(alpha: 0.5))),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
FilledButton.icon(
|
||||
onPressed: () async {
|
||||
Navigator.pop(ctx);
|
||||
try {
|
||||
await launchUrl(Uri.parse(_websiteUrl), mode: LaunchMode.externalApplication);
|
||||
} catch (_) {}
|
||||
},
|
||||
icon: const Icon(Icons.open_in_browser, size: 18),
|
||||
label: const Text('去官网下载'),
|
||||
),
|
||||
],
|
||||
actionsPadding: const EdgeInsets.fromLTRB(16, 8, 16, 12),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
return Scaffold(
|
||||
backgroundColor: colors.surface,
|
||||
appBar: AppBar(
|
||||
title: const Text('更新日志'),
|
||||
actions: [
|
||||
_checking
|
||||
? const Padding(
|
||||
padding: EdgeInsets.only(right: 16),
|
||||
child: SizedBox(width: 20, height: 20, child: CircularProgressIndicator(strokeWidth: 2)))
|
||||
: IconButton(
|
||||
icon: const Icon(Icons.refresh, size: 20),
|
||||
tooltip: '检查更新',
|
||||
onPressed: _checkUpdate,
|
||||
),
|
||||
],
|
||||
),
|
||||
body: _loading
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: _items == null || _items!.isEmpty
|
||||
? Center(
|
||||
child: Text('暂无更新日志',
|
||||
style: TextStyle(color: colors.onSurface.withValues(alpha: 0.4))))
|
||||
: ListView(
|
||||
padding: const EdgeInsets.all(20),
|
||||
children: [
|
||||
_buildWebsiteCard(colors),
|
||||
const SizedBox(height: 20),
|
||||
..._items!.map((item) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16),
|
||||
child: _buildCard(item, colors),
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildWebsiteCard(ColorScheme colors) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(18, 16, 18, 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.language, size: 18, color: colors.primary),
|
||||
const SizedBox(width: 8),
|
||||
Text('官方网站',
|
||||
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: colors.onSurface)),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 18),
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
try {
|
||||
await launchUrl(Uri.parse(_websiteUrl), mode: LaunchMode.externalApplication);
|
||||
} catch (_) {}
|
||||
},
|
||||
child: Text(_websiteUrl,
|
||||
style: TextStyle(fontSize: 13, color: colors.primary)),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
Divider(height: 1, color: colors.outlineVariant),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Clipboard.setData(const ClipboardData(text: _websiteUrl));
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||
content: Text('已复制到剪贴板'),
|
||||
duration: Duration(seconds: 1),
|
||||
));
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
alignment: Alignment.center,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.copy, size: 16, color: colors.onSurface.withValues(alpha: 0.5)),
|
||||
const SizedBox(width: 6),
|
||||
Text('复制链接',
|
||||
style: TextStyle(fontSize: 13, color: colors.onSurface.withValues(alpha: 0.5))),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(width: 1, height: 24, color: colors.outlineVariant),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
try {
|
||||
await launchUrl(Uri.parse(_websiteUrl), mode: LaunchMode.externalApplication);
|
||||
} catch (_) {}
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
alignment: Alignment.center,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.open_in_browser, size: 16, color: colors.primary),
|
||||
const SizedBox(width: 6),
|
||||
Text('浏览器打开',
|
||||
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500, color: colors.primary)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCard(ChangelogItem item, ColorScheme colors) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(18),
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: colors.primary,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
item.version,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: colors.onPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
item.date,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: colors.onSurface.withValues(alpha: 0.5),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
...item.features.map((f) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 6),
|
||||
width: 6,
|
||||
height: 6,
|
||||
decoration: BoxDecoration(
|
||||
color: colors.primary.withValues(alpha: 0.4),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Text(
|
||||
f,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: colors.onSurface.withValues(alpha: 0.75),
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -222,59 +222,45 @@ class _MovieDetailPageState extends State<MovieDetailPage> {
|
||||
);
|
||||
}
|
||||
|
||||
/// 叠层模式:封面小图 + 标题/评分(毛玻璃卡片)
|
||||
/// 叠层模式:封面小图 + 标题/评分
|
||||
Widget _buildOverlayHeader(Movie movie) {
|
||||
final hasPoster = movie.posterPath != null && movie.posterPath!.isNotEmpty;
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: BackdropFilter(
|
||||
filter: ui.ImageFilter.blur(sigmaX: 15, sigmaY: 15),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(16),
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: 100, height: 140,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: 0.08),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: 100, height: 140,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
boxShadow: [BoxShadow(color: Colors.black.withValues(alpha: 0.3), blurRadius: 12, offset: const Offset(0, 4))],
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: hasPoster
|
||||
? FadeInLocalImage(path: movie.posterPath, fit: BoxFit.cover)
|
||||
: Container(color: Colors.white24, child: const Icon(Icons.movie_outlined, color: Colors.white38, size: 32)),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
const SizedBox(height: 4),
|
||||
Text(movie.title, style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Colors.white)),
|
||||
if (movie.directors.isNotEmpty) ...[
|
||||
const SizedBox(height: 6),
|
||||
Text('导演:${movie.directors.join(' / ')}', style: TextStyle(fontSize: 14, color: Colors.white.withValues(alpha: 0.6))),
|
||||
],
|
||||
const SizedBox(height: 12),
|
||||
Row(children: [
|
||||
if (movie.rating != null && movie.rating! > 0) ...[
|
||||
const Icon(Icons.star, size: 16, color: Color(0xFFFFB800)),
|
||||
const SizedBox(width: 4),
|
||||
Text(movie.rating!.toStringAsFixed(1), style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w600, color: Color(0xFFFFB800))),
|
||||
const SizedBox(width: 16),
|
||||
],
|
||||
_statusChip(movie.status),
|
||||
]),
|
||||
]),
|
||||
),
|
||||
],
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
boxShadow: [BoxShadow(color: Colors.black.withValues(alpha: 0.3), blurRadius: 12, offset: const Offset(0, 4))],
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: hasPoster
|
||||
? FadeInLocalImage(path: movie.posterPath, fit: BoxFit.cover)
|
||||
: Container(color: Colors.white24, child: const Icon(Icons.movie_outlined, color: Colors.white38, size: 32)),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
const SizedBox(height: 4),
|
||||
Text(movie.title, style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Colors.white)),
|
||||
if (movie.directors.isNotEmpty) ...[
|
||||
const SizedBox(height: 6),
|
||||
Text('导演:${movie.directors.join(' / ')}', style: TextStyle(fontSize: 14, color: Colors.white.withValues(alpha: 0.6))),
|
||||
],
|
||||
const SizedBox(height: 12),
|
||||
Row(children: [
|
||||
if (movie.rating != null && movie.rating! > 0) ...[
|
||||
const Icon(Icons.star, size: 16, color: Color(0xFFFFB800)),
|
||||
const SizedBox(width: 4),
|
||||
Text(movie.rating!.toStringAsFixed(1), style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w600, color: Color(0xFFFFB800))),
|
||||
const SizedBox(width: 16),
|
||||
],
|
||||
_statusChip(movie.status),
|
||||
]),
|
||||
]),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -660,7 +646,7 @@ class _MovieDetailPageState extends State<MovieDetailPage> {
|
||||
final isOverlay = _detailStyle == 1;
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
|
||||
padding: EdgeInsets.symmetric(horizontal: 24, vertical: isOverlay ? 5 : 16),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -693,7 +679,7 @@ class _MovieDetailPageState extends State<MovieDetailPage> {
|
||||
final isOverlay = _detailStyle == 1;
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
|
||||
padding: EdgeInsets.symmetric(horizontal: 24, vertical: isOverlay ? 5 : 16),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -726,7 +712,7 @@ class _MovieDetailPageState extends State<MovieDetailPage> {
|
||||
final isOverlay = _detailStyle == 1;
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
|
||||
padding: EdgeInsets.symmetric(horizontal: 24, vertical: isOverlay ? 5 : 16),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -758,7 +744,7 @@ class _MovieDetailPageState extends State<MovieDetailPage> {
|
||||
Widget _buildGenresSection(Movie movie) {
|
||||
final isOverlay = _detailStyle == 1;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
|
||||
padding: EdgeInsets.symmetric(horizontal: 24, vertical: isOverlay ? 5 : 16),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
@@ -12,6 +12,7 @@ import 'recycle_bin_page.dart';
|
||||
import 'sync/backup_page.dart';
|
||||
import '../widgets/fade_in_local_image.dart';
|
||||
import 'statistics_page.dart';
|
||||
import 'changelog_page.dart';
|
||||
import 'sync/cloud_sync_page.dart';
|
||||
import 'app_icon_picker_page.dart';
|
||||
import 'tag_management_page.dart';
|
||||
@@ -498,6 +499,13 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
url: 'https://mooknote.iletter.top/#/guide',
|
||||
),
|
||||
Divider(height: 0.5, indent: 24, endIndent: 24, color: colors.outlineVariant),
|
||||
_buildActionItem(
|
||||
icon: Icons.update_outlined,
|
||||
title: '更新日志',
|
||||
subtitle: '查看版本更新内容',
|
||||
onTap: () => Navigator.push(context, MaterialPageRoute(builder: (_) => const ChangelogPage())),
|
||||
),
|
||||
Divider(height: 0.5, indent: 24, endIndent: 24, color: colors.outlineVariant),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user