From bb48504016ba1a72f9f6e9d1289e90697b0a14f3 Mon Sep 17 00:00:00 2001 From: xkeyC <3334969096@qq.com> Date: Sat, 30 Mar 2024 15:07:32 +0800 Subject: [PATCH] fix: LocalizationUIModel _cfgFile dir --- lib/common/conf/const_conf.dart | 6 ++--- lib/ui/home/home_ui.dart | 23 ++++++++++++++++--- .../localization/localization_ui_model.dart | 8 +++---- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/lib/common/conf/const_conf.dart b/lib/common/conf/const_conf.dart index 2294b31..6ebdef5 100644 --- a/lib/common/conf/const_conf.dart +++ b/lib/common/conf/const_conf.dart @@ -1,7 +1,7 @@ class ConstConf { - static const String appVersion = "2.10.9 Beta"; - static const int appVersionCode = 44; - static const String appVersionDate = "2024-03-26"; + static const String appVersion = "2.10.10 Beta"; + static const int appVersionCode = 45; + static const String appVersionDate = "2024-03-30"; static const gameChannels = ["LIVE", "PTU", "EPTU"]; static const isMSE = String.fromEnvironment("MSE", defaultValue: "false") == "true"; diff --git a/lib/ui/home/home_ui.dart b/lib/ui/home/home_ui.dart index aa441e2..ada0af1 100644 --- a/lib/ui/home/home_ui.dart +++ b/lib/ui/home/home_ui.dart @@ -149,24 +149,31 @@ class HomeUI extends HookConsumerWidget { onPressed: homeState.webLocalizationVersionsData == null ? null : () => model.launchRSI(context), + style: homeState.isCurGameRunning + ? null + : ButtonStyle( + backgroundColor: + ButtonState.resolveWith(_getRunButtonColor), + ), child: Padding( padding: const EdgeInsets.all(6), child: Icon( homeState.isCurGameRunning ? FluentIcons.stop_solid - : FluentIcons.play, + : FluentIcons.play_solid, color: homeState.isCurGameRunning ? Colors.red.withOpacity(.8) - : null, + : Colors.white, ), )), const SizedBox(width: 12), Button( + onPressed: () => + SystemHelper.openDir("\"${homeState.scInstalledPath}\""), child: const Padding( padding: EdgeInsets.all(6), child: Icon(FluentIcons.folder_open), ), - onPressed: () => SystemHelper.openDir(homeState.scInstalledPath), ), const SizedBox(width: 12), Button( @@ -801,6 +808,16 @@ class HomeUI extends HookConsumerWidget { context.push("/index/$key"); } } + + Color? _getRunButtonColor(Set 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 { diff --git a/lib/ui/home/localization/localization_ui_model.dart b/lib/ui/home/localization/localization_ui_model.dart index 939ed90..129f661 100644 --- a/lib/ui/home/localization/localization_ui_model.dart +++ b/lib/ui/home/localization/localization_ui_model.dart @@ -45,16 +45,16 @@ class LocalizationUIModel extends _$LocalizationUIModel { "chinese_(traditional)": NoL10n.langZHT, }; - late final _downloadDir = + Directory get _downloadDir => Directory("${appGlobalState.applicationSupportDir}\\Localizations"); - late final _customizeDir = + Directory get _customizeDir => Directory("${_downloadDir.absolute.path}\\Customize_ini"); - late final _scDataDir = + Directory get _scDataDir => 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;