Fix audio translate bug

This commit is contained in:
Fransolet Thomas 2023-01-12 17:45:59 +01:00
parent 4dbbd2a335
commit 8e8be6726b

View File

@ -56,19 +56,14 @@ class MultiStringContainer extends StatelessWidget {
if(initialValue.isNotEmpty) {
languages.forEach((value) {
if(initialValue.contains(value)) {
if(initialValue.map((iv) => iv.language).contains(value)) {
newValues.add(TranslationDTO.fromJson(jsonDecode(jsonEncode(initialValue.firstWhere((element) => element.language == value)))));
} else {
// New language
newValues.add(TranslationDTO(language: value));
newValues.add(TranslationDTO(language: value, value: null));
}
});
// Make a copy
initialValue.forEach((value) {
newValues.add(TranslationDTO.fromJson(jsonDecode(jsonEncode(value))));
});
showMultiStringInput(label, modalLabel, isTitle, initialValue, newValues, onGetResult, maxLines, isAudio, context);
}
},