基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。
add logs page
Predidit0ec360928104
diff --git a/lib/pages/about/about_module.dart b/lib/pages/about/about_module.dartindex 57e535cd..572d3a66 100644--- a/lib/pages/about/about_module.dart+++ b/lib/pages/about/about_module.dart@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';import 'package:kazumi/request/api.dart';import 'package:kazumi/pages/about/about_page.dart';import 'package:flutter_modular/flutter_modular.dart';+import 'package:kazumi/pages/logs/logs_page.dart';class AboutModule extends Module {@override@@ -13,6 +14,7 @@ class AboutModule extends Module {@overridevoid routes(r) {r.child("/", child: (_) => const AboutPage());+ r.child("/logs", child: (_) => const LogsPage());r.child("/license",child: (_) => const LicensePage(applicationName: 'Kazumi',diff --git a/lib/pages/about/about_page.dart b/lib/pages/about/about_page.dartindex bc4d19b1..fa8af631 100644--- a/lib/pages/about/about_page.dart+++ b/lib/pages/about/about_page.dart@@ -55,14 +55,14 @@ class _AboutPageState extends State<AboutPage> {if (mounted) {setState(() {- _cacheSizeMB = totalSizeMB;- });+ _cacheSizeMB = totalSizeMB;+ });}} else {if (mounted) {setState(() {- _cacheSizeMB = 0.0;- });+ _cacheSizeMB = 0.0;+ });}}}@@ -92,35 +92,34 @@ class _AboutPageState extends State<AboutPage> {void _showCacheDialog() {SmartDialog.show(- useAnimation: false,- builder: (context) {- return AlertDialog(- title: const Text('缓存管理'),- content: const Text('缓存为番剧封面, 清除后加载时需要重新下载,确认要清除缓存吗?'),- actions: [- TextButton(- onPressed: () {- SmartDialog.dismiss();- },- child: Text(- '取消',- style:- TextStyle(color: Theme.of(context).colorScheme.outline),- ),- ),- TextButton(- onPressed: () async {- try {- _clearCache();- } catch (_) {}- SmartDialog.dismiss();- },- child: const Text('确认'),+ useAnimation: false,+ builder: (context) {+ return AlertDialog(+ title: const Text('缓存管理'),+ content: const Text('缓存为番剧封面, 清除后加载时需要重新下载,确认要清除缓存吗?'),+ actions: [+ TextButton(+ onPressed: () {+ SmartDialog.dismiss();+ },+ child: Text(+ '取消',+ style: TextStyle(color: Theme.of(context).colorScheme.outline),),- ],- );- },- );+ ),+ TextButton(+ onPressed: () async {+ try {+ _clearCache();+ } catch (_) {}+ SmartDialog.dismiss();+ },+ child: const Text('确认'),+ ),+ ],+ );+ },+ );}@override@@ -173,17 +172,24 @@ class _AboutPageState extends State<AboutPage> {.labelMedium!.copyWith(color: Theme.of(context).colorScheme.outline)),),+ ListTile(+ onTap: () {+ Modular.to.pushNamed('/tab/my/about/logs');+ },+ dense: false,+ title: const Text('错误日志'),+ ),ListTile(onTap: () {_showCacheDialog();},dense: false,title: const Text('清除缓存'),- trailing: _cacheSizeMB == -1 ? const Text('统计中...') :Text('${_cacheSizeMB.toStringAsFixed(2)}MB',- style: Theme.of(context)- .textTheme- .labelMedium!- .copyWith(color: Theme.of(context).colorScheme.outline)),+ trailing: _cacheSizeMB == -1+ ? const Text('统计中...')+ : Text('${_cacheSizeMB.toStringAsFixed(2)}MB',+ style: Theme.of(context).textTheme.labelMedium!.copyWith(+ color: Theme.of(context).colorScheme.outline)),),ListTile(onTap: () {diff --git a/lib/pages/logs/logs_page.dart b/lib/pages/logs/logs_page.dartnew file mode 100644index 00000000..95667176--- /dev/null+++ b/lib/pages/logs/logs_page.dart@@ -0,0 +1,81 @@+import 'dart:io';+import 'package:flutter/material.dart';+import 'package:path_provider/path_provider.dart';+import 'package:flutter/services.dart';+import 'package:kazumi/bean/appbar/sys_app_bar.dart';+import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';++class LogsPage extends StatefulWidget {+ const LogsPage({super.key});++ @override+ State<LogsPage> createState() => _LogsPageState();+}++class _LogsPageState extends State<LogsPage> {+ String fileContent = '';++ @override+ void initState() {+ super.initState();+ _loadLogs();+ }++ Future<void> _loadLogs() async {+ final file = await _getLogsFile();+ if (await file.exists()) {+ final content = await file.readAsString();+ setState(() {+ fileContent = content;+ });+ }+ }++ Future<File> _getLogsFile() async {+ final directory = await getApplicationSupportDirectory();+ final path = directory.path;+ return File('$path/logs/kazumi_logs.log');+ }++ Future<void> _clearLogs() async {+ final file = await _getLogsFile();+ await file.writeAsString('');+ setState(() {+ fileContent = '';+ });+ }++ Future<void> _copyLogs() async {+ await Clipboard.setData(ClipboardData(text: fileContent));+ SmartDialog.showToast('已复制到剪贴板');+ }++ @override+ Widget build(BuildContext context) {+ return Scaffold(+ appBar: const SysAppBar(+ title: Text('日志'),+ ),+ body: fileContent.isEmpty+ ? const Center(child: Text('没有数据'))+ : SingleChildScrollView(+ padding: const EdgeInsets.all(16.0),+ child: Text(fileContent),+ ),+ floatingActionButton: Row(+ mainAxisAlignment: MainAxisAlignment.end,+ children: [+ FloatingActionButton(+ onPressed: _clearLogs,+ child: const Icon(Icons.clear_all),+ ),+ const SizedBox(width: 15),+ FloatingActionButton(+ onPressed: _copyLogs,+ child: const Icon(Icons.copy),+ ),+ ],+ ),+ );+ }+}