mod: 纯文本回复折叠、replyType传值

This commit is contained in:
guozhigq
2023-07-22 23:31:05 +08:00
parent 90f05931f1
commit 499dff5646
5 changed files with 38 additions and 21 deletions

View File

@ -5,6 +5,7 @@ import 'package:flutter/rendering.dart';
import 'package:get/get.dart';
import 'package:pilipala/common/skeleton/video_reply.dart';
import 'package:pilipala/common/widgets/http_error.dart';
import 'package:pilipala/models/common/reply_type.dart';
import 'package:pilipala/models/video/reply/item.dart';
import 'package:pilipala/pages/video/detail/index.dart';
import 'package:pilipala/pages/video/detail/replyNew/index.dart';
@ -181,6 +182,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
replyLevel: replyLevel,
replyReply: (replyItem) =>
replyReply(replyItem),
replyType: ReplyType.video,
);
}
},
@ -233,12 +235,13 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
oid: IdUtils.bv2av(Get.parameters['bvid']!),
root: 0,
parent: 0,
replyType: ReplyType.video,
);
},
).then(
(value) => {
// 完成评论,数据添加
if (value != null && value['data'])
if (value != null && value['data'] != null)
{_videoReplyController.replyList.add(value['data'])}
},
);

View File

@ -197,11 +197,14 @@ class ReplyItem extends StatelessWidget {
selectionControls: MaterialTextSelectionControls(),
child: Text.rich(
style: const TextStyle(height: 1.65),
maxLines:
replyItem!.content!.isText! && replyLevel == '1' ? 6 : 999,
overflow: TextOverflow.ellipsis,
TextSpan(
children: [
if (replyItem!.isTop!)
WidgetSpan(child: UpTag(tagText: 'TOP')),
buildContent(context, replyItem!.content!),
buildContent(context, replyItem!, replyReply),
],
),
),
@ -398,7 +401,7 @@ class ReplyItemRow extends StatelessWidget {
WidgetSpan(
child: UpTag(),
),
buildContent(context, replies![i].content),
buildContent(context, replies![i], replyReply),
],
),
),
@ -438,7 +441,8 @@ class ReplyItemRow extends StatelessWidget {
}
}
InlineSpan buildContent(BuildContext context, content) {
InlineSpan buildContent(BuildContext context, replyItem, replyReply) {
var content = replyItem.content;
if (content.emote.isEmpty &&
content.atNameToMid.isEmpty &&
content.jumpUrl.isEmpty &&
@ -446,7 +450,7 @@ InlineSpan buildContent(BuildContext context, content) {
content.pictures.isEmpty) {
return TextSpan(
text: content.message,
// recognizer: TapGestureRecognizer()..onTap = () => {print('点击')},
recognizer: TapGestureRecognizer()..onTap = () => replyReply(replyItem),
);
}
List<InlineSpan> spanChilds = [];

View File

@ -70,7 +70,7 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
Future submitReplyAdd() async {
String message = _replyContentController.text;
var result = await VideoHttp.replyAdd(
type: widget.replyType!,
type: widget.replyType ?? ReplyType.video,
oid: widget.oid!,
root: widget.root!,
parent: widget.parent!,

View File

@ -117,12 +117,14 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
const SliverToBoxAdapter(child: SizedBox(height: 10)),
SliverToBoxAdapter(
child: ReplyItem(
replyItem: widget.firstFloor,
replyLevel: '1',
showReplyRow: false,
addReply: (replyItem) {
_videoReplyReplyController.replyList.add(replyItem);
}),
replyItem: widget.firstFloor,
replyLevel: '2',
showReplyRow: false,
addReply: (replyItem) {
_videoReplyReplyController.replyList.add(replyItem);
},
replyType: ReplyType.video,
),
),
SliverToBoxAdapter(
child: Divider(