2021-09-29 23:57:09 +00:00
|
|
|
import 'dart:convert';
|
2021-10-16 17:17:06 +00:00
|
|
|
import 'dart:io';
|
2021-09-29 23:57:09 +00:00
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
2021-10-16 17:17:06 +00:00
|
|
|
import 'package:pikapi/basic/Common.dart';
|
2021-09-29 23:57:09 +00:00
|
|
|
import 'package:pikapi/basic/config/AndroidDisplayMode.dart';
|
|
|
|
import 'package:pikapi/basic/config/AutoClean.dart';
|
|
|
|
import 'package:pikapi/basic/config/AutoFullScreen.dart';
|
2021-10-07 03:47:28 +00:00
|
|
|
import 'package:pikapi/basic/config/ChooserRoot.dart';
|
2021-09-29 23:57:09 +00:00
|
|
|
import 'package:pikapi/basic/config/ContentFailedReloadAction.dart';
|
|
|
|
import 'package:pikapi/basic/config/FullScreenAction.dart';
|
|
|
|
import 'package:pikapi/basic/config/FullScreenUI.dart';
|
|
|
|
import 'package:pikapi/basic/config/KeyboardController.dart';
|
|
|
|
import 'package:pikapi/basic/config/PagerAction.dart';
|
|
|
|
import 'package:pikapi/basic/config/ReaderDirection.dart';
|
|
|
|
import 'package:pikapi/basic/config/ReaderType.dart';
|
|
|
|
import 'package:pikapi/basic/config/Quality.dart';
|
|
|
|
import 'package:pikapi/basic/config/ShadowCategories.dart';
|
2021-10-15 06:18:29 +00:00
|
|
|
import 'package:pikapi/basic/config/Themes.dart';
|
2021-10-19 06:28:12 +00:00
|
|
|
import 'package:pikapi/basic/config/TimeOffsetHour.dart';
|
2021-09-29 23:57:09 +00:00
|
|
|
import 'package:pikapi/basic/config/VolumeController.dart';
|
|
|
|
import 'package:pikapi/screens/components/NetworkSetting.dart';
|
|
|
|
|
|
|
|
import 'CleanScreen.dart';
|
2021-10-18 09:31:05 +00:00
|
|
|
import 'MigrateScreen.dart';
|
2021-09-29 23:57:09 +00:00
|
|
|
|
|
|
|
class SettingsScreen extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() => _SettingsScreenState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _SettingsScreenState extends State<SettingsScreen> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) => Scaffold(
|
|
|
|
appBar: AppBar(title: Text('设置')),
|
|
|
|
body: ListView(
|
|
|
|
children: [
|
|
|
|
Divider(),
|
|
|
|
NetworkSetting(),
|
|
|
|
Divider(),
|
|
|
|
ListTile(
|
|
|
|
title: Text("浏览时的图片质量"),
|
|
|
|
subtitle: Text(currentQualityName()),
|
|
|
|
onTap: () async {
|
|
|
|
await chooseQuality(context);
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
title: Text("阅读器模式"),
|
|
|
|
subtitle: Text(currentReaderTypeName()),
|
|
|
|
onTap: () async {
|
|
|
|
await choosePagerType(context);
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
title: Text("阅读器方向"),
|
|
|
|
subtitle: Text(currentReaderDirectionName()),
|
|
|
|
onTap: () async {
|
|
|
|
await choosePagerDirection(context);
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
title: Text("进入阅读器自动全屏"),
|
|
|
|
subtitle: Text(autoFullScreenName()),
|
|
|
|
onTap: () async {
|
|
|
|
await chooseAutoFullScreen(context);
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
title: Text("进入全屏的方式"),
|
|
|
|
subtitle: Text(currentFullScreenActionName()),
|
|
|
|
onTap: () async {
|
|
|
|
await chooseFullScreenAction(context);
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
),
|
2021-10-13 13:57:35 +00:00
|
|
|
volumeControllerSetting(),
|
|
|
|
keyboardControllerSetting(),
|
2021-09-29 23:57:09 +00:00
|
|
|
Divider(),
|
|
|
|
ListTile(
|
|
|
|
title: Text("封印"),
|
|
|
|
subtitle: Text(jsonEncode(shadowCategories)),
|
|
|
|
onTap: () async {
|
|
|
|
await chooseShadowCategories(context);
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
title: Text("列表页加载方式"),
|
|
|
|
subtitle: Text(currentPagerActionName()),
|
|
|
|
onTap: () async {
|
|
|
|
await choosePagerAction(context);
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
title: Text("全屏UI"),
|
|
|
|
subtitle: Text(currentFullScreenUIName()),
|
|
|
|
onTap: () async {
|
|
|
|
await chooseFullScreenUI(context);
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
title: Text("加载失败时"),
|
|
|
|
subtitle: Text(currentContentFailedReloadActionName()),
|
|
|
|
onTap: () async {
|
|
|
|
await chooseContentFailedReloadAction(context);
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
),
|
2021-10-19 06:28:12 +00:00
|
|
|
timeZoneSetting(),
|
2021-09-29 23:57:09 +00:00
|
|
|
Divider(),
|
|
|
|
ListTile(
|
|
|
|
title: Text("自动清理缓存"),
|
|
|
|
subtitle: Text(currentAutoCleanSec()),
|
|
|
|
onTap: () async {
|
|
|
|
await chooseAutoCleanSec(context);
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
onTap: () {
|
|
|
|
Navigator.push(
|
|
|
|
context,
|
|
|
|
MaterialPageRoute(builder: (context) => CleanScreen()),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
title: Text('清除缓存'),
|
|
|
|
),
|
|
|
|
Divider(),
|
2021-10-13 13:57:35 +00:00
|
|
|
androidDisplayModeSetting(),
|
2021-09-29 23:57:09 +00:00
|
|
|
Divider(),
|
2021-10-07 03:47:28 +00:00
|
|
|
ListTile(
|
|
|
|
title: Text("文件夹选择器默认路径"),
|
|
|
|
subtitle: Text(currentChooserRoot()),
|
|
|
|
onTap: () async {
|
|
|
|
await inputChooserRoot(context);
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
),
|
2021-10-15 06:18:29 +00:00
|
|
|
fontSetting(),
|
2021-10-07 03:47:28 +00:00
|
|
|
Divider(),
|
2021-10-16 17:17:06 +00:00
|
|
|
migrate(),
|
2021-09-29 23:57:09 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
2021-10-16 17:17:06 +00:00
|
|
|
|
|
|
|
Widget migrate() {
|
|
|
|
if (Platform.isAndroid) {
|
|
|
|
return ListTile(
|
|
|
|
title: Text("文件迁移"),
|
|
|
|
subtitle: Text("更换您的数据文件夹"),
|
|
|
|
onTap: () async {
|
2021-10-18 09:31:05 +00:00
|
|
|
var f = await confirmDialog(
|
2021-10-16 17:17:06 +00:00
|
|
|
context,
|
|
|
|
"文件迁移",
|
2021-10-18 09:31:05 +00:00
|
|
|
"此功能菜单保存后, 需要重启程序, 您确认吗"
|
2021-10-16 17:17:06 +00:00
|
|
|
);
|
2021-10-18 09:31:05 +00:00
|
|
|
if (f) {
|
|
|
|
Navigator.of(context).pushAndRemoveUntil(
|
|
|
|
MaterialPageRoute(builder: (BuildContext context) {
|
|
|
|
return MigrateScreen();
|
|
|
|
}),
|
|
|
|
(route) => false,
|
|
|
|
);
|
|
|
|
}
|
2021-10-16 17:17:06 +00:00
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return Container();
|
|
|
|
}
|
2021-09-29 23:57:09 +00:00
|
|
|
}
|