feat: Guide UI

This commit is contained in:
2024-11-03 18:32:12 +08:00
parent 0577b54f9c
commit 8a58719908
21 changed files with 555 additions and 37 deletions

View File

@ -16,11 +16,6 @@ class SettingsUI extends HookConsumerWidget {
final appGlobalModel = ref.read(appGlobalModelProvider.notifier);
return ListView(padding: const EdgeInsets.all(16), children: [
makeTitle(S.current.settings_title_general),
makeSettingsItem(const Icon(FluentIcons.link, size: 20),
S.current.setting_action_create_settings_shortcut,
subTitle: S.current.setting_action_create_desktop_shortcut,
onTap: () => model.addShortCut(context)),
const SizedBox(height: 12),
makeSettingsItem(
const Icon(FontAwesomeIcons.language, size: 20),
S.current.settings_app_language,
@ -32,8 +27,13 @@ class SettingsUI extends HookConsumerWidget {
showGoIcon: false,
),
const SizedBox(height: 12),
makeSettingsItem(
const Icon(FontAwesomeIcons.networkWired, size: 20), S.current.settings_item_dns,
makeSettingsItem(const Icon(FluentIcons.link, size: 20),
S.current.setting_action_create_settings_shortcut,
subTitle: S.current.setting_action_create_desktop_shortcut,
onTap: () => model.addShortCut(context)),
const SizedBox(height: 12),
makeSettingsItem(const Icon(FontAwesomeIcons.networkWired, size: 20),
S.current.settings_item_dns,
subTitle: S.current.settings_item_dns_info,
switchStatus: sate.isUseInternalDNS,
onSwitch: model.onChangeUseInternalDNS,
@ -177,4 +177,4 @@ class SettingsUI extends HookConsumerWidget {
),
);
}
}
}

View File

@ -69,10 +69,13 @@ class SettingsUIModel extends _$SettingsUIModel {
}
Future<void> setLauncherPath(BuildContext context) async {
await showToast(context, "${S.current.setting_toast_select_launcher_exe}");
final r = await FilePicker.platform.pickFiles(
dialogTitle: S.current.setting_action_info_select_rsi_launcher_location,
type: FileType.custom,
allowedExtensions: ["exe"]);
dialogTitle: S.current.setting_action_info_select_rsi_launcher_location,
type: FileType.custom,
allowedExtensions: ["exe"],
lockParentWindow: true,
);
if (r == null || r.files.firstOrNull?.path == null) return;
final fileName = r.files.first.path!;
if (fileName.endsWith("\\RSI Launcher.exe")) {
@ -87,10 +90,13 @@ class SettingsUIModel extends _$SettingsUIModel {
}
Future<void> setGamePath(BuildContext context) async {
await showToast(context, "${S.current.setting_toast_select_game_file}");
final r = await FilePicker.platform.pickFiles(
dialogTitle: S.current.setting_action_info_select_game_install_location,
type: FileType.custom,
allowedExtensions: ["exe"]);
dialogTitle: S.current.setting_action_info_select_game_install_location,
type: FileType.custom,
allowedExtensions: ["exe"],
lockParentWindow: true,
);
if (r == null || r.files.firstOrNull?.path == null) return;
final fileName = r.files.first.path!;
dPrint(fileName);
@ -211,7 +217,8 @@ class SettingsUIModel extends _$SettingsUIModel {
Future _loadUseInternalDNS() async {
final userBox = await Hive.openBox("app_conf");
final isUseInternalDNS = userBox.get("isUseInternalDNS", defaultValue: false);
final isUseInternalDNS =
userBox.get("isUseInternalDNS", defaultValue: false);
state = state.copyWith(isUseInternalDNS: isUseInternalDNS);
}
}
}

View File

@ -6,7 +6,7 @@ part of 'settings_ui_model.dart';
// RiverpodGenerator
// **************************************************************************
String _$settingsUIModelHash() => r'de58885742e29aae6b1226c16c03655a6a6b018d';
String _$settingsUIModelHash() => r'27193efaa8964e8a097daf8dbabf93bb1fdcab3c';
/// See also [SettingsUIModel].
@ProviderFor(SettingsUIModel)