diff --git a/lib/pages/dynamics/detail/view.dart b/lib/pages/dynamics/detail/view.dart index 43880240c..f1ea825ec 100644 --- a/lib/pages/dynamics/detail/view.dart +++ b/lib/pages/dynamics/detail/view.dart @@ -3,6 +3,7 @@ import 'dart:math'; import 'package:PiliPlus/common/widgets/custom_sliver_persistent_header_delegate.dart'; import 'package:PiliPlus/common/widgets/refresh_indicator.dart'; +import 'package:PiliPlus/grpc/app/main/community/reply/v1/reply.pb.dart'; import 'package:PiliPlus/http/constants.dart'; import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/models/common/reply_sort_type.dart'; @@ -164,7 +165,7 @@ class _DynamicDetailPageState extends State } // 查看二级评论 - void replyReply(context, replyItem, id) { + void replyReply(BuildContext context, ReplyInfo replyItem, int? id) { EasyThrottle.throttle('replyReply', const Duration(milliseconds: 500), () { int oid = replyItem.oid.toInt(); int rpid = replyItem.id.toInt(); @@ -811,11 +812,9 @@ class _DynamicDetailPageState extends State } else { return ReplyItemGrpc( replyItem: loadingState.response.replies[index], - showReplyRow: true, replyLevel: '1', replyReply: (replyItem, id) => replyReply(context, replyItem, id), - replyType: ReplyType.values[replyType], onReply: () { _dynamicDetailController.onReply( context, diff --git a/lib/pages/html/view.dart b/lib/pages/html/view.dart index afdd171cf..3cbbe9d98 100644 --- a/lib/pages/html/view.dart +++ b/lib/pages/html/view.dart @@ -3,6 +3,7 @@ import 'dart:math'; import 'package:PiliPlus/common/widgets/article_content.dart'; import 'package:PiliPlus/common/widgets/http_error.dart'; import 'package:PiliPlus/common/widgets/refresh_indicator.dart'; +import 'package:PiliPlus/grpc/app/main/community/reply/v1/reply.pb.dart'; import 'package:PiliPlus/http/constants.dart'; import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/models/common/reply_sort_type.dart'; @@ -161,7 +162,7 @@ class _HtmlRenderPageState extends State } } - void replyReply(context, replyItem, id) { + void replyReply(BuildContext context, ReplyInfo replyItem, int? id) { EasyThrottle.throttle('replyReply', const Duration(milliseconds: 500), () { int oid = replyItem.oid.toInt(); int rpid = replyItem.id.toInt(); @@ -784,11 +785,9 @@ class _HtmlRenderPageState extends State } else { return ReplyItemGrpc( replyItem: loadingState.response.replies[index], - showReplyRow: true, replyLevel: '1', replyReply: (replyItem, id) => replyReply(context, replyItem, id), - replyType: ReplyType.values[type], onReply: () { _htmlRenderCtr.onReply( context, diff --git a/lib/pages/video/detail/reply/view.dart b/lib/pages/video/detail/reply/view.dart index 127bb3337..1587129e5 100644 --- a/lib/pages/video/detail/reply/view.dart +++ b/lib/pages/video/detail/reply/view.dart @@ -1,6 +1,7 @@ import 'package:PiliPlus/common/widgets/custom_sliver_persistent_header_delegate.dart'; import 'package:PiliPlus/common/widgets/refresh_indicator.dart'; import 'package:PiliPlus/common/widgets/http_error.dart'; +import 'package:PiliPlus/grpc/app/main/community/reply/v1/reply.pb.dart'; import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/models/common/reply_sort_type.dart'; import 'package:PiliPlus/pages/video/detail/reply/widgets/reply_item_grpc.dart'; @@ -17,9 +18,9 @@ class VideoReplyPanel extends StatefulWidget { final String? bvid; final int oid; final int rpid; - final String? replyLevel; + final String replyLevel; final String heroTag; - final Function replyReply; + final Function(ReplyInfo replyItem, int? rpid) replyReply; final VoidCallback? onViewImage; final ValueChanged? onDismissed; final Function(List, int)? callback; @@ -30,7 +31,7 @@ class VideoReplyPanel extends StatefulWidget { this.bvid, required this.oid, this.rpid = 0, - this.replyLevel, + this.replyLevel = '1', required this.heroTag, required this.replyReply, this.onViewImage, @@ -47,7 +48,6 @@ class _VideoReplyPanelState extends State with AutomaticKeepAliveClientMixin, TickerProviderStateMixin { late VideoReplyController _videoReplyController; - String replyLevel = '1'; late String heroTag; // 添加页面缓存 @@ -60,7 +60,6 @@ class _VideoReplyPanelState extends State // int oid = widget.bvid != null ? IdUtils.bv2av(widget.bvid!) : 0; // heroTag = Get.arguments['heroTag']; heroTag = widget.heroTag; - replyLevel = widget.replyLevel ?? '1'; _videoReplyController = Get.find(tag: heroTag); if (widget.needController != false) { @@ -236,10 +235,8 @@ class _VideoReplyPanelState extends State } else { return ReplyItemGrpc( replyItem: loadingState.response.replies[index], - showReplyRow: true, - replyLevel: replyLevel, + replyLevel: widget.replyLevel, replyReply: widget.replyReply, - replyType: ReplyType.video, onReply: () { _videoReplyController.onReply( context, diff --git a/lib/pages/video/detail/reply/widgets/reply_item_grpc.dart b/lib/pages/video/detail/reply/widgets/reply_item_grpc.dart index 75991429d..8f82e90af 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item_grpc.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item_grpc.dart @@ -19,7 +19,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; import 'package:PiliPlus/common/widgets/network_img_layer.dart'; -import 'package:PiliPlus/models/common/reply_type.dart'; import 'package:PiliPlus/pages/video/detail/index.dart'; import 'package:PiliPlus/utils/feed_back.dart'; import 'package:PiliPlus/utils/storage.dart'; @@ -31,10 +30,8 @@ class ReplyItemGrpc extends StatelessWidget { const ReplyItemGrpc({ super.key, required this.replyItem, - this.replyLevel, - this.showReplyRow = true, + required this.replyLevel, this.replyReply, - this.replyType, this.needDivider = true, this.onReply, this.onDelete, @@ -48,12 +45,10 @@ class ReplyItemGrpc extends StatelessWidget { this.onToggleTop, }); final ReplyInfo replyItem; - final String? replyLevel; - final bool showReplyRow; - final Function? replyReply; - final ReplyType? replyType; + final String replyLevel; + final Function(ReplyInfo replyItem, int? rpid)? replyReply; final bool needDivider; - final Function()? onReply; + final VoidCallback? onReply; final Function(dynamic rpid, dynamic frpid)? onDelete; final dynamic upMid; final VoidCallback? showDialogue; @@ -406,7 +401,7 @@ class ReplyItemGrpc extends StatelessWidget { // 操作区域 if (replyLevel != '') buttonAction(context, replyItem.replyControl), // 一楼的评论 - if (showReplyRow && + if (replyLevel == '1' && ( //replyItem.replyControl!.isShow! || replyItem.replies.isNotEmpty || replyItem.replyControl.subReplyEntryText.isNotEmpty)) ...[ @@ -505,7 +500,7 @@ class ReplyItemGrpc extends StatelessWidget { ), ), const Spacer(), - ZanButtonGrpc(replyItem: replyItem, replyType: replyType), + ZanButtonGrpc(replyItem: replyItem), const SizedBox(width: 5) ], ); diff --git a/lib/pages/video/detail/reply/widgets/reply_save.dart b/lib/pages/video/detail/reply/widgets/reply_save.dart index 04009406f..51aac515b 100644 --- a/lib/pages/video/detail/reply/widgets/reply_save.dart +++ b/lib/pages/video/detail/reply/widgets/reply_save.dart @@ -194,7 +194,6 @@ class _ReplySavePanelState extends State { IgnorePointer( child: ReplyItemGrpc( replyItem: widget.replyItem, - showReplyRow: false, replyLevel: '', needDivider: false, upMid: widget.upMid, diff --git a/lib/pages/video/detail/reply/widgets/zan_grpc.dart b/lib/pages/video/detail/reply/widgets/zan_grpc.dart index 74c94294f..7abe7f37d 100644 --- a/lib/pages/video/detail/reply/widgets/zan_grpc.dart +++ b/lib/pages/video/detail/reply/widgets/zan_grpc.dart @@ -5,7 +5,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:PiliPlus/http/reply.dart'; -import 'package:PiliPlus/models/common/reply_type.dart'; import 'package:PiliPlus/utils/feed_back.dart'; import 'package:fixnum/fixnum.dart' as $fixnum; @@ -13,11 +12,9 @@ class ZanButtonGrpc extends StatefulWidget { const ZanButtonGrpc({ super.key, required this.replyItem, - this.replyType, }); final ReplyInfo replyItem; - final ReplyType? replyType; @override State createState() => _ZanButtonGrpcState(); @@ -33,7 +30,7 @@ class _ZanButtonGrpcState extends State { final int action = widget.replyItem.replyControl.action.toInt() != 2 ? 2 : 0; final res = await ReplyHttp.hateReply( - type: widget.replyType!.index, + type: widget.replyItem.type.toInt(), action: action == 2 ? 1 : 0, oid: oid, rpid: rpid, @@ -68,7 +65,7 @@ class _ZanButtonGrpcState extends State { final int action = widget.replyItem.replyControl.action.toInt() != 1 ? 1 : 0; final res = await ReplyHttp.likeReply( - type: widget.replyType!.index, + type: widget.replyItem.type.toInt(), oid: oid, rpid: rpid, action: action, diff --git a/lib/pages/video/detail/reply_reply/view.dart b/lib/pages/video/detail/reply_reply/view.dart index 19673052d..9bad3b17d 100644 --- a/lib/pages/video/detail/reply_reply/view.dart +++ b/lib/pages/video/detail/reply_reply/view.dart @@ -179,8 +179,6 @@ class _VideoReplyReplyPanelState return ReplyItemGrpc( replyItem: firstFloor, replyLevel: '2', - showReplyRow: false, - replyType: widget.replyType, needDivider: false, onReply: () { _onReply(firstFloor, -1); @@ -455,8 +453,6 @@ class _VideoReplyReplyPanelState return ReplyItemGrpc( replyItem: replyItem, replyLevel: widget.isDialogue ? '3' : '2', - showReplyRow: false, - replyType: widget.replyType, onReply: () { _onReply(replyItem, index); }, diff --git a/lib/pages/video/detail/view_v.dart b/lib/pages/video/detail/view_v.dart index b3d26cfd8..26374b50e 100644 --- a/lib/pages/video/detail/view_v.dart +++ b/lib/pages/video/detail/view_v.dart @@ -5,6 +5,7 @@ import 'dart:ui'; import 'package:PiliPlus/common/constants.dart'; import 'package:PiliPlus/common/widgets/episode_panel.dart'; +import 'package:PiliPlus/grpc/app/main/community/reply/v1/reply.pb.dart'; import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/main.dart'; import 'package:PiliPlus/models/common/reply_type.dart'; @@ -2222,7 +2223,7 @@ class _VideoDetailPageVState extends State ); // 展示二级回复 - void replyReply(replyItem, id) { + void replyReply(ReplyInfo replyItem, int? id) { EasyThrottle.throttle('replyReply', const Duration(milliseconds: 500), () { int oid = replyItem.oid.toInt(); int rpid = replyItem.id.toInt();