fix:修复进入语音包设置时不进行更新选中的问题
This commit is contained in:
parent
02d395b7a4
commit
b06e3b61c8
@ -45,10 +45,9 @@ class SpeechLanguageSettingsLogic extends BaseGetXController {
|
|||||||
} else if (reply is VoicePackageConfigureProcessReply) {
|
} else if (reply is VoicePackageConfigureProcessReply) {
|
||||||
_handlerVoicePackageConfigureProcess(reply);
|
_handlerVoicePackageConfigureProcess(reply);
|
||||||
} else if (reply is VoicePackageConfigureConfirmationReply) {
|
} else if (reply is VoicePackageConfigureConfirmationReply) {
|
||||||
_handlerVoicePackageConfigureConfirmation(reply);
|
handleVoiceConfigureThrottled(reply);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
await initList();
|
await initList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,14 +109,22 @@ class SpeechLanguageSettingsLogic extends BaseGetXController {
|
|||||||
.lockSetInfoData.value.lockSettingInfo?.currentVoiceTimbre?.lang;
|
.lockSetInfoData.value.lockSettingInfo?.currentVoiceTimbre?.lang;
|
||||||
final timbre = state
|
final timbre = state
|
||||||
.lockSetInfoData.value.lockSettingInfo?.currentVoiceTimbre?.timbre;
|
.lockSetInfoData.value.lockSettingInfo?.currentVoiceTimbre?.timbre;
|
||||||
state.languages.value.forEach((element) {
|
// 传统 for 循环,直接通过索引访问
|
||||||
final timbres = element.timbres;
|
for (int i = 0; i < state.languages.length; i++) {
|
||||||
timbres.forEach((item) {
|
final language = state.languages[i]; // 当前元素
|
||||||
if (lang == element.lang && item.timbre == timbre) {
|
if (language.lang == lang) {
|
||||||
state.selectSoundTypeIndex.value = item.isFemale;
|
print('匹配到下标:$i,元素:$language');
|
||||||
|
final timbres = language.timbres;
|
||||||
|
for (int j = 0; j < timbres.length; j++) {
|
||||||
|
final item = timbres[j];
|
||||||
|
if (lang == language.lang && item.timbre == timbre) {
|
||||||
|
state.selectSoundTypeIndex.value = item.isFemale;
|
||||||
|
state.selectPassthroughListIndex.value = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint('获取语音包出现错误:$e');
|
debugPrint('获取语音包出现错误:$e');
|
||||||
@ -358,7 +365,31 @@ class SpeechLanguageSettingsLogic extends BaseGetXController {
|
|||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _handlerVoicePackageConfigureConfirmation(
|
bool _isThrottled = false;
|
||||||
|
|
||||||
|
void handleVoiceConfigureThrottled(
|
||||||
|
VoicePackageConfigureConfirmationReply reply,
|
||||||
|
) {
|
||||||
|
if (_isThrottled) return;
|
||||||
|
|
||||||
|
_isThrottled = true;
|
||||||
|
|
||||||
|
// 执行你的逻辑
|
||||||
|
_executeLogic(reply);
|
||||||
|
|
||||||
|
// 设置节流时间(比如 1 秒)
|
||||||
|
Future.delayed(Duration(seconds: 1), () {
|
||||||
|
_isThrottled = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _executeLogic(
|
||||||
|
VoicePackageConfigureConfirmationReply reply) async {
|
||||||
|
await _handlerVoicePackageConfigureConfirmation(reply);
|
||||||
|
dismissEasyLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
_handlerVoicePackageConfigureConfirmation(
|
||||||
VoicePackageConfigureConfirmationReply reply,
|
VoicePackageConfigureConfirmationReply reply,
|
||||||
) async {
|
) async {
|
||||||
final int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user