fix: 动态评论区seek error

This commit is contained in:
guozhigq
2024-02-28 23:29:02 +08:00
parent 466214b26a
commit 0b5397ec00

View File

@ -462,6 +462,9 @@ class ReplyItemRow extends StatelessWidget {
InlineSpan buildContent( InlineSpan buildContent(
BuildContext context, replyItem, replyReply, fReplyItem) { BuildContext context, replyItem, replyReply, fReplyItem) {
final String routePath = Get.currentRoute;
bool isVideoPage = routePath.startsWith('/video/detail');
// replyItem 当前回复内容 // replyItem 当前回复内容
// replyReply 查看二楼回复(回复详情)回调 // replyReply 查看二楼回复(回复详情)回调
// fReplyItem 父级回复内容,用作二楼回复(回复详情)展示 // fReplyItem 父级回复内容,用作二楼回复(回复详情)展示
@ -571,15 +574,19 @@ InlineSpan buildContent(
spanChilds.add( spanChilds.add(
TextSpan( TextSpan(
text: ' $matchStr ', text: ' $matchStr ',
style: TextStyle( style: isVideoPage
? TextStyle(
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
), )
: null,
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () { ..onTap = () {
// 跳转到指定位置 // 跳转到指定位置
if (isVideoPage) {
try { try {
SmartDialog.showToast('跳转至:$matchStr'); SmartDialog.showToast('跳转至:$matchStr');
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']) Get.find<VideoDetailController>(
tag: Get.arguments['heroTag'])
.plPlayerController .plPlayerController
.seekTo( .seekTo(
Duration(seconds: Utils.duration(matchStr)), Duration(seconds: Utils.duration(matchStr)),
@ -587,6 +594,7 @@ InlineSpan buildContent(
} catch (e) { } catch (e) {
SmartDialog.showToast('跳转失败: $e'); SmartDialog.showToast('跳转失败: $e');
} }
}
}, },
), ),
); );