add XP animation on match activity tokens (#4373)

This commit is contained in:
avashilling 2025-10-14 14:18:04 -04:00 committed by GitHub
parent 2586ae5442
commit cd2f43c00c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 37 additions and 27 deletions

View file

@ -23,6 +23,7 @@ import 'package:fluffychat/pangea/toolbar/widgets/select_mode_buttons.dart';
import 'package:fluffychat/utils/event_checkbox_extension.dart';
import 'package:fluffychat/widgets/avatar.dart';
import 'package:fluffychat/widgets/future_loading_dialog.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:fluffychat/widgets/mxc_image.dart';
import '../../../utils/url_launcher.dart';
@ -468,35 +469,44 @@ class HtmlMessage extends StatelessWidget {
animateIn: isTransitionAnimation,
textColor: textColor,
),
MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: onClick != null && token != null
? () => onClick?.call(token)
: null,
child: RichText(
textDirection: pangeaMessageEvent?.textDirection,
text: TextSpan(
children: [
LinkifySpan(
text: node.text.trim(),
style: renderer.style(
context,
color: renderer.backgroundColor(
CompositedTransformTarget(
link: token != null
? MatrixState.pAnyState
.layerLinkAndKey(
"message-token-${token.text.uniqueKey}-${event.eventId}",
)
.link
: LayerLink(),
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: onClick != null && token != null
? () => onClick?.call(token)
: null,
child: RichText(
textDirection: pangeaMessageEvent?.textDirection,
text: TextSpan(
children: [
LinkifySpan(
text: node.text.trim(),
style: renderer.style(
context,
selected,
highlighted,
isNew,
readingAssistanceMode ==
ReadingAssistanceMode.practiceMode,
color: renderer.backgroundColor(
context,
selected,
highlighted,
isNew,
readingAssistanceMode ==
ReadingAssistanceMode.practiceMode,
),
),
linkStyle: linkStyle,
onOpen: (url) =>
UrlLauncher(context, url.url).launchUrl(),
),
linkStyle: linkStyle,
onOpen: (url) =>
UrlLauncher(context, url.url).launchUrl(),
),
],
],
),
),
),
),

View file

@ -205,7 +205,7 @@ class PracticeActivityModel {
xp: constructUseType.pointValue,
),
],
targetID: token.text.uniqueKey,
targetID: "message-token-${token.text.uniqueKey}-${event?.eventId}",
),
);
}