fix:增加第三方协议的选项、增加多语言选项的英文名显示
This commit is contained in:
parent
1a6b44ece9
commit
477f4f21be
@ -93,7 +93,7 @@ class SpeechLanguageSettingsLogic extends BaseGetXController {
|
||||
final passthroughItem = PassthroughItem(
|
||||
lang: element.lang,
|
||||
timbres: element.timbres,
|
||||
langText: '简体中文'.tr + '(中国台湾)'.tr,
|
||||
langText: '简体中文'.tr + '(中国台湾)'.tr+'(Simplified Chinese TW)',
|
||||
name: element.name,
|
||||
);
|
||||
state.languages.add(passthroughItem);
|
||||
|
||||
@ -107,6 +107,7 @@ class _SpeechLanguageSettingsPageState
|
||||
isHaveLine: true,
|
||||
isHaveDirection: false,
|
||||
isHaveRightWidget: true,
|
||||
leftTitleMaxWidth: 0.9.sw, // 设置左侧标题最大宽度
|
||||
rightWidget:
|
||||
state.selectPassthroughListIndex.value == index
|
||||
? Image(
|
||||
@ -131,66 +132,6 @@ class _SpeechLanguageSettingsPageState
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBody() {
|
||||
return Obx(
|
||||
() => SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
ListView.builder(
|
||||
itemCount: state.soundTypeList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
// 判断是否是最后一个元素(索引等于 itemCount - 1)
|
||||
final isLastItem = index == state.soundTypeList.length - 1;
|
||||
|
||||
// 获取当前平台数据(假设 platFormSet 是 RxList<Platform>)
|
||||
final platform = state.soundTypeList.value[index];
|
||||
return CommonItem(
|
||||
leftTitel: state.soundTypeList.value[index],
|
||||
rightTitle: '',
|
||||
isHaveLine: !isLastItem,
|
||||
// 最后一个元素不显示分割线(取反)
|
||||
isHaveDirection: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: Radio<String>(
|
||||
// Radio 的值:使用平台的唯一标识(如 id)
|
||||
value: platform,
|
||||
// 当前选中的值:与 selectPlatFormIndex 关联的 id
|
||||
groupValue: state.soundTypeList
|
||||
.value[state.selectSoundTypeIndex.value],
|
||||
// 选中颜色(可选,默认主题色)
|
||||
activeColor: AppColors.mainColor,
|
||||
// 点击 Radio 时回调(更新选中索引)
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
setState(() {
|
||||
// 找到当前选中平台的索引(根据 id 匹配)
|
||||
final newIndex = state.soundTypeList.value
|
||||
.indexWhere((p) => p == value);
|
||||
if (newIndex != -1) {
|
||||
state.selectSoundTypeIndex.value = newIndex;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
action: () {
|
||||
setState(() {
|
||||
state.selectSoundTypeIndex.value = index;
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics() //add this line,
|
||||
),
|
||||
Column(
|
||||
children: _buildList(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> _buildList() {
|
||||
final appLocalLanguages = state.languages;
|
||||
|
||||
@ -16,6 +16,7 @@ class ThirdPartyPlatformState {
|
||||
final RxList<String> platFormSet = List.of({
|
||||
'锁通通'.tr,
|
||||
'涂鸦智能'.tr,
|
||||
'Matter'.tr ,
|
||||
}).obs;
|
||||
|
||||
RxInt selectPlatFormIndex = 0.obs;
|
||||
|
||||
@ -250,11 +250,10 @@ class LockVoiceSettingLogic extends BaseGetXController {
|
||||
if (lang == 'zh_TW') {
|
||||
// 如果是台湾的话应该显示未简体中文
|
||||
List<String> parts = lang.split('_');
|
||||
final indexOf = locales.indexOf(Locale(parts[0], parts[1]));
|
||||
final passthroughItem = PassthroughItem(
|
||||
lang: element.lang,
|
||||
timbres: element.timbres,
|
||||
langText: '简体中文'.tr + '(中国台湾)'.tr,
|
||||
langText: '简体中文'.tr + '(中国台湾)'.tr + '(Simplified Chinese TW)',
|
||||
name: element.name,
|
||||
);
|
||||
state.languages.add(passthroughItem);
|
||||
@ -268,6 +267,7 @@ class LockVoiceSettingLogic extends BaseGetXController {
|
||||
ExtensionLanguageType.fromLocale(locales[indexOf]).lanTitle,
|
||||
name: element.name,
|
||||
);
|
||||
|
||||
state.languages.add(passthroughItem);
|
||||
}
|
||||
});
|
||||
|
||||
@ -139,6 +139,7 @@ class _LockVoiceSettingState extends State<LockVoiceSetting> {
|
||||
isHaveLine: true,
|
||||
isHaveDirection: false,
|
||||
isHaveRightWidget: true,
|
||||
leftTitleMaxWidth: 0.9.sw,
|
||||
rightWidget:
|
||||
state.selectPassthroughListIndex.value == index
|
||||
? Image(
|
||||
|
||||
@ -104,6 +104,7 @@ class _MineMultiLanguagePageState extends State<MineMultiLanguagePage> {
|
||||
isHaveLine: true,
|
||||
isHaveDirection: false,
|
||||
isHaveRightWidget: true,
|
||||
leftTitleMaxWidth: 0.9.sw, // 设置左侧标题最大宽度
|
||||
rightWidget: state.currentLanguageType.value == lanType
|
||||
? Image(
|
||||
image: const AssetImage('images/icon_item_checked.png'),
|
||||
|
||||
@ -212,10 +212,10 @@ extension ExtensionLanguageType on LanguageType {
|
||||
str = '简体中文'.tr + '(Simplified Chinese)';
|
||||
break;
|
||||
case LanguageType.traditionalChineseTW:
|
||||
str = '繁体中文(中国台湾)'.tr + '(Traditional Chinese, Taiwan)';
|
||||
str = '繁体中文(中国台湾)'.tr + '(Traditional Chinese TW)';
|
||||
break;
|
||||
case LanguageType.traditionalChineseHK:
|
||||
str = '繁体中文(中国香港)'.tr + '(Traditional Chinese, Hong Kong)';
|
||||
str = '繁体中文(中国香港)'.tr + '(Traditional Chinese HK)';
|
||||
break;
|
||||
case LanguageType.french:
|
||||
str = '法语'.tr + '(French)';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user