log按钮搬家

This commit is contained in:
2024-02-22 19:34:00 +08:00
parent f640574190
commit eafd249847
3 changed files with 47 additions and 25 deletions

View File

@ -12,6 +12,31 @@ class GameDoctorUI extends BaseUI<GameDoctorUIModel> {
children: [
Column(
children: [
const SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
for (final item in const {
"rsi_log": "RSI启动器log",
"game_log": "游戏运行log",
}.entries)
Padding(
padding: const EdgeInsets.only(left: 6, right: 6),
child: Button(
child: Padding(
padding: const EdgeInsets.all(4),
child: Row(
children: [
const Icon(FluentIcons.folder_open),
const SizedBox(width: 6),
Text(item.value),
],
),
),
onPressed: () => model.onTapButton(item.key)),
),
],
),
if (model.isChecking)
Expanded(
child: Center(

View File

@ -239,4 +239,26 @@ class GameDoctorUIModel extends BaseUIModel {
return;
}
}
onTapButton(String key) async {
switch (key) {
case "rsi_log":
final path = await SCLoggerHelper.getLogFilePath();
if (path == null) return;
openDir(path);
return;
case "game_log":
if (scInstalledPath == "not_install") {
showToast(context!, "请在首页选择游戏安装目录。");
return;
}
openDir("$scInstalledPath\\Game.log");
return;
}
}
openDir(path) async {
await Process.run(
SystemHelper.powershellPath, ["explorer.exe", "/select,\"$path\""]);
}
}