chore: fix jerking animation in word card

This commit is contained in:
ggurdin 2025-07-03 15:45:36 -04:00
parent ca71286e40
commit 491c13b28f
No known key found for this signature in database
GPG key ID: A01CB41737CBB478
2 changed files with 15 additions and 17 deletions

View file

@ -571,8 +571,8 @@ class MessageOverlayController extends State<MessageSelectionOverlay>
updateSelectedSpan(token.text);
Future.delayed(const Duration(milliseconds: 1700), () {
if (isNewToken(token)) {
if (isNewToken(token)) {
Future.delayed(const Duration(milliseconds: 1700), () {
MatrixState.pangeaController.putAnalytics.setState(
AnalyticsStream(
eventId: event.eventId,
@ -595,19 +595,19 @@ class MessageOverlayController extends State<MessageSelectionOverlay>
targetID: token.text.uniqueKey,
),
);
// Remove the token (and all tokens of same lemma but different form) from newTokens
setState(() {
newTokens.removeWhere(
(t) =>
t.text.offset == token.text.offset &&
t.text.length == token.text.length,
);
newTokens.removeWhere(
(t) => t.lemma.text.equals(token.lemma.text),
);
});
}
});
if (mounted) {
setState(() {
newTokens.removeWhere(
(t) =>
t.text.offset == token.text.offset &&
t.text.length == token.text.length &&
t.lemma.text.equals(token.lemma.text),
);
});
}
});
}
}
PracticeTarget? practiceTargetForToken(PangeaToken token) {

View file

@ -156,5 +156,3 @@ class _NewWordOverlayState extends State<NewWordOverlay>
);
}
}
const kAlwaysCompleteAnimation = AlwaysStoppedAnimation<double>(1.0);