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