feat: Optimize UX

This commit is contained in:
2024-07-07 17:49:15 +08:00
parent 6ff0b7c902
commit 8fee9dba05
13 changed files with 96 additions and 40 deletions

View File

@ -8,6 +8,7 @@ import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:starcitizen_doctor/api/analytics.dart';
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
import 'package:starcitizen_doctor/ui/tools/tools_ui_model.dart';
import 'package:starcitizen_doctor/widgets/widgets.dart';
import 'package:url_launcher/url_launcher_string.dart';
@ -795,15 +796,16 @@ class HomeUI extends HookConsumerWidget {
switch (key) {
case "localization":
if (homeState.scInstalledPath == "not_install") {
showToast(context, gameInstallReqInfo);
ToolsUIModel.rsiEnhance(context, showNotGameInstallMsg: true);
break;
}
final model = ref.watch(homeUIModelProvider.notifier);
model.checkLocalizationUpdate();
await showDialog(
context: context,
dismissWithEsc: false,
builder: (BuildContext context) => const LocalizationDialogUI());
context: context,
dismissWithEsc: false,
builder: (BuildContext context) => const LocalizationDialogUI(),
);
model.checkLocalizationUpdate(skipReload: true);
break;
case "performance":

View File

@ -18,9 +18,6 @@ class HostsBoosterDialogUI extends HookConsumerWidget {
S.current.tools_hosts_info_rsi_official_website: [
"robertsspaceindustries.com"
],
S.current.tools_hosts_info_rsi_zendesk: [
"cloudimperiumservicesllc.zendesk.com"
],
S.current.tools_hosts_info_rsi_customer_service: [
"support.robertsspaceindustries.com"
],

View File

@ -33,7 +33,10 @@ class RSILauncherStateData with _$RSILauncherStateData {
}
class RsiLauncherEnhanceDialogUI extends HookConsumerWidget {
const RsiLauncherEnhanceDialogUI({super.key});
final bool showNotGameInstallMsg;
const RsiLauncherEnhanceDialogUI(
{super.key, this.showNotGameInstallMsg = false});
static const supportLocalizationMap = {
"en": NoL10n.langEn,
@ -113,6 +116,23 @@ class RsiLauncherEnhanceDialogUI extends HookConsumerWidget {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (showNotGameInstallMsg) ...[
InfoBar(
title: const SizedBox(),
content: Text(S.current
.home_localization_action_rsi_launcher_no_game_path_msg),
style: InfoBarThemeData(decoration: (severity) {
return BoxDecoration(
color: Colors.orange,
);
}, iconColor: (severity) {
return Colors.white;
}),
),
const SizedBox(
height: 12,
),
],
if (workingText.value.isNotEmpty) ...[
Center(
child: Column(

View File

@ -593,7 +593,8 @@ class ToolsUIModel extends _$ToolsUIModel {
context.push("/tools/unp4kc");
}
static rsiEnhance(BuildContext context) async {
static rsiEnhance(BuildContext context,
{bool showNotGameInstallMsg = false}) async {
if ((await SystemHelper.getPID("\"RSI Launcher\"")).isNotEmpty) {
if (!context.mounted) return;
showToast(
@ -605,6 +606,8 @@ class ToolsUIModel extends _$ToolsUIModel {
if (!context.mounted) return;
showDialog(
context: context,
builder: (BuildContext context) => const RsiLauncherEnhanceDialogUI());
builder: (BuildContext context) => RsiLauncherEnhanceDialogUI(
showNotGameInstallMsg: showNotGameInstallMsg,
));
}
}