diff --git a/lib/models/video/reply/content.dart b/lib/models/video/reply/content.dart index 68b59768..ad1759ac 100644 --- a/lib/models/video/reply/content.dart +++ b/lib/models/video/reply/content.dart @@ -33,10 +33,7 @@ class ReplyContent { pictures = json['pictures'] ?? []; vote = json['vote'] ?? {}; richText = json['rich_text'] ?? {}; - isText = emote!.isEmpty && - atNameToMid!.isEmpty && - jumpUrl!.isEmpty && - vote!.isEmpty && - pictures!.isEmpty; + // 不包含@ 笔记 图片的时候,文字可折叠 + isText = atNameToMid!.isEmpty && vote!.isEmpty && pictures!.isEmpty; } } diff --git a/lib/pages/video/detail/reply/view.dart b/lib/pages/video/detail/reply/view.dart index 506e0f66..574d4233 100644 --- a/lib/pages/video/detail/reply/view.dart +++ b/lib/pages/video/detail/reply/view.dart @@ -120,7 +120,7 @@ class _VideoReplyPanelState extends State void replyReply(replyItem) { VideoDetailController videoDetailCtr = Get.find(tag: Get.arguments['heroTag']); - videoDetailCtr.oid = replyItem.replies!.first.oid; + videoDetailCtr.oid = replyItem.oid; videoDetailCtr.fRpid = replyItem.rpid!; videoDetailCtr.firstFloor = replyItem; videoDetailCtr.showReplyReplyPanel(); diff --git a/lib/pages/video/detail/reply/widgets/reply_item.dart b/lib/pages/video/detail/reply/widgets/reply_item.dart index e690effc..21d156a6 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item.dart @@ -1,17 +1,12 @@ -import 'dart:developer'; - import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_meedu_media_kit/meedu_player.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:get/get.dart'; import 'package:pilipala/common/widgets/network_img_layer.dart'; import 'package:pilipala/models/common/reply_type.dart'; import 'package:pilipala/models/video/reply/item.dart'; import 'package:pilipala/pages/video/detail/controller.dart'; -import 'package:pilipala/pages/video/detail/reply/index.dart'; import 'package:pilipala/pages/video/detail/replyNew/index.dart'; -import 'package:pilipala/pages/video/detail/replyReply/index.dart'; import 'package:pilipala/utils/utils.dart'; class ReplyItem extends StatelessWidget { @@ -33,66 +28,52 @@ class ReplyItem extends StatelessWidget { @override Widget build(BuildContext context) { - return InkWell( - onTap: () {}, - child: Column( - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(12, 4, 8, 2), - child: content(context), - ), - // Divider( - // height: 1, - // indent: 52, - // endIndent: 10, - // color: Theme.of(context).dividerColor.withOpacity(0.08), - // ) - ], + return Material( + child: InkWell( + // 点击整个评论区 评论详情/回复 + onTap: () => replyReply!(replyItem), + child: Padding( + padding: const EdgeInsets.fromLTRB(12, 4, 8, 2), + child: content(context), + ), ), ); } Widget lfAvtar(context, heroTag) { return Container( - margin: const EdgeInsets.only(top: 5), - child: Stack( - children: [ - Hero( - tag: heroTag, - child: NetworkImgLayer( - src: replyItem!.member!.avatar, - width: 34, - height: 34, - type: 'avatar', - ), + margin: const EdgeInsets.only(top: 5), + child: Stack( + children: [ + Hero( + tag: heroTag, + child: NetworkImgLayer( + src: replyItem!.member!.avatar, + width: 34, + height: 34, + type: 'avatar', ), - if (replyItem!.member!.officialVerify != null && - replyItem!.member!.officialVerify!['type'] == 0) - Positioned( - right: 0, - bottom: 0, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(7), - color: Theme.of(context).colorScheme.background, - ), - child: Icon( - Icons.offline_bolt, - color: Theme.of(context).colorScheme.primary, - size: 16, - ), + ), + if (replyItem!.member!.officialVerify != null && + replyItem!.member!.officialVerify!['type'] == 0) + Positioned( + right: 0, + bottom: 0, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(7), + color: Theme.of(context).colorScheme.background, + ), + child: Icon( + Icons.offline_bolt, + color: Theme.of(context).colorScheme.primary, + size: 16, ), ), - ], - ) - // child: - // NetworkImgLayer( - // src: replyItem!.member!.avatar, - // width: 30, - // height: 30, - // type: 'avatar', - // ), - ); + ), + ], + ), + ); } Widget content(context) { @@ -198,13 +179,13 @@ class ReplyItem extends StatelessWidget { child: Text.rich( style: const TextStyle(height: 1.65), maxLines: - replyItem!.content!.isText! && replyLevel == '1' ? 6 : 999, + replyItem!.content!.isText! && replyLevel == '1' ? 3 : 999, overflow: TextOverflow.ellipsis, TextSpan( children: [ if (replyItem!.isTop!) WidgetSpan(child: UpTag(tagText: 'TOP')), - buildContent(context, replyItem!, replyReply), + buildContent(context, replyItem!, replyReply, 1, null), ], ), ), @@ -212,10 +193,10 @@ class ReplyItem extends StatelessWidget { ), // 操作区域 bottonAction(context, replyItem!.replyControl), - const SizedBox(height: 3), + // 一楼的评论 if (replyItem!.replies!.isNotEmpty && showReplyRow!) ...[ Padding( - padding: const EdgeInsets.only(top: 2, bottom: 12), + padding: const EdgeInsets.only(top: 5, bottom: 12), child: ReplyItemRow( replies: replyItem!.replies, replyControl: replyItem!.replyControl, @@ -360,6 +341,7 @@ class ReplyItemRow extends StatelessWidget { children: [ for (var i = 0; i < replies!.length; i++) ...[ InkWell( + // 一楼点击评论展开评论详情 onTap: () => replyReply!(replyItem), child: Container( width: double.infinity, @@ -401,7 +383,8 @@ class ReplyItemRow extends StatelessWidget { WidgetSpan( child: UpTag(), ), - buildContent(context, replies![i], replyReply), + buildContent( + context, replies![i], replyReply, 2, replyItem), ], ), ), @@ -410,6 +393,7 @@ class ReplyItemRow extends StatelessWidget { ], if (extraRow == 1) InkWell( + // 一楼点击【共xx条回复】展开评论详情 onTap: () => replyReply!(replyItem), child: Container( width: double.infinity, @@ -441,18 +425,22 @@ class ReplyItemRow extends StatelessWidget { } } -InlineSpan buildContent(BuildContext context, replyItem, replyReply) { +InlineSpan buildContent( + BuildContext context, replyItem, replyReply, level, fReplyItem) { + // replyItem 当前回复内容 + // replyReply 查看二楼回复(回复详情)回调 + // fReplyItem 父级回复内容,用作二楼回复(回复详情)展示 var content = replyItem.content; - if (content.emote.isEmpty && - content.atNameToMid.isEmpty && - content.jumpUrl.isEmpty && - content.vote.isEmpty && - content.pictures.isEmpty) { - return TextSpan( - text: content.message, - recognizer: TapGestureRecognizer()..onTap = () => replyReply(replyItem), - ); - } + // if (content.emote.isEmpty && + // content.atNameToMid.isEmpty && + // content.jumpUrl.isEmpty && + // content.vote.isEmpty && + // content.pictures.isEmpty) { + // return TextSpan( + // text: content.message, + // recognizer: TapGestureRecognizer()..onTap = () => replyReply(fReplyItem), + // ); + // } List spanChilds = []; bool hasMatchMember = true; @@ -510,11 +498,18 @@ InlineSpan buildContent(BuildContext context, replyItem, replyReply) { ), ); } else { - spanChilds.add(TextSpan(text: matchStr)); + spanChilds.add(TextSpan( + text: matchStr, + recognizer: TapGestureRecognizer() + ..onTap = + () => replyReply(level == 1 ? replyItem : fReplyItem))); return matchStr; } } else { - spanChilds.add(TextSpan(text: matchStr)); + spanChilds.add(TextSpan( + text: matchStr, + recognizer: TapGestureRecognizer() + ..onTap = () => replyReply(level == 1 ? replyItem : fReplyItem))); return matchStr; } return ''; @@ -595,7 +590,11 @@ InlineSpan buildContent(BuildContext context, replyItem, replyReply) { return ''; }, onNonMatch: (String str) { - spanChilds.add(TextSpan(text: str)); + spanChilds.add(TextSpan( + text: str, + recognizer: TapGestureRecognizer() + ..onTap = + () => replyReply(level == 1 ? replyItem : fReplyItem))); return str; }, ); @@ -628,7 +627,10 @@ InlineSpan buildContent(BuildContext context, replyItem, replyReply) { ); if (content.atNameToMid.isEmpty && content.jumpUrl.isEmpty) { - spanChilds.add(TextSpan(text: str)); + spanChilds.add(TextSpan( + text: str, + recognizer: TapGestureRecognizer() + ..onTap = () => replyReply(level == 1 ? replyItem : fReplyItem))); } return str; },