2023-11-21 01:05:20 +08:00
|
|
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
2023-10-09 09:32:07 +08:00
|
|
|
|
import 'package:starcitizen_doctor/base/ui.dart';
|
2024-01-29 20:44:00 +08:00
|
|
|
|
import 'package:starcitizen_doctor/common/conf/app_conf.dart';
|
2023-10-09 09:32:07 +08:00
|
|
|
|
import 'package:starcitizen_doctor/ui/settings/settings_ui_model.dart';
|
|
|
|
|
|
|
|
|
|
class SettingUI extends BaseUI<SettingUIModel> {
|
|
|
|
|
@override
|
|
|
|
|
Widget? buildBody(BuildContext context, SettingUIModel model) {
|
2023-11-07 20:47:28 +08:00
|
|
|
|
return Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
|
height: MediaQuery.of(context).size.height,
|
|
|
|
|
margin: const EdgeInsets.all(16),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
2023-12-11 23:53:45 +08:00
|
|
|
|
makeSettingsItem(const Icon(FluentIcons.link, size: 20), "创建设置快捷方式",
|
|
|
|
|
subTitle: "在桌面创建《SC汉化盒子》快捷方式", onTap: model.addShortCut),
|
2023-11-21 01:05:20 +08:00
|
|
|
|
if (AppConf.isMSE) ...[
|
2023-12-11 23:53:45 +08:00
|
|
|
|
const SizedBox(height: 12),
|
2023-12-06 20:49:14 +08:00
|
|
|
|
makeSettingsItem(
|
|
|
|
|
const Icon(FluentIcons.reset_device, size: 20), "重置自动密码填充",
|
2023-11-07 22:49:09 +08:00
|
|
|
|
subTitle:
|
|
|
|
|
"启用:${model.isEnableAutoLogin ? "已启用" : "已禁用"} 设备支持:${model.isDeviceSupportWinHello ? "支持" : "不支持"} 邮箱:${model.autoLoginEmail} 密码:${model.isEnableAutoLoginPwd ? "已加密保存" : "未保存"}",
|
2023-11-21 01:05:20 +08:00
|
|
|
|
onTap: model.onResetAutoLogin),
|
2023-11-21 23:36:26 +08:00
|
|
|
|
],
|
2023-11-28 20:04:15 +08:00
|
|
|
|
const SizedBox(height: 12),
|
2023-12-06 20:49:14 +08:00
|
|
|
|
makeSettingsItem(const Icon(FontAwesomeIcons.microchip, size: 20),
|
2023-11-28 20:04:15 +08:00
|
|
|
|
"启动游戏时忽略能效核心( 适用于Intel 12th+ 处理器 ) [实验性功能,请随时反馈]",
|
|
|
|
|
subTitle:
|
|
|
|
|
"已设置的核心数量:${model.inputGameLaunchECore} (此功能适用于首页的盒子一键启动 或 工具中的RSI启动器管理员模式,当为 0 时不启用此功能 )",
|
|
|
|
|
onTap: model.setGameLaunchECore),
|
|
|
|
|
const SizedBox(height: 12),
|
2023-12-06 20:49:14 +08:00
|
|
|
|
makeSettingsItem(const Icon(FluentIcons.folder_open, size: 20),
|
|
|
|
|
"设置启动器文件(RSI Launcher.exe)",
|
2023-11-21 23:36:26 +08:00
|
|
|
|
subTitle: model.customLauncherPath != null
|
|
|
|
|
? "${model.customLauncherPath}"
|
|
|
|
|
: "手动设置启动器位置,建议仅在无法自动扫描安装位置时使用",
|
2023-11-22 00:10:12 +08:00
|
|
|
|
onTap: model.setLauncherPath, onDel: () {
|
|
|
|
|
model.delName("custom_launcher_path");
|
|
|
|
|
}),
|
2023-11-21 23:36:26 +08:00
|
|
|
|
const SizedBox(height: 12),
|
2023-12-06 20:49:14 +08:00
|
|
|
|
makeSettingsItem(const Icon(FluentIcons.game, size: 20),
|
|
|
|
|
"设置游戏文件 (StarCitizen.exe)",
|
2023-11-21 23:36:26 +08:00
|
|
|
|
subTitle: model.customGamePath != null
|
|
|
|
|
? "${model.customGamePath}"
|
|
|
|
|
: "手动设置游戏安装位置,建议仅在无法自动扫描安装位置时使用",
|
2023-11-22 00:10:12 +08:00
|
|
|
|
onTap: model.setGamePath, onDel: () {
|
|
|
|
|
model.delName("custom_game_path");
|
|
|
|
|
}),
|
2023-12-06 20:49:14 +08:00
|
|
|
|
const SizedBox(height: 12),
|
|
|
|
|
makeSettingsItem(const Icon(FluentIcons.delete, size: 20), "清理汉化文件缓存",
|
|
|
|
|
subTitle:
|
|
|
|
|
"缓存大小 ${(model.locationCacheSize / 1024 / 1024).toStringAsFixed(2)}MB,清理盒子下载的汉化文件缓存,不会影响已安装的汉化",
|
|
|
|
|
onTap: model.cleanLocationCache),
|
2023-11-07 20:47:28 +08:00
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget makeSettingsItem(Widget icon, String title,
|
2023-11-21 23:36:26 +08:00
|
|
|
|
{String? subTitle, VoidCallback? onTap, VoidCallback? onDel}) {
|
2023-11-07 20:47:28 +08:00
|
|
|
|
return Button(
|
|
|
|
|
onPressed: onTap,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.only(top: 12, bottom: 12),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
2023-12-06 20:49:14 +08:00
|
|
|
|
icon,
|
|
|
|
|
const SizedBox(width: 16),
|
2023-11-07 20:47:28 +08:00
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Text(title),
|
|
|
|
|
const Spacer(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (subTitle != null) ...[
|
|
|
|
|
const SizedBox(height: 3),
|
|
|
|
|
Text(
|
|
|
|
|
subTitle,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12, color: Colors.white.withOpacity(.6)),
|
|
|
|
|
)
|
2023-11-21 23:36:26 +08:00
|
|
|
|
]
|
2023-11-07 20:47:28 +08:00
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
2023-11-21 23:36:26 +08:00
|
|
|
|
if (onDel != null) ...[
|
|
|
|
|
Button(
|
|
|
|
|
onPressed: onDel,
|
|
|
|
|
child: const Padding(
|
|
|
|
|
padding: EdgeInsets.all(6),
|
|
|
|
|
child: Icon(FluentIcons.delete),
|
|
|
|
|
)),
|
|
|
|
|
const SizedBox(width: 12),
|
|
|
|
|
],
|
2023-11-07 20:47:28 +08:00
|
|
|
|
const Icon(FluentIcons.chevron_right),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
2023-10-09 09:32:07 +08:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
String getUITitle(BuildContext context, SettingUIModel model) => "SettingUI";
|
|
|
|
|
}
|