fix: reset voice on langauge update (#5140)

This commit is contained in:
ggurdin 2026-01-09 09:40:45 -05:00 committed by GitHub
parent 2784c9b913
commit 067f30cdab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 5 deletions

View file

@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pangea/activity_sessions/activity_room_extension.dart';
import 'package:fluffychat/pangea/bot/utils/bot_room_extension.dart';
@ -150,19 +149,18 @@ class BotChatSettingsDialogState extends State<BotChatSettingsDialog> {
customButton: _selectedVoice != null
? CustomDropdownTextButton(text: _selectedVoice!)
: null,
menuItemStyleData: MenuItemStyleData(
padding: const EdgeInsets.symmetric(
menuItemStyleData: const MenuItemStyleData(
padding: EdgeInsets.symmetric(
vertical: 8.0,
horizontal: 16.0,
),
height: FluffyThemes.isColumnMode(context) ? 100.0 : 150.0,
),
decoration: InputDecoration(
labelText: L10n.of(context).voice,
),
isExpanded: true,
dropdownStyleData: DropdownStyleData(
maxHeight: kIsWeb ? 500 : null,
maxHeight: kIsWeb ? 250 : null,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(14.0),

View file

@ -59,6 +59,11 @@ extension BotClientExtension on Client {
return;
}
if (targetLanguage != null &&
updateBotOptions.targetLanguage != targetLanguage) {
updateBotOptions.targetVoice = null;
}
updateBotOptions.targetLanguage = targetLanguage;
updateBotOptions.languageLevel = cefrLevel;
await botDM!.setBotOptions(updateBotOptions);