mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: reply item
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -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<DynamicDetailPage>
|
||||
}
|
||||
|
||||
// 查看二级评论
|
||||
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<DynamicDetailPage>
|
||||
} 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,
|
||||
|
||||
@@ -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<HtmlRenderPage>
|
||||
}
|
||||
}
|
||||
|
||||
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<HtmlRenderPage>
|
||||
} 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,
|
||||
|
||||
@@ -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<int>? onDismissed;
|
||||
final Function(List<String>, 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<VideoReplyPanel>
|
||||
with AutomaticKeepAliveClientMixin, TickerProviderStateMixin {
|
||||
late VideoReplyController _videoReplyController;
|
||||
|
||||
String replyLevel = '1';
|
||||
late String heroTag;
|
||||
|
||||
// 添加页面缓存
|
||||
@@ -60,7 +60,6 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
||||
// int oid = widget.bvid != null ? IdUtils.bv2av(widget.bvid!) : 0;
|
||||
// heroTag = Get.arguments['heroTag'];
|
||||
heroTag = widget.heroTag;
|
||||
replyLevel = widget.replyLevel ?? '1';
|
||||
_videoReplyController = Get.find<VideoReplyController>(tag: heroTag);
|
||||
|
||||
if (widget.needController != false) {
|
||||
@@ -236,10 +235,8 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
||||
} 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,
|
||||
|
||||
@@ -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)
|
||||
],
|
||||
);
|
||||
|
||||
@@ -194,7 +194,6 @@ class _ReplySavePanelState extends State<ReplySavePanel> {
|
||||
IgnorePointer(
|
||||
child: ReplyItemGrpc(
|
||||
replyItem: widget.replyItem,
|
||||
showReplyRow: false,
|
||||
replyLevel: '',
|
||||
needDivider: false,
|
||||
upMid: widget.upMid,
|
||||
|
||||
@@ -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<ZanButtonGrpc> createState() => _ZanButtonGrpcState();
|
||||
@@ -33,7 +30,7 @@ class _ZanButtonGrpcState extends State<ZanButtonGrpc> {
|
||||
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<ZanButtonGrpc> {
|
||||
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,
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
|
||||
@@ -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<VideoDetailPageV>
|
||||
);
|
||||
|
||||
// 展示二级回复
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user