From 1b8b3947be2b6dde4b5ea04f1ef1809f96605c40 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sun, 28 Apr 2024 07:39:55 +0800 Subject: [PATCH] =?UTF-8?q?revert:=20=E8=AF=84=E8=AE=BA=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E4=BC=98=E5=85=88=E5=B1=95=E7=A4=BA=E4=BA=8C=E7=BA=A7=E8=AF=84?= =?UTF-8?q?=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/dynamics/detail/view.dart | 6 +++--- lib/pages/video/detail/controller.dart | 1 - lib/pages/video/detail/reply/view.dart | 6 +++--- .../video/detail/reply/widgets/reply_item.dart | 6 ++---- lib/pages/video/detail/reply_reply/controller.dart | 10 +--------- lib/pages/video/detail/reply_reply/view.dart | 14 ++------------ 6 files changed, 11 insertions(+), 32 deletions(-) diff --git a/lib/pages/dynamics/detail/view.dart b/lib/pages/dynamics/detail/view.dart index 11636b5b..bd07921b 100644 --- a/lib/pages/dynamics/detail/view.dart +++ b/lib/pages/dynamics/detail/view.dart @@ -106,7 +106,7 @@ class _DynamicDetailPageState extends State } // 查看二级评论 - void replyReply(replyItem, currentReply) { + void replyReply(replyItem) { int oid = replyItem.oid; int rpid = replyItem.rpid!; Get.to( @@ -324,8 +324,8 @@ class _DynamicDetailPageState extends State replyItem: replyList[index], showReplyRow: true, replyLevel: '1', - replyReply: (replyItem, currentReply) => - replyReply(replyItem, currentReply), + replyReply: (replyItem) => + replyReply(replyItem), replyType: ReplyType.values[replyType], addReply: (replyItem) { replyList[index] diff --git a/lib/pages/video/detail/controller.dart b/lib/pages/video/detail/controller.dart index c28d0434..e930c9ae 100644 --- a/lib/pages/video/detail/controller.dart +++ b/lib/pages/video/detail/controller.dart @@ -174,7 +174,6 @@ class VideoDetailController extends GetxController replyType: ReplyType.video, source: 'videoDetail', sheetHeight: sheetHeight.value, - currentReply: currentReply, ); }); replyReplyBottomSheetCtr?.closed.then((value) { diff --git a/lib/pages/video/detail/reply/view.dart b/lib/pages/video/detail/reply/view.dart index 32b0aef1..be1bd331 100644 --- a/lib/pages/video/detail/reply/view.dart +++ b/lib/pages/video/detail/reply/view.dart @@ -112,7 +112,7 @@ class _VideoReplyPanelState extends State } // 展示二级回复 - void replyReply(replyItem, currentReply) { + void replyReply(replyItem) { final VideoDetailController videoDetailCtr = Get.find(tag: heroTag); if (replyItem != null) { @@ -232,8 +232,8 @@ class _VideoReplyPanelState extends State .replyList[index], showReplyRow: true, replyLevel: replyLevel, - replyReply: (replyItem, currentReply) => - replyReply(replyItem, currentReply), + replyReply: (replyItem) => + replyReply(replyItem), replyType: ReplyType.video, ); } diff --git a/lib/pages/video/detail/reply/widgets/reply_item.dart b/lib/pages/video/detail/reply/widgets/reply_item.dart index 47833f81..b84c2fbd 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item.dart @@ -533,10 +533,8 @@ InlineSpan buildContent( TextSpan( text: str, recognizer: TapGestureRecognizer() - ..onTap = () => replyReply?.call( - replyItem.root == 0 ? replyItem : fReplyItem, - replyItem, - ), + ..onTap = () => + replyReply?.call(replyItem.root == 0 ? replyItem : fReplyItem), ), ); } diff --git a/lib/pages/video/detail/reply_reply/controller.dart b/lib/pages/video/detail/reply_reply/controller.dart index 4c553e29..e94aaea5 100644 --- a/lib/pages/video/detail/reply_reply/controller.dart +++ b/lib/pages/video/detail/reply_reply/controller.dart @@ -26,7 +26,7 @@ class VideoReplyReplyController extends GetxController { currentPage = 0; } - Future queryReplyList({type = 'init', currentReply}) async { + Future queryReplyList({type = 'init'}) async { if (type == 'init') { currentPage = 0; } @@ -63,14 +63,6 @@ class VideoReplyReplyController extends GetxController { // res['data'].replies.addAll(replyList); } } - if (replyList.isNotEmpty && currentReply != null) { - int indexToRemove = - replyList.indexWhere((item) => currentReply.rpid == item.rpid); - // 如果找到了指定ID的项,则移除 - if (indexToRemove != -1) { - replyList.removeAt(indexToRemove); - } - } isLoadingMore = false; return res; } diff --git a/lib/pages/video/detail/reply_reply/view.dart b/lib/pages/video/detail/reply_reply/view.dart index 18842507..6dda9512 100644 --- a/lib/pages/video/detail/reply_reply/view.dart +++ b/lib/pages/video/detail/reply_reply/view.dart @@ -20,7 +20,6 @@ class VideoReplyReplyPanel extends StatefulWidget { this.source, this.replyType, this.sheetHeight, - this.currentReply, super.key, }); final int? oid; @@ -30,7 +29,6 @@ class VideoReplyReplyPanel extends StatefulWidget { final String? source; final ReplyType? replyType; final double? sheetHeight; - final dynamic currentReply; @override State createState() => _VideoReplyReplyPanelState(); @@ -65,9 +63,7 @@ class _VideoReplyReplyPanelState extends State { }, ); - _futureBuilderFuture = _videoReplyReplyController.queryReplyList( - currentReply: widget.currentReply, - ); + _futureBuilderFuture = _videoReplyReplyController.queryReplyList(); } void replyReply(replyItem) {} @@ -111,9 +107,7 @@ class _VideoReplyReplyPanelState extends State { onRefresh: () async { setState(() {}); _videoReplyReplyController.currentPage = 0; - return await _videoReplyReplyController.queryReplyList( - currentReply: widget.currentReply, - ); + return await _videoReplyReplyController.queryReplyList(); }, child: CustomScrollView( controller: _videoReplyReplyController.scrollController, @@ -146,10 +140,6 @@ class _VideoReplyReplyPanelState extends State { if (snapshot.connectionState == ConnectionState.done) { Map? data = snapshot.data; if (data != null && data['status']) { - if (widget.currentReply != null) { - _videoReplyReplyController.replyList - .insert(0, widget.currentReply); - } // 请求成功 return Obx( () => SliverList(