l10: update common & Lang settings

This commit is contained in:
2024-03-17 16:54:09 +08:00
parent 9d97dfc786
commit 17588dfab8
31 changed files with 1203 additions and 500 deletions

View File

@ -38,6 +38,7 @@ class AboutUI extends HookConsumerWidget {
)),
const SizedBox(height: 32),
Container(
margin: const EdgeInsets.all(24),
decoration: BoxDecoration(
color: FluentTheme.of(context).cardColor,
borderRadius: BorderRadius.circular(12)),

View File

@ -7,7 +7,7 @@ part of 'home_game_login_dialog_ui_model.dart';
// **************************************************************************
String _$homeGameLoginUIModelHash() =>
r'bcd5fc6d85345207797dd51253b2608035e1fc36';
r'108812122298cf826ee57ecad3e519b1dc3fd6ce';
/// See also [HomeGameLoginUIModel].
@ProviderFor(HomeGameLoginUIModel)

View File

@ -190,8 +190,8 @@ class _$HomeDownloaderUIStateImpl implements _HomeDownloaderUIState {
.equals(other._waitingTasks, _waitingTasks) &&
const DeepCollectionEquality()
.equals(other._stoppedTasks, _stoppedTasks) &&
(identical(other.globalStat, globalStat) ||
other.globalStat == globalStat));
const DeepCollectionEquality()
.equals(other.globalStat, globalStat));
}
@override
@ -200,7 +200,7 @@ class _$HomeDownloaderUIStateImpl implements _HomeDownloaderUIState {
const DeepCollectionEquality().hash(_tasks),
const DeepCollectionEquality().hash(_waitingTasks),
const DeepCollectionEquality().hash(_stoppedTasks),
globalStat);
const DeepCollectionEquality().hash(globalStat));
@JsonKey(ignore: true)
@override

View File

@ -7,7 +7,7 @@ part of 'home_downloader_ui_model.dart';
// **************************************************************************
String _$homeDownloaderUIModelHash() =>
r'88e1c9a667672d303cb244305dc0aec89d77ffe5';
r'ece2e6da4576b945ead5767aea2ccacf5e3e17aa';
/// See also [HomeDownloaderUIModel].
@ProviderFor(HomeDownloaderUIModel)

View File

@ -7,7 +7,7 @@ part of 'game_doctor_ui_model.dart';
// **************************************************************************
String _$homeGameDoctorUIModelHash() =>
r'10e8103fca9565ee6363c093e1d0bf2bc9e68f41';
r'b4132559510e3e59b1e2e330d9327ff8790df461';
/// See also [HomeGameDoctorUIModel].
@ProviderFor(HomeGameDoctorUIModel)

View File

@ -6,7 +6,7 @@ part of 'home_ui_model.dart';
// RiverpodGenerator
// **************************************************************************
String _$homeUIModelHash() => r'8268fab911b162f2f3f8a5a86449ea15a759569b';
String _$homeUIModelHash() => r'b62026bb0b5ab37c0aed33e0ed018aa9732da58e';
/// See also [HomeUIModel].
@ProviderFor(HomeUIModel)

View File

@ -424,6 +424,7 @@ class LocalizationDialogUI extends HookConsumerWidget {
S.current.localization_info_language,
style: const TextStyle(fontSize: 16),
),
const SizedBox(width: 12),
ComboBox<String>(
value: state.selectedLanguage,
items: [

View File

@ -7,7 +7,7 @@ part of 'localization_ui_model.dart';
// **************************************************************************
String _$localizationUIModelHash() =>
r'33c538abcdbfd667e844d0dcb5b8b7d6264794ab';
r'697f9e00ea08729c5debb4d87ffe9fadb5c0ec71';
/// See also [LocalizationUIModel].
@ProviderFor(LocalizationUIModel)

View File

@ -7,7 +7,7 @@ part of 'performance_ui_model.dart';
// **************************************************************************
String _$homePerformanceUIModelHash() =>
r'0519b95b68b4bffcd940513fa800654c81da2502';
r'6ac9c9adc428120cb5ce71949221064c9e5d9385';
/// See also [HomePerformanceUIModel].
@ProviderFor(HomePerformanceUIModel)

View File

@ -2,10 +2,10 @@ import 'package:fluent_ui/fluent_ui.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:starcitizen_doctor/app.dart';
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
import 'package:starcitizen_doctor/provider/aria2c.dart';
import 'package:starcitizen_doctor/ui/home/home_ui_model.dart';
import 'package:starcitizen_doctor/ui/party_room/party_room_ui.dart';
import 'package:starcitizen_doctor/ui/settings/settings_ui_model.dart';
import 'package:starcitizen_doctor/widgets/widgets.dart';
import 'package:window_manager/window_manager.dart';
@ -23,6 +23,7 @@ class IndexUI extends HookConsumerWidget {
// pre init child
ref.watch(homeUIModelProvider.select((value) => null));
ref.watch(settingsUIModelProvider.select((value) => null));
ref.watch(appGlobalModelProvider);
final curIndex = useState(0);
return NavigationView(
@ -73,6 +74,7 @@ class IndexUI extends HookConsumerWidget {
],
)),
pane: NavigationPane(
key: Key("NavigationPane_${S.current.app_language_code}"),
selected: curIndex.value,
items: getNavigationPaneItems(curIndex),
size: NavigationPaneSize(
@ -89,7 +91,7 @@ class IndexUI extends HookConsumerWidget {
Map<IconData, String> get pageMenus => {
FluentIcons.home: S.current.app_index_menu_home,
FluentIcons.game: S.current.app_index_menu_lobby,
// FluentIcons.game: S.current.app_index_menu_lobby,
FluentIcons.toolbox: S.current.app_index_menu_tools,
FluentIcons.settings: S.current.app_index_menu_settings,
FluentIcons.info: S.current.app_index_menu_about,
@ -129,13 +131,13 @@ class IndexUI extends HookConsumerWidget {
switch (value) {
case 0:
return const HomeUI();
// case 1:
// return const PartyRoomUI();
case 1:
return const PartyRoomUI();
case 2:
return const ToolsUI();
case 3:
case 2:
return const SettingsUI();
case 4:
case 3:
return const AboutUI();
default:
return Center(

View File

@ -1,6 +1,7 @@
import 'package:fluent_ui/fluent_ui.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:starcitizen_doctor/app.dart';
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
import 'package:starcitizen_doctor/generated/l10n.dart';
import 'package:starcitizen_doctor/ui/settings/settings_ui_model.dart';
@ -12,90 +13,102 @@ class SettingsUI extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final sate = ref.watch(settingsUIModelProvider);
final model = ref.read(settingsUIModelProvider.notifier);
return Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
margin: const EdgeInsets.all(16),
child: Column(
children: [
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)),
if (ConstConf.isMSE) ...[
const SizedBox(height: 12),
makeSettingsItem(const Icon(FluentIcons.reset_device, size: 20),
S.current.setting_action_reset_auto_password_fill,
subTitle: S.current.setting_action_info_device_support_info(
sate.isEnableAutoLogin
? S.current.setting_action_info_enabled
: S.current.setting_action_info_disabled,
sate.isDeviceSupportWinHello
? S.current.setting_action_info_support
: S.current.setting_action_info_not_support,
sate.autoLoginEmail,
sate.isEnableAutoLoginPwd
? S.current.setting_action_info_encrypted_saved
: S.current.setting_action_info_not_saved),
onTap: () => model.onResetAutoLogin(context)),
],
const SizedBox(height: 12),
makeSettingsItem(const Icon(FontAwesomeIcons.microchip, size: 20),
S.current.setting_action_ignore_efficiency_cores_on_launch,
subTitle: S.current
.setting_action_set_core_count(sate.inputGameLaunchECore),
onTap: () => model.setGameLaunchECore(context)),
const SizedBox(height: 12),
makeSettingsItem(const Icon(FluentIcons.folder_open, size: 20),
S.current.setting_action_set_launcher_file,
subTitle: sate.customLauncherPath != null
? "${sate.customLauncherPath}"
: S.current
.setting_action_info_manual_launcher_location_setting,
onTap: () => model.setLauncherPath(context),
onDel: () {
model.delName("custom_launcher_path");
}),
const SizedBox(height: 12),
makeSettingsItem(const Icon(FluentIcons.game, size: 20),
S.current.setting_action_set_game_file,
subTitle: sate.customGamePath != null
? "${sate.customGamePath}"
: S.current.setting_action_info_manual_game_location_setting,
onTap: () => model.setGamePath(context),
onDel: () {
model.delName("custom_game_path");
}),
const SizedBox(height: 12),
makeSettingsItem(const Icon(FluentIcons.delete, size: 20),
S.current.setting_action_clear_translation_file_cache,
subTitle: S.current.setting_action_info_cache_clearing_info(
(sate.locationCacheSize / 1024 / 1024).toStringAsFixed(2)),
onTap: () => model.cleanLocationCache(context)),
const SizedBox(height: 12),
makeSettingsItem(const Icon(FluentIcons.speed_high, size: 20),
S.current.setting_action_tool_site_access_acceleration,
onTap: () =>
model.onChangeToolSiteMirror(!sate.isEnableToolSiteMirrors),
subTitle: S.current.setting_action_info_mirror_server_info,
onSwitch: model.onChangeToolSiteMirror,
switchStatus: sate.isEnableToolSiteMirrors),
const SizedBox(height: 12),
makeSettingsItem(const Icon(FluentIcons.document_set, size: 20),
S.current.setting_action_view_log,
onTap: () => model.showLogs(),
subTitle: S.current.setting_action_info_view_log_file),
],
final appGlobalState = ref.watch(appGlobalModelProvider);
final appGlobalModel = ref.read(appGlobalModelProvider.notifier);
return ListView(padding: const EdgeInsets.all(16), children: [
makeSettingsItem(
const Icon(FontAwesomeIcons.language, size: 20),
S.current.settings_app_language,
subTitle: S.current.settings_app_language_switch_info,
onTap: () {},
onComboChanged: appGlobalModel.changeLocale,
comboMenus: AppGlobalModel.appLocaleSupport,
selectedComboValue: appGlobalState.appLocale ?? const Locale("auto"),
showGoIcon: false,
),
);
const SizedBox(height: 12),
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)),
if (ConstConf.isMSE) ...[
const SizedBox(height: 12),
makeSettingsItem(const Icon(FluentIcons.reset_device, size: 20),
S.current.setting_action_reset_auto_password_fill,
subTitle: S.current.setting_action_info_device_support_info(
sate.isEnableAutoLogin
? S.current.setting_action_info_enabled
: S.current.setting_action_info_disabled,
sate.isDeviceSupportWinHello
? S.current.setting_action_info_support
: S.current.setting_action_info_not_support,
sate.autoLoginEmail,
sate.isEnableAutoLoginPwd
? S.current.setting_action_info_encrypted_saved
: S.current.setting_action_info_not_saved),
onTap: () => model.onResetAutoLogin(context)),
],
const SizedBox(height: 12),
makeSettingsItem(const Icon(FontAwesomeIcons.microchip, size: 20),
S.current.setting_action_ignore_efficiency_cores_on_launch,
subTitle: S.current
.setting_action_set_core_count(sate.inputGameLaunchECore),
onTap: () => model.setGameLaunchECore(context)),
const SizedBox(height: 12),
makeSettingsItem(const Icon(FluentIcons.folder_open, size: 20),
S.current.setting_action_set_launcher_file,
subTitle: sate.customLauncherPath != null
? "${sate.customLauncherPath}"
: S.current.setting_action_info_manual_launcher_location_setting,
onTap: () => model.setLauncherPath(context),
onDel: () {
model.delName("custom_launcher_path");
}),
const SizedBox(height: 12),
makeSettingsItem(const Icon(FluentIcons.game, size: 20),
S.current.setting_action_set_game_file,
subTitle: sate.customGamePath != null
? "${sate.customGamePath}"
: S.current.setting_action_info_manual_game_location_setting,
onTap: () => model.setGamePath(context),
onDel: () {
model.delName("custom_game_path");
}),
const SizedBox(height: 12),
makeSettingsItem(const Icon(FluentIcons.delete, size: 20),
S.current.setting_action_clear_translation_file_cache,
subTitle: S.current.setting_action_info_cache_clearing_info(
(sate.locationCacheSize / 1024 / 1024).toStringAsFixed(2)),
onTap: () => model.cleanLocationCache(context)),
const SizedBox(height: 12),
makeSettingsItem(const Icon(FluentIcons.speed_high, size: 20),
S.current.setting_action_tool_site_access_acceleration,
onTap: () =>
model.onChangeToolSiteMirror(!sate.isEnableToolSiteMirrors),
subTitle: S.current.setting_action_info_mirror_server_info,
onSwitch: model.onChangeToolSiteMirror,
switchStatus: sate.isEnableToolSiteMirrors),
const SizedBox(height: 12),
makeSettingsItem(const Icon(FluentIcons.document_set, size: 20),
S.current.setting_action_view_log,
onTap: () => model.showLogs(),
subTitle: S.current.setting_action_info_view_log_file),
]);
}
Widget makeSettingsItem(Widget icon, String title,
{String? subTitle,
VoidCallback? onTap,
VoidCallback? onDel,
void Function(bool? b)? onSwitch,
bool switchStatus = false}) {
Widget makeSettingsItem(
Widget icon,
String title, {
String? subTitle,
VoidCallback? onTap,
VoidCallback? onDel,
void Function(bool? b)? onSwitch,
bool switchStatus = false,
bool showGoIcon = true,
Map<dynamic, String> comboMenus = const {},
ValueChanged? onComboChanged,
dynamic selectedComboValue,
}) {
return Button(
onPressed: onTap,
child: Padding(
@ -103,7 +116,7 @@ class SettingsUI extends HookConsumerWidget {
child: Row(
children: [
icon,
const SizedBox(width: 16),
const SizedBox(width: 18),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -116,11 +129,15 @@ class SettingsUI extends HookConsumerWidget {
),
if (subTitle != null) ...[
const SizedBox(height: 3),
Text(
subTitle,
style: TextStyle(
fontSize: 12, color: Colors.white.withOpacity(.6)),
)
Padding(
padding: const EdgeInsets.only(right: 12),
child: Text(
subTitle,
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 12, color: Colors.white.withOpacity(.6)),
),
),
]
],
),
@ -136,11 +153,27 @@ class SettingsUI extends HookConsumerWidget {
if (onSwitch != null) ...[
ToggleSwitch(checked: switchStatus, onChanged: onSwitch),
],
if (comboMenus.isNotEmpty) ...[
SizedBox(
height: 36,
child: ComboBox(
value: selectedComboValue,
items: [
for (final mkv in comboMenus.entries)
ComboBoxItem(
value: mkv.key,
child: Text(mkv.value),
)
],
onChanged: onComboChanged,
),
)
],
const SizedBox(width: 12),
const Icon(FluentIcons.chevron_right),
if (showGoIcon) const Icon(FluentIcons.chevron_right),
],
),
),
);
}
}
}

View File

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

View File

@ -6,7 +6,7 @@ part of 'tools_ui_model.dart';
// RiverpodGenerator
// **************************************************************************
String _$toolsUIModelHash() => r'5568cfd422f98a1aff9b8cb9d522c84565fcc289';
String _$toolsUIModelHash() => r'6b4ab0195cc9606202ae5d0dce574735090f486f';
/// See also [ToolsUIModel].
@ProviderFor(ToolsUIModel)