From 12e947ef849490fca3204857dccb7b4b8382352d Mon Sep 17 00:00:00 2001 From: guozhigq Date: Tue, 5 Mar 2024 23:21:51 +0800 Subject: [PATCH] fix: reply callback null error issues #615 --- lib/pages/video/detail/reply/widgets/reply_item.dart | 6 +++--- lib/pages/video/detail/reply_reply/view.dart | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/pages/video/detail/reply/widgets/reply_item.dart b/lib/pages/video/detail/reply/widgets/reply_item.dart index c55380f2f..174cfabb9 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item.dart @@ -280,7 +280,7 @@ class ReplyItem extends StatelessWidget { // 完成评论,数据添加 if (value != null && value['data'] != null) { - addReply!(value['data']) + addReply?.call(value['data']) // replyControl.replies.add(value['data']), } }); @@ -531,8 +531,8 @@ InlineSpan buildContent( spanChilds.add(TextSpan( text: str, recognizer: TapGestureRecognizer() - ..onTap = - () => replyReply(replyItem.root == 0 ? replyItem : fReplyItem))); + ..onTap = () => + replyReply?.call(replyItem.root == 0 ? replyItem : fReplyItem))); } // 分割文本并处理每个部分 diff --git a/lib/pages/video/detail/reply_reply/view.dart b/lib/pages/video/detail/reply_reply/view.dart index c08c81cce..820a69ecb 100644 --- a/lib/pages/video/detail/reply_reply/view.dart +++ b/lib/pages/video/detail/reply_reply/view.dart @@ -92,7 +92,7 @@ class _VideoReplyReplyPanelState extends State { icon: const Icon(Icons.close, size: 20), onPressed: () { _videoReplyReplyController.currentPage = 0; - widget.closePanel!(); + widget.closePanel?.call; Navigator.pop(context); }, ), @@ -184,6 +184,8 @@ class _VideoReplyReplyPanelState extends State { .add(replyItem); }, replyType: widget.replyType, + replyReply: (replyItem) => + replyReply(replyItem), ); } },