chore: when choices array goes off screen, stop playing TTS (#1945)
This commit is contained in:
parent
2140bbf0bb
commit
907ad15f79
4 changed files with 13 additions and 2 deletions
|
|
@ -338,6 +338,7 @@ class Choreographer {
|
|||
_textController.selection =
|
||||
TextSelection.collapsed(offset: _textController.text.length);
|
||||
giveInputFocus();
|
||||
tts.stop();
|
||||
}
|
||||
|
||||
Future<void> onReplacementSelect({
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import 'package:fluffychat/pangea/choreographer/utils/match_copy.dart';
|
|||
import 'package:fluffychat/pangea/choreographer/widgets/igc/card_error_widget.dart';
|
||||
import 'package:fluffychat/pangea/common/utils/error_handler.dart';
|
||||
import 'package:fluffychat/pangea/events/models/pangea_token_model.dart';
|
||||
import 'package:fluffychat/pangea/toolbar/controllers/tts_controller.dart';
|
||||
import '../../../../widgets/matrix.dart';
|
||||
import '../../../bot/widgets/bot_face_svg.dart';
|
||||
import '../../../common/controllers/pangea_controller.dart';
|
||||
|
|
@ -63,6 +64,14 @@ class SpanCardState extends State<SpanCard> {
|
|||
fetchSelected();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
tts.stop();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
TtsController get tts => widget.scm.choreographer.tts;
|
||||
|
||||
//get selected choice
|
||||
SpanChoice? get selectedChoice {
|
||||
if (selectedChoiceIndex == null) return null;
|
||||
|
|
@ -308,7 +317,7 @@ class WordMatchContent extends StatelessWidget {
|
|||
uniqueKeyForLayerLink: (int index) =>
|
||||
"wordMatch$index",
|
||||
selectedChoiceIndex: controller.selectedChoiceIndex,
|
||||
tts: controller.widget.scm.choreographer.tts,
|
||||
tts: controller.tts,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
PromptAndFeedback(controller: controller),
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class AlternativeTranslations extends StatelessWidget {
|
|||
},
|
||||
uniqueKeyForLayerLink: (int index) => "altTranslation$index",
|
||||
selectedChoiceIndex: null,
|
||||
tts: controller.choreographer.tts,
|
||||
tts: null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -275,6 +275,7 @@ class PracticeActivityCardState extends State<PracticeActivityCard> {
|
|||
// wait for savor the joy before popping from the activity queue
|
||||
// to keep the completed activity on screen for a moment
|
||||
widget.overlayController.onActivityFinish(currentActivity!.activityType);
|
||||
widget.overlayController.widget.chatController.choreographer.tts.stop();
|
||||
} catch (e, s) {
|
||||
_onError();
|
||||
debugger(when: kDebugMode);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue