fix: LocalizationUIModel _cfgFile dir

This commit is contained in:
xkeyC 2024-03-30 15:07:32 +08:00
parent 4d2c0c20d5
commit bb48504016
3 changed files with 27 additions and 10 deletions

View File

@ -1,7 +1,7 @@
class ConstConf { class ConstConf {
static const String appVersion = "2.10.9 Beta"; static const String appVersion = "2.10.10 Beta";
static const int appVersionCode = 44; static const int appVersionCode = 45;
static const String appVersionDate = "2024-03-26"; static const String appVersionDate = "2024-03-30";
static const gameChannels = ["LIVE", "PTU", "EPTU"]; static const gameChannels = ["LIVE", "PTU", "EPTU"];
static const isMSE = static const isMSE =
String.fromEnvironment("MSE", defaultValue: "false") == "true"; String.fromEnvironment("MSE", defaultValue: "false") == "true";

View File

@ -149,24 +149,31 @@ class HomeUI extends HookConsumerWidget {
onPressed: homeState.webLocalizationVersionsData == null onPressed: homeState.webLocalizationVersionsData == null
? null ? null
: () => model.launchRSI(context), : () => model.launchRSI(context),
style: homeState.isCurGameRunning
? null
: ButtonStyle(
backgroundColor:
ButtonState.resolveWith(_getRunButtonColor),
),
child: Padding( child: Padding(
padding: const EdgeInsets.all(6), padding: const EdgeInsets.all(6),
child: Icon( child: Icon(
homeState.isCurGameRunning homeState.isCurGameRunning
? FluentIcons.stop_solid ? FluentIcons.stop_solid
: FluentIcons.play, : FluentIcons.play_solid,
color: homeState.isCurGameRunning color: homeState.isCurGameRunning
? Colors.red.withOpacity(.8) ? Colors.red.withOpacity(.8)
: null, : Colors.white,
), ),
)), )),
const SizedBox(width: 12), const SizedBox(width: 12),
Button( Button(
onPressed: () =>
SystemHelper.openDir("\"${homeState.scInstalledPath}\""),
child: const Padding( child: const Padding(
padding: EdgeInsets.all(6), padding: EdgeInsets.all(6),
child: Icon(FluentIcons.folder_open), child: Icon(FluentIcons.folder_open),
), ),
onPressed: () => SystemHelper.openDir(homeState.scInstalledPath),
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
Button( Button(
@ -801,6 +808,16 @@ class HomeUI extends HookConsumerWidget {
context.push("/index/$key"); context.push("/index/$key");
} }
} }
Color? _getRunButtonColor(Set<ButtonStates> states) {
if (states.isPressing) {
return const Color.fromRGBO(49, 227, 88, .5);
}
if (states.isHovering) {
return const Color.fromRGBO(47, 213, 84, 1.0);
}
return const Color.fromRGBO(49, 227, 88, .8);
}
} }
class _HomeItemData { class _HomeItemData {

View File

@ -45,16 +45,16 @@ class LocalizationUIModel extends _$LocalizationUIModel {
"chinese_(traditional)": NoL10n.langZHT, "chinese_(traditional)": NoL10n.langZHT,
}; };
late final _downloadDir = Directory get _downloadDir =>
Directory("${appGlobalState.applicationSupportDir}\\Localizations"); Directory("${appGlobalState.applicationSupportDir}\\Localizations");
late final _customizeDir = Directory get _customizeDir =>
Directory("${_downloadDir.absolute.path}\\Customize_ini"); Directory("${_downloadDir.absolute.path}\\Customize_ini");
late final _scDataDir = Directory get _scDataDir =>
Directory("${ref.read(homeUIModelProvider).scInstalledPath}\\data"); Directory("${ref.read(homeUIModelProvider).scInstalledPath}\\data");
late final _cfgFile = File("${_scDataDir.absolute.path}\\system.cfg"); File get _cfgFile => File("${_scDataDir.absolute.path}\\system.cfg");
StreamSubscription? _customizeDirListenSub; StreamSubscription? _customizeDirListenSub;