mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-06-28 07:54:44 +08:00
feat: VehicleSorting l10
fix: _short name
This commit is contained in:
@ -30,7 +30,13 @@ class LocalizationDialogUI extends HookConsumerWidget {
|
||||
return ContentDialog(
|
||||
title: makeTitle(context, model, state),
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: MediaQuery.of(context).size.width * .7, minHeight: MediaQuery.of(context).size.height * .9),
|
||||
maxWidth: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.width * .7, minHeight: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.height * .9),
|
||||
content: Padding(
|
||||
padding: const EdgeInsets.only(left: 12, right: 12, top: 12),
|
||||
child: SingleChildScrollView(
|
||||
@ -39,137 +45,129 @@ class LocalizationDialogUI extends HookConsumerWidget {
|
||||
AnimatedSize(
|
||||
duration: const Duration(milliseconds: 130),
|
||||
child: state.patchStatus?.key == true &&
|
||||
state.patchStatus?.value == S.current.home_action_info_game_built_in
|
||||
state.patchStatus?.value == S.current.home_action_info_game_built_in
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
child: InfoBar(
|
||||
title: Text(S.current.home_action_info_warning),
|
||||
content: Text(S.current.localization_info_machine_translation_warning),
|
||||
severity: InfoBarSeverity.info,
|
||||
style: InfoBarThemeData(decoration: (severity) {
|
||||
return const BoxDecoration(color: Color.fromRGBO(155, 7, 7, 1.0));
|
||||
}, iconColor: (severity) {
|
||||
return Colors.white;
|
||||
}),
|
||||
),
|
||||
)
|
||||
: SizedBox(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
),
|
||||
),
|
||||
if (!(model.getScInstallPath() ?? "").contains("LIVE"))
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
child: InfoBar(
|
||||
title: Text(S.current.home_localization_ptu_advanced_localization_tip_title),
|
||||
content: Text(S.current.home_localization_ptu_advanced_localization_tip_title_info),
|
||||
title: Text(S.current.home_action_info_warning),
|
||||
content: Text(S.current.localization_info_machine_translation_warning),
|
||||
severity: InfoBarSeverity.info,
|
||||
style: InfoBarThemeData(decoration: (severity) {
|
||||
return BoxDecoration(color: Colors.orange);
|
||||
return const BoxDecoration(color: Color.fromRGBO(155, 7, 7, 1.0));
|
||||
}, iconColor: (severity) {
|
||||
return Colors.white;
|
||||
}),
|
||||
),
|
||||
)
|
||||
: SizedBox(
|
||||
width: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.width,
|
||||
),
|
||||
),
|
||||
makeToolsListContainer(context, model, state),
|
||||
makeListContainer(
|
||||
S.current.localization_info_translation,
|
||||
[
|
||||
if (state.patchStatus == null)
|
||||
makeLoading(context)
|
||||
else ...[
|
||||
const SizedBox(height: 6),
|
||||
Row(
|
||||
children: [
|
||||
Center(
|
||||
child: Text(S.current.localization_info_enabled(
|
||||
LocalizationUIModel.languageSupport[state.selectedLanguage] ?? "")),
|
||||
),
|
||||
const Spacer(),
|
||||
ToggleSwitch(
|
||||
checked: state.patchStatus?.key == true,
|
||||
onChanged: model.updateLangCfg,
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Text(S.current.localization_info_installed_version(
|
||||
"${state.patchStatus?.value ?? ""} ${(state.isInstalledAdvanced ?? false) ? S.current.home_localization_msg_version_advanced : ""}")),
|
||||
SizedBox(width: 24),
|
||||
if (state.installedCommunityInputMethodSupportVersion != null)
|
||||
Text(
|
||||
S.current.input_method_community_input_method_support_version(
|
||||
state.installedCommunityInputMethodSupportVersion ?? "?"),
|
||||
)
|
||||
],
|
||||
else
|
||||
...[
|
||||
const SizedBox(height: 6),
|
||||
Row(
|
||||
children: [
|
||||
Center(
|
||||
child: Text(S.current.localization_info_enabled(
|
||||
LocalizationUIModel.languageSupport[state.selectedLanguage] ?? "")),
|
||||
),
|
||||
),
|
||||
if (state.patchStatus?.value != S.current.home_action_info_game_built_in)
|
||||
Row(
|
||||
children: [
|
||||
Button(
|
||||
onPressed: model.goFeedback,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(FluentIcons.feedback),
|
||||
const SizedBox(width: 6),
|
||||
Text(S.current.localization_action_translation_feedback),
|
||||
],
|
||||
),
|
||||
)),
|
||||
const SizedBox(width: 16),
|
||||
Button(
|
||||
onPressed: model.doDelIniFile(),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(FluentIcons.delete),
|
||||
const SizedBox(width: 6),
|
||||
Text(S.current.localization_action_uninstall_translation),
|
||||
],
|
||||
),
|
||||
)),
|
||||
],
|
||||
const Spacer(),
|
||||
ToggleSwitch(
|
||||
checked: state.patchStatus?.key == true,
|
||||
onChanged: model.updateLangCfg,
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Text(S.current.localization_info_installed_version(
|
||||
"${state.patchStatus?.value ?? ""} ${(state.isInstalledAdvanced ?? false) ? S
|
||||
.current.home_localization_msg_version_advanced : ""}")),
|
||||
SizedBox(width: 24),
|
||||
if (state.installedCommunityInputMethodSupportVersion != null)
|
||||
Text(
|
||||
S.current.input_method_community_input_method_support_version(
|
||||
state.installedCommunityInputMethodSupportVersion ?? "?"),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Container(
|
||||
color: Colors.white.withValues(alpha: .1),
|
||||
height: 1,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
if (state.apiLocalizationData == null)
|
||||
makeLoading(context)
|
||||
else if (state.apiLocalizationData!.isEmpty)
|
||||
Center(
|
||||
child: Text(
|
||||
S.current.localization_info_no_translation_available,
|
||||
style: TextStyle(fontSize: 13, color: Colors.white.withValues(alpha: .8)),
|
||||
),
|
||||
)
|
||||
else
|
||||
AlignedGridView.count(
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: 12,
|
||||
mainAxisSpacing: 12,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final item = state.apiLocalizationData!.entries.elementAt(index);
|
||||
return makeRemoteList(context, model, item, state, index);
|
||||
},
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: state.apiLocalizationData?.length ?? 0,
|
||||
)
|
||||
],
|
||||
if (state.patchStatus?.value != S.current.home_action_info_game_built_in)
|
||||
Row(
|
||||
children: [
|
||||
Button(
|
||||
onPressed: model.goFeedback,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(FluentIcons.feedback),
|
||||
const SizedBox(width: 6),
|
||||
Text(S.current.localization_action_translation_feedback),
|
||||
],
|
||||
),
|
||||
)),
|
||||
const SizedBox(width: 16),
|
||||
Button(
|
||||
onPressed: model.doDelIniFile(),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(FluentIcons.delete),
|
||||
const SizedBox(width: 6),
|
||||
Text(S.current.localization_action_uninstall_translation),
|
||||
],
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Container(
|
||||
color: Colors.white.withValues(alpha: .1),
|
||||
height: 1,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
if (state.apiLocalizationData == null)
|
||||
makeLoading(context)
|
||||
else
|
||||
if (state.apiLocalizationData!.isEmpty)
|
||||
Center(
|
||||
child: Text(
|
||||
S.current.localization_info_no_translation_available,
|
||||
style: TextStyle(fontSize: 13, color: Colors.white.withValues(alpha: .8)),
|
||||
),
|
||||
)
|
||||
else
|
||||
AlignedGridView.count(
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: 12,
|
||||
mainAxisSpacing: 12,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final item = state.apiLocalizationData!.entries.elementAt(index);
|
||||
return makeRemoteList(context, model, item, state, index);
|
||||
},
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: state.apiLocalizationData?.length ?? 0,
|
||||
)
|
||||
],
|
||||
],
|
||||
context),
|
||||
],
|
||||
@ -236,35 +234,36 @@ class LocalizationDialogUI extends HookConsumerWidget {
|
||||
padding: EdgeInsets.only(right: 12),
|
||||
child: ProgressRing(),
|
||||
)
|
||||
else ...[
|
||||
Icon(
|
||||
isInstalled
|
||||
? FluentIcons.check_mark
|
||||
: isItemEnabled
|
||||
? FluentIcons.download
|
||||
: FluentIcons.disable_updates,
|
||||
color: Colors.white.withValues(alpha: .8),
|
||||
size: 18,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
isInstalled
|
||||
? S.current.localization_info_installed
|
||||
: (isItemEnabled
|
||||
? S.current.localization_action_install
|
||||
: S.current.localization_info_unavailable),
|
||||
style: TextStyle(
|
||||
color: Colors.white.withValues(alpha: .8),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
if ((!isInstalled) && isItemEnabled)
|
||||
else
|
||||
...[
|
||||
Icon(
|
||||
FluentIcons.chevron_right,
|
||||
size: 14,
|
||||
color: Colors.white.withValues(alpha: .6),
|
||||
)
|
||||
]
|
||||
isInstalled
|
||||
? FluentIcons.check_mark
|
||||
: isItemEnabled
|
||||
? FluentIcons.download
|
||||
: FluentIcons.disable_updates,
|
||||
color: Colors.white.withValues(alpha: .8),
|
||||
size: 18,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
isInstalled
|
||||
? S.current.localization_info_installed
|
||||
: (isItemEnabled
|
||||
? S.current.localization_action_install
|
||||
: S.current.localization_info_unavailable),
|
||||
style: TextStyle(
|
||||
color: Colors.white.withValues(alpha: .8),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
if ((!isInstalled) && isItemEnabled)
|
||||
Icon(
|
||||
FluentIcons.chevron_right,
|
||||
size: 14,
|
||||
color: Colors.white.withValues(alpha: .6),
|
||||
)
|
||||
]
|
||||
],
|
||||
),
|
||||
if (item.value.note != null) ...[
|
||||
@ -294,7 +293,9 @@ class LocalizationDialogUI extends HookConsumerWidget {
|
||||
child: AnimatedSize(
|
||||
duration: const Duration(milliseconds: 130),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(color: FluentTheme.of(context).cardColor, borderRadius: BorderRadius.circular(7)),
|
||||
decoration: BoxDecoration(color: FluentTheme
|
||||
.of(context)
|
||||
.cardColor, borderRadius: BorderRadius.circular(7)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 12, bottom: 12, left: 24, right: 24),
|
||||
child: Column(
|
||||
@ -378,9 +379,9 @@ class LocalizationDialogUI extends HookConsumerWidget {
|
||||
onChanged: state.workingVersion.isNotEmpty
|
||||
? null
|
||||
: (v) {
|
||||
if (v == null) return;
|
||||
model.selectLang(v);
|
||||
},
|
||||
if (v == null) return;
|
||||
model.selectLang(v);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
@ -399,16 +400,16 @@ class LocalizationDialogUI extends HookConsumerWidget {
|
||||
Widget makeToolsListContainer(BuildContext context, LocalizationUIModel model, LocalizationUIState state) {
|
||||
final toolsMenu = {
|
||||
"launcher_mod": (
|
||||
const Icon(FluentIcons.c_plus_plus, size: 24),
|
||||
(S.current.home_localization_action_rsi_launcher_localization),
|
||||
const Icon(FluentIcons.c_plus_plus, size: 24),
|
||||
(S.current.home_localization_action_rsi_launcher_localization),
|
||||
),
|
||||
"advanced": (
|
||||
const Icon(FluentIcons.queue_advanced, size: 24),
|
||||
(S.current.home_localization_action_advanced),
|
||||
const Icon(FluentIcons.queue_advanced, size: 24),
|
||||
(S.current.home_localization_action_advanced),
|
||||
),
|
||||
"custom_files": (
|
||||
const Icon(FluentIcons.custom_activity, size: 24),
|
||||
(S.current.home_localization_action_install_customize),
|
||||
const Icon(FluentIcons.custom_activity, size: 24),
|
||||
(S.current.home_localization_action_install_customize),
|
||||
),
|
||||
};
|
||||
|
||||
@ -425,34 +426,36 @@ class LocalizationDialogUI extends HookConsumerWidget {
|
||||
child: GestureDetector(
|
||||
onTap: enableTap
|
||||
? () async {
|
||||
switch (item.key) {
|
||||
case "launcher_mod":
|
||||
ToolsUIModel.rsiEnhance(context);
|
||||
break;
|
||||
case "advanced":
|
||||
context.push("/index/advanced_localization");
|
||||
break;
|
||||
case "custom_files":
|
||||
final sb = await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) => const LocalizationFromFileDialogUI(),
|
||||
);
|
||||
if (sb is (StringBuffer, bool)) {
|
||||
if (!context.mounted) return;
|
||||
await model.installFormString(
|
||||
sb.$1,
|
||||
S.current.localization_info_custom_files,
|
||||
isEnableCommunityInputMethod: sb.$2,
|
||||
context: context,
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch (item.key) {
|
||||
case "launcher_mod":
|
||||
ToolsUIModel.rsiEnhance(context);
|
||||
break;
|
||||
case "advanced":
|
||||
context.push("/index/advanced_localization");
|
||||
break;
|
||||
case "custom_files":
|
||||
final sb = await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) => const LocalizationFromFileDialogUI(),
|
||||
);
|
||||
if (sb is (StringBuffer, bool)) {
|
||||
if (!context.mounted) return;
|
||||
await model.installFormString(
|
||||
sb.$1,
|
||||
S.current.localization_info_custom_files,
|
||||
isEnableCommunityInputMethod: sb.$2,
|
||||
context: context,
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
: null,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: FluentTheme.of(context).cardColor,
|
||||
color: FluentTheme
|
||||
.of(context)
|
||||
.cardColor,
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
padding: const EdgeInsets.all(12),
|
||||
|
@ -277,7 +277,7 @@ class LocalizationUIModel extends _$LocalizationUIModel {
|
||||
if ((context?.mounted ?? false) && isEnableVehicleSorting) {
|
||||
if (!context!.mounted) return;
|
||||
final iniStringDataVN = ValueNotifier(iniStringData);
|
||||
final ok = await showConfirmDialogs(context, "载具排序", VehicleSortingDialogUi(iniStringData: iniStringDataVN),constraints: BoxConstraints(
|
||||
final ok = await showConfirmDialogs(context, S.current.tools_vehicle_sorting_title, VehicleSortingDialogUi(iniStringData: iniStringDataVN),constraints: BoxConstraints(
|
||||
maxWidth: MediaQuery.of(context).size.width * .75,
|
||||
));
|
||||
if (ok) {
|
||||
@ -669,7 +669,7 @@ class LocalizationUIModel extends _$LocalizationUIModel {
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"载具排序",
|
||||
S.current.tools_vehicle_sorting_title,
|
||||
),
|
||||
Spacer(),
|
||||
StatefulBuilder(
|
||||
@ -717,4 +717,4 @@ class LocalizationUIModel extends _$LocalizationUIModel {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -41,9 +41,7 @@ class VehicleSortingDialogUi extends HookConsumerWidget {
|
||||
color: Colors.white.withValues(alpha: .03),
|
||||
borderRadius: BorderRadius.circular(4.0),
|
||||
),
|
||||
child: Text(
|
||||
"将左侧载具拖动到右侧列表中,这将会为载具名称增加 001、002 .. 等前缀,方便您在游戏内 UI 快速定位载具。在右侧列表上下拖动可以调整载具的顺序。",
|
||||
),
|
||||
child: Text(S.current.tools_vehicle_sorting_info),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Expanded(
|
||||
@ -60,10 +58,10 @@ class VehicleSortingDialogUi extends HookConsumerWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Padding(
|
||||
Padding(
|
||||
padding: EdgeInsets.all(4.0),
|
||||
child: Text(
|
||||
"载具",
|
||||
S.current.tools_vehicle_sorting_vehicle,
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
@ -74,7 +72,7 @@ class VehicleSortingDialogUi extends HookConsumerWidget {
|
||||
Expanded(
|
||||
child: TextFormBox(
|
||||
controller: leftSearchController,
|
||||
placeholder: "搜索载具",
|
||||
placeholder: S.current.tools_vehicle_sorting_search,
|
||||
onChanged: (value) {
|
||||
leftSearchKey.value = value;
|
||||
},
|
||||
@ -140,10 +138,10 @@ class VehicleSortingDialogUi extends HookConsumerWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Padding(
|
||||
Padding(
|
||||
padding: EdgeInsets.all(4.0),
|
||||
child: Text(
|
||||
"已排序载具",
|
||||
S.current.tools_vehicle_sorting_sorted,
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
@ -314,6 +312,8 @@ class VehicleSortingDialogUi extends HookConsumerWidget {
|
||||
if (parts.length == 2) {
|
||||
final key = parts[0].trim();
|
||||
final value = parts[1].trim();
|
||||
// 过滤掉短名称
|
||||
if (key.toLowerCase().endsWith("_short") || key.toLowerCase().endsWith("_short,p")) continue;
|
||||
vehicleMap[key] = value;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user