mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-06-28 11:24:46 +08:00
https://github.com/StarCitizenToolBox/app/issues/1 增加一个工具站镜像的功能
This commit is contained in:
@ -51,13 +51,26 @@ class SettingUI extends BaseUI<SettingUIModel> {
|
||||
subTitle:
|
||||
"缓存大小 ${(model.locationCacheSize / 1024 / 1024).toStringAsFixed(2)}MB,清理盒子下载的汉化文件缓存,不会影响已安装的汉化",
|
||||
onTap: model.cleanLocationCache),
|
||||
const SizedBox(height: 12),
|
||||
makeSettingsItem(
|
||||
const Icon(FluentIcons.internet_sharing, size: 20), "工具站访问加速",
|
||||
onTap: () =>
|
||||
model.onChangeToolSiteMirror(!model.isEnableToolSiteMirrors),
|
||||
subTitle:
|
||||
"使用镜像服务器加速访问 DPS UEX 等工具网站,若访问异常请关闭该功能。 为保护账户安全,任何情况下都不会加速RSI官网。",
|
||||
onSwitch: model.onChangeToolSiteMirror,
|
||||
switchStatus: model.isEnableToolSiteMirrors),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget makeSettingsItem(Widget icon, String title,
|
||||
{String? subTitle, VoidCallback? onTap, VoidCallback? onDel}) {
|
||||
{String? subTitle,
|
||||
VoidCallback? onTap,
|
||||
VoidCallback? onDel,
|
||||
void Function(bool? b)? onSwitch,
|
||||
bool switchStatus = false}) {
|
||||
return Button(
|
||||
onPressed: onTap,
|
||||
child: Padding(
|
||||
@ -94,8 +107,11 @@ class SettingUI extends BaseUI<SettingUIModel> {
|
||||
padding: EdgeInsets.all(6),
|
||||
child: Icon(FluentIcons.delete),
|
||||
)),
|
||||
const SizedBox(width: 12),
|
||||
],
|
||||
if (onSwitch != null) ...[
|
||||
ToggleSwitch(checked: switchStatus, onChanged: onSwitch),
|
||||
],
|
||||
const SizedBox(width: 12),
|
||||
const Icon(FluentIcons.chevron_right),
|
||||
],
|
||||
),
|
||||
|
@ -15,6 +15,7 @@ class SettingUIModel extends BaseUIModel {
|
||||
String autoLoginEmail = "-";
|
||||
bool isEnableAutoLogin = false;
|
||||
bool isEnableAutoLoginPwd = false;
|
||||
bool isEnableToolSiteMirrors = false;
|
||||
String inputGameLaunchECore = "0";
|
||||
|
||||
String? customLauncherPath;
|
||||
@ -34,6 +35,7 @@ class SettingUIModel extends BaseUIModel {
|
||||
}
|
||||
_loadCustomPath();
|
||||
_loadLocationCacheSize();
|
||||
_loadToolSiteMirrorState();
|
||||
}
|
||||
|
||||
Future<void> onResetAutoLogin() async {
|
||||
@ -174,4 +176,18 @@ class SettingUIModel extends BaseUIModel {
|
||||
await Process.run(SystemHelper.powershellPath, [script]);
|
||||
showToast(context!, "创建完毕,请返回桌面查看");
|
||||
}
|
||||
|
||||
_loadToolSiteMirrorState() async {
|
||||
final userBox = await Hive.openBox("app_conf");
|
||||
isEnableToolSiteMirrors =
|
||||
userBox.get("isEnableToolSiteMirrors", defaultValue: false);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void onChangeToolSiteMirror(bool? b) async {
|
||||
final userBox = await Hive.openBox("app_conf");
|
||||
isEnableToolSiteMirrors = b == true;
|
||||
await userBox.put("isEnableToolSiteMirrors", isEnableToolSiteMirrors);
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user