mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-19 16:46:22 +08:00
custom enable log
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -68,6 +68,8 @@ void main() async {
|
||||
Request();
|
||||
await Request.setCookie();
|
||||
RecommendFilter();
|
||||
|
||||
if (GStorage.enableLog) {
|
||||
// 异常捕获 logo记录
|
||||
const String buildConfig = '''\n
|
||||
Build Time: ${BuildConfig.buildTime}
|
||||
@@ -107,6 +109,9 @@ Commit Hash: ${BuildConfig.commitHash}''';
|
||||
runApp(const MyApp());
|
||||
},
|
||||
);
|
||||
} else {
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
// 小白条、导航栏沉浸
|
||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||
|
||||
@@ -3,9 +3,11 @@ import 'dart:io';
|
||||
import 'package:PiliPlus/common/widgets/loading_widget/loading_widget.dart';
|
||||
import 'package:PiliPlus/services/loggeer.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
|
||||
class LogsPage extends StatefulWidget {
|
||||
const LogsPage({super.key});
|
||||
@@ -19,6 +21,7 @@ class _LogsPageState extends State<LogsPage> {
|
||||
late String fileContent;
|
||||
List logsContent = [];
|
||||
DateTime? latestLog;
|
||||
late bool enableLog = GStorage.enableLog;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -114,6 +117,11 @@ class _LogsPageState extends State<LogsPage> {
|
||||
PopupMenuButton<String>(
|
||||
onSelected: (String type) {
|
||||
switch (type) {
|
||||
case 'log':
|
||||
enableLog = !enableLog;
|
||||
GStorage.setting.put(SettingBoxKey.enableLog, enableLog);
|
||||
SmartDialog.showToast('已${enableLog ? '开启' : '关闭'},重启生效');
|
||||
break;
|
||||
case 'copy':
|
||||
copyLogs();
|
||||
break;
|
||||
@@ -128,6 +136,10 @@ class _LogsPageState extends State<LogsPage> {
|
||||
}
|
||||
},
|
||||
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
|
||||
PopupMenuItem<String>(
|
||||
value: 'log',
|
||||
child: Text('${enableLog ? '关闭' : '开启'}日志'),
|
||||
),
|
||||
const PopupMenuItem<String>(
|
||||
value: 'copy',
|
||||
child: Text('复制日志'),
|
||||
|
||||
@@ -497,6 +497,9 @@ class GStorage {
|
||||
static String get banWordForDyn =>
|
||||
GStorage.setting.get(SettingBoxKey.banWordForDyn, defaultValue: '');
|
||||
|
||||
static bool get enableLog =>
|
||||
setting.get(SettingBoxKey.enableLog, defaultValue: true);
|
||||
|
||||
static List<double> get dynamicDetailRatio => List<double>.from(setting
|
||||
.get(SettingBoxKey.dynamicDetailRatio, defaultValue: const [60.0, 40.0]));
|
||||
|
||||
@@ -794,6 +797,7 @@ class SettingBoxKey {
|
||||
pageTransition = 'pageTransition',
|
||||
optTabletNav = 'optTabletNav',
|
||||
banWordForDyn = 'banWordForDyn',
|
||||
enableLog = 'enableLog',
|
||||
|
||||
// WebDAV
|
||||
webdavUri = 'webdavUri',
|
||||
|
||||
Reference in New Issue
Block a user