logo和名称替换
This commit is contained in:
@@ -2,26 +2,26 @@ import 'dart:math';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hgmj/assets_tool/images.dart';
|
||||
import 'package:hgmj/extension/extensions.dart';
|
||||
import 'package:hgmj/hj_model/comment/comment_model.dart';
|
||||
import 'package:hgmj/hj_model/comment/reply_model.dart';
|
||||
import 'package:hgmj/hj_model/video_model.dart';
|
||||
import 'package:hgmj/hj_page/comment/cell/reply_comment_item.dart';
|
||||
import 'package:hgmj/hj_utils/api_service/comment_service.dart';
|
||||
import 'package:hgmj/hj_utils/api_service/common_service.dart';
|
||||
import 'package:hgmj/hj_utils/date_time_util.dart';
|
||||
import 'package:hgmj/hj_utils/screen.dart';
|
||||
import 'package:hgmj/tools_base/debug_log.dart';
|
||||
import 'package:wydj/assets_tool/images.dart';
|
||||
import 'package:wydj/extension/extensions.dart';
|
||||
import 'package:wydj/hj_model/comment/comment_model.dart';
|
||||
import 'package:wydj/hj_model/comment/reply_model.dart';
|
||||
import 'package:wydj/hj_model/video_model.dart';
|
||||
import 'package:wydj/hj_page/comment/cell/reply_comment_item.dart';
|
||||
import 'package:wydj/hj_utils/api_service/comment_service.dart';
|
||||
import 'package:wydj/hj_utils/api_service/common_service.dart';
|
||||
import 'package:wydj/hj_utils/date_time_util.dart';
|
||||
import 'package:wydj/hj_utils/screen.dart';
|
||||
import 'package:wydj/tools_base/debug_log.dart';
|
||||
import 'package:like_button/like_button.dart';
|
||||
|
||||
import '../../../tools_base/widget/net_image_widget.dart';
|
||||
import 'package:hgmj/tools_base/widget/image_browser_page.dart';
|
||||
import 'package:wydj/tools_base/widget/image_browser_page.dart';
|
||||
import '../../home/widget/user_avatar.dart';
|
||||
import '../../home/widget/user_name_view.dart';
|
||||
import '../widget/comment_rich_text.dart';
|
||||
import '../widget/comment_top_banner.dart';
|
||||
import 'package:hgmj/hj_model/banner/comment_top_banner_model.dart';
|
||||
import 'package:wydj/hj_model/banner/comment_top_banner_model.dart';
|
||||
|
||||
/// 一条评论:头像 + 昵称 + 正文(可带图) + 时间/点赞/回复 + 折叠的回复列表
|
||||
class CommentItem extends StatefulWidget {
|
||||
@@ -93,7 +93,8 @@ class _CommentItemState extends State<CommentItem> {
|
||||
),
|
||||
if ((comment.vipLevel ?? 0) > 0) ...[
|
||||
4.sizeBoxW,
|
||||
Image.asset("vip_v.webp".commentPath, width: 16),
|
||||
Image.asset("vip_v.webp".commentPath,
|
||||
width: 16),
|
||||
]
|
||||
],
|
||||
),
|
||||
@@ -108,11 +109,13 @@ class _CommentItemState extends State<CommentItem> {
|
||||
margin: EdgeInsets.only(top: 6),
|
||||
alignment: Alignment.centerLeft,
|
||||
constraints: BoxConstraints(maxWidth: 150),
|
||||
child: NetworkImageLoader(imageUrl: comment.image ?? ""),
|
||||
child: NetworkImageLoader(
|
||||
imageUrl: comment.image ?? ""),
|
||||
),
|
||||
),
|
||||
// 置顶评论配置 Banner(多图轮播,支持 GIF / 内外链)
|
||||
if (widget.topBanners?.isNotEmpty == true) CommentTopBanner(banners: widget.topBanners!),
|
||||
if (widget.topBanners?.isNotEmpty == true)
|
||||
CommentTopBanner(banners: widget.topBanners!),
|
||||
8.sizeBoxH,
|
||||
Row(
|
||||
children: [
|
||||
@@ -124,7 +127,8 @@ class _CommentItemState extends State<CommentItem> {
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
if (!comment.isOfficial && !comment.isHideLikeOrComment) ...[
|
||||
if (!comment.isOfficial &&
|
||||
!comment.isHideLikeOrComment) ...[
|
||||
ValueListenableBuilder(
|
||||
valueListenable: isLikedNof,
|
||||
builder: (context, value, child) => Row(
|
||||
@@ -134,7 +138,9 @@ class _CommentItemState extends State<CommentItem> {
|
||||
onTap: (_) => _toggleLike(),
|
||||
size: 20,
|
||||
likeBuilder: (isLiked) {
|
||||
return Image.asset(isLiked ? 'like_red.webp'.commentPath : 'like_white.webp'.commentPath);
|
||||
return Image.asset(isLiked
|
||||
? 'like_red.webp'.commentPath
|
||||
: 'like_white.webp'.commentPath);
|
||||
},
|
||||
),
|
||||
Text(
|
||||
@@ -149,15 +155,18 @@ class _CommentItemState extends State<CommentItem> {
|
||||
),
|
||||
12.sizeBoxW,
|
||||
GestureDetector(
|
||||
onTap: () => widget.replyHandler?.call(comment),
|
||||
child: Image.asset('msg_icon.png'.commentPath, width: 20),
|
||||
onTap: () =>
|
||||
widget.replyHandler?.call(comment),
|
||||
child: Image.asset('msg_icon.png'.commentPath,
|
||||
width: 20),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
_replyList(),
|
||||
// 展开更多评论
|
||||
if ((comment.replies?.length ?? 0) > 0) _moreReplyBar(),
|
||||
if ((comment.replies?.length ?? 0) > 0)
|
||||
_moreReplyBar(),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -192,7 +201,11 @@ class _CommentItemState extends State<CommentItem> {
|
||||
children: [
|
||||
Container(width: 20, height: 1, color: const Color(0xff989898)),
|
||||
4.sizeBoxW,
|
||||
Text(text, style: const TextStyle(fontSize: 12, color: Color(0xff989898), fontWeight: FontWeight.w500)),
|
||||
Text(text,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xff989898),
|
||||
fontWeight: FontWeight.w500)),
|
||||
2.sizeBoxW,
|
||||
isUp ? Transform.rotate(angle: pi, child: chevron) : chevron,
|
||||
],
|
||||
@@ -250,8 +263,8 @@ class _CommentItemState extends State<CommentItem> {
|
||||
if (comment.hasMoreReply ?? false) {
|
||||
final curTime = DateTimeUtil.format2utc(DateTime.now());
|
||||
final fastId = comment.replies!.first.id ?? '';
|
||||
final result =
|
||||
await CommentService.getReplyList(widget.objId, comment.id ?? '', curTime, comment.replyPage ?? _page, 5, fastId);
|
||||
final result = await CommentService.getReplyList(widget.objId,
|
||||
comment.id ?? '', curTime, comment.replyPage ?? _page, 5, fastId);
|
||||
comment.hasMoreReply = result?.hasNext ?? false;
|
||||
comment.replies?.addAll(result?.list ?? []);
|
||||
if (result?.hasNext == true) {
|
||||
@@ -296,7 +309,8 @@ class _CommentItemState extends State<CommentItem> {
|
||||
length,
|
||||
(i) => ReplyCommentItem(
|
||||
replies[i],
|
||||
replyHandler: (reply) => widget.replyHandler?.call(comment, reply: reply),
|
||||
replyHandler: (reply) =>
|
||||
widget.replyHandler?.call(comment, reply: reply),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgmj/assets_tool/images.dart';
|
||||
import 'package:hgmj/extension/extensions.dart';
|
||||
import 'package:hgmj/hj_utils/screen.dart';
|
||||
import 'package:wydj/assets_tool/images.dart';
|
||||
import 'package:wydj/extension/extensions.dart';
|
||||
import 'package:wydj/hj_utils/screen.dart';
|
||||
import 'package:like_button/like_button.dart';
|
||||
|
||||
import '../../../hj_model/comment/reply_model.dart';
|
||||
import '../../../hj_utils/api_service/common_service.dart';
|
||||
import '../../../tools_base/widget/net_image_widget.dart';
|
||||
import 'package:hgmj/tools_base/widget/image_browser_page.dart';
|
||||
import 'package:wydj/tools_base/widget/image_browser_page.dart';
|
||||
import '../../user_center_page/user_center_page.dart';
|
||||
|
||||
/// 评论下的一条回复:小头像 + 「A ▸ B」 + 正文(可带图) + 时间/点赞/回复
|
||||
@@ -81,7 +81,8 @@ class _ReplyCommentItemState extends State<ReplyCommentItem> {
|
||||
3.sizeBoxW,
|
||||
Text(
|
||||
reply.toUserName ?? '',
|
||||
style: TextStyle(color: Color(0x73FFFFFF), fontSize: 14),
|
||||
style:
|
||||
TextStyle(color: Color(0x73FFFFFF), fontSize: 14),
|
||||
),
|
||||
]
|
||||
],
|
||||
@@ -111,7 +112,8 @@ class _ReplyCommentItemState extends State<ReplyCommentItem> {
|
||||
children: [
|
||||
Text(
|
||||
reply.createdAt?.utcToAgo() ?? "",
|
||||
style: const TextStyle(color: Color(0x73FFFFFF), fontSize: 12),
|
||||
style: const TextStyle(
|
||||
color: Color(0x73FFFFFF), fontSize: 12),
|
||||
),
|
||||
const Spacer(),
|
||||
ValueListenableBuilder(
|
||||
@@ -123,7 +125,9 @@ class _ReplyCommentItemState extends State<ReplyCommentItem> {
|
||||
onTap: (_) => _toggleLike(),
|
||||
size: 20,
|
||||
likeBuilder: (isLiked) {
|
||||
return Image.asset(isLiked ? 'like_red.webp'.commentPath : 'like_white.webp'.commentPath);
|
||||
return Image.asset(isLiked
|
||||
? 'like_red.webp'.commentPath
|
||||
: 'like_white.webp'.commentPath);
|
||||
},
|
||||
),
|
||||
Text(
|
||||
@@ -139,7 +143,8 @@ class _ReplyCommentItemState extends State<ReplyCommentItem> {
|
||||
12.sizeBoxW,
|
||||
GestureDetector(
|
||||
onTap: () => widget.replyHandler?.call(reply),
|
||||
child: Image.asset('msg_icon.png'.commentPath, width: 20),
|
||||
child:
|
||||
Image.asset('msg_icon.png'.commentPath, width: 20),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgmj/hj_model/video_model.dart';
|
||||
import 'package:hgmj/hj_utils/screen.dart';
|
||||
import 'package:hgmj/tools_base/widget/sheet_handle_bar.dart';
|
||||
import 'package:wydj/hj_model/video_model.dart';
|
||||
import 'package:wydj/hj_utils/screen.dart';
|
||||
import 'package:wydj/tools_base/widget/sheet_handle_bar.dart';
|
||||
|
||||
import 'comment_views.dart';
|
||||
|
||||
@@ -35,7 +35,10 @@ Future showCommentDialog(
|
||||
padding: const EdgeInsets.only(left: 16, bottom: 16),
|
||||
child: Text(
|
||||
"${commentCount ?? 0}条评论",
|
||||
style: TextStyle(color: Colors.white, fontWeight: FontWeight.w400, fontSize: 14),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 14),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
|
||||
@@ -3,10 +3,10 @@ import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:image_pickers/image_pickers.dart';
|
||||
import 'package:hgmj/assets_tool/images.dart';
|
||||
import 'package:hgmj/tools_base/toast.dart';
|
||||
import 'package:hgmj/hj_utils/screen.dart';
|
||||
import 'package:hgmj/tools_base/widget/group_text_filed.dart';
|
||||
import 'package:wydj/assets_tool/images.dart';
|
||||
import 'package:wydj/tools_base/toast.dart';
|
||||
import 'package:wydj/hj_utils/screen.dart';
|
||||
import 'package:wydj/tools_base/widget/group_text_filed.dart';
|
||||
|
||||
/// 评论输入弹层:点空白关闭,自动聚焦拉起键盘
|
||||
class CommentInputView extends StatefulWidget {
|
||||
@@ -125,19 +125,24 @@ class _CommentInputViewState extends State<CommentInputView> {
|
||||
controller: textCtr,
|
||||
height: 32,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
textStyle: TextStyle(color: Colors.white, fontSize: 14),
|
||||
textStyle:
|
||||
TextStyle(color: Colors.white, fontSize: 14),
|
||||
onSubmitted: (value) {
|
||||
Get.back(result: true);
|
||||
},
|
||||
placeholder: widget.hint ?? '请在此输入评论...',
|
||||
placeholderTextStyle: TextStyle(color: Color(0xff4D4D4D), fontSize: 14),
|
||||
decoration: BoxDecoration(color: Color(0xff1A1A1A), borderRadius: BorderRadius.circular(40)),
|
||||
placeholderTextStyle: TextStyle(
|
||||
color: Color(0xff4D4D4D), fontSize: 14),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xff1A1A1A),
|
||||
borderRadius: BorderRadius.circular(40)),
|
||||
),
|
||||
),
|
||||
),
|
||||
12.sizeBoxW,
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 12, top: 4, bottom: 4),
|
||||
padding: const EdgeInsets.only(
|
||||
right: 12, top: 4, bottom: 4),
|
||||
child: GestureDetector(
|
||||
onTap: _pickImage,
|
||||
child: Image.asset(
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgmj/hj_model/comment/comment_model.dart';
|
||||
import 'package:hgmj/hj_model/comment/reply_model.dart';
|
||||
import 'package:hgmj/hj_page/comment/comment_input_view.dart';
|
||||
import 'package:hgmj/hj_utils/api_service/comment_service.dart';
|
||||
import 'package:hgmj/hj_utils/api_service/common_service.dart';
|
||||
import 'package:hgmj/hj_utils/date_time_util.dart';
|
||||
import 'package:hgmj/tools_base/debug_log.dart';
|
||||
import 'package:hgmj/tools_base/toast.dart';
|
||||
import 'package:wydj/hj_model/comment/comment_model.dart';
|
||||
import 'package:wydj/hj_model/comment/reply_model.dart';
|
||||
import 'package:wydj/hj_page/comment/comment_input_view.dart';
|
||||
import 'package:wydj/hj_utils/api_service/comment_service.dart';
|
||||
import 'package:wydj/hj_utils/api_service/common_service.dart';
|
||||
import 'package:wydj/hj_utils/date_time_util.dart';
|
||||
import 'package:wydj/tools_base/debug_log.dart';
|
||||
import 'package:wydj/tools_base/toast.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
|
||||
import '../../hj_model/banner/comment_top_banner_model.dart';
|
||||
@@ -49,7 +49,8 @@ mixin CommentMixin on GetxController {
|
||||
String? sendImagePath;
|
||||
if (selectedImagePath.value?.isNotEmpty == true) {
|
||||
try {
|
||||
ImageUploadResultModel? imgResult = await FileUploadTool().uploadImage(selectedImagePath.value!);
|
||||
ImageUploadResultModel? imgResult =
|
||||
await FileUploadTool().uploadImage(selectedImagePath.value!);
|
||||
sendImagePath = imgResult?.coverImg ?? "";
|
||||
if (sendImagePath.isEmpty) {
|
||||
isSendingMsg.value = false;
|
||||
@@ -102,8 +103,10 @@ mixin CommentMixin on GetxController {
|
||||
showToast('已提交,审核通过后将展示');
|
||||
hintText = null;
|
||||
//插在第一条普通评论前面,置顶那几条不动
|
||||
final insertIndex = comments.indexWhere((e) => !e.isHideLikeOrComment);
|
||||
comments.insert(insertIndex == -1 ? comments.length : insertIndex, res);
|
||||
final insertIndex =
|
||||
comments.indexWhere((e) => !e.isHideLikeOrComment);
|
||||
comments.insert(
|
||||
insertIndex == -1 ? comments.length : insertIndex, res);
|
||||
}
|
||||
update();
|
||||
}
|
||||
@@ -116,7 +119,8 @@ mixin CommentMixin on GetxController {
|
||||
}
|
||||
|
||||
// isSend: true 点击了发送按钮, 如果没有发送内容弹键盘, 有内容直接发送
|
||||
readyReplyComment(CommentModel? comment, {ReplyModel? replyModel, bool? isSend}) async {
|
||||
readyReplyComment(CommentModel? comment,
|
||||
{ReplyModel? replyModel, bool? isSend}) async {
|
||||
replyComment = comment;
|
||||
replyCommentModel = replyModel;
|
||||
if (replyModel != null) {
|
||||
@@ -156,7 +160,8 @@ mixin CommentMixin on GetxController {
|
||||
page = 1;
|
||||
}
|
||||
final currentT = DateTimeUtil.format2utc(DateTime.now()) ?? "";
|
||||
final result = await CommentService.getCommentList(id, currentT, page, 20);
|
||||
final result =
|
||||
await CommentService.getCommentList(id, currentT, page, 20);
|
||||
totalCallback?.call(result?.total ?? 0);
|
||||
refreshCtr?.refreshCompleted();
|
||||
refreshCtr?.loadComplete();
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgmj/hj_model/video_model.dart';
|
||||
import 'package:hgmj/hj_page/comment/cell/comment_item.dart';
|
||||
import 'package:hgmj/hj_page/comment/comment_mixin.dart';
|
||||
import 'package:hgmj/hj_page/comment/widget/comment_foot_view.dart';
|
||||
import 'package:hgmj/tools_base/loading/loading_center_widget.dart';
|
||||
import 'package:hgmj/tools_base/refresh/pull_refresh.dart';
|
||||
import 'package:wydj/hj_model/video_model.dart';
|
||||
import 'package:wydj/hj_page/comment/cell/comment_item.dart';
|
||||
import 'package:wydj/hj_page/comment/comment_mixin.dart';
|
||||
import 'package:wydj/hj_page/comment/widget/comment_foot_view.dart';
|
||||
import 'package:wydj/tools_base/loading/loading_center_widget.dart';
|
||||
import 'package:wydj/tools_base/refresh/pull_refresh.dart';
|
||||
|
||||
import '../home/widget/quick_search_view.dart';
|
||||
|
||||
@@ -41,7 +41,6 @@ class CommentLogic extends GetxController with CommentMixin {
|
||||
isLoading = false;
|
||||
fetchComments(objId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class CommentView extends StatelessWidget {
|
||||
@@ -63,7 +62,10 @@ class CommentView extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder(
|
||||
init: CommentLogic(objId, commentType: objType, totalCallback: totalCallback, vModel: videoModel),
|
||||
init: CommentLogic(objId,
|
||||
commentType: objType,
|
||||
totalCallback: totalCallback,
|
||||
vModel: videoModel),
|
||||
tag: objId,
|
||||
builder: (logic) => LayoutBuilder(builder: (_, cons) {
|
||||
if (cons.maxHeight < 58) return SizedBox.shrink();
|
||||
@@ -84,7 +86,10 @@ class CommentView extends StatelessWidget {
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(bottom: 12),
|
||||
margin: EdgeInsets.fromLTRB(12, 0, 12, 12),
|
||||
decoration: BoxDecoration(border: Border(bottom: BorderSide(color: Color(0x08ffffff)))),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom:
|
||||
BorderSide(color: Color(0x08ffffff)))),
|
||||
child: QuickSearchView(logic.quickSearchList),
|
||||
),
|
||||
),
|
||||
@@ -92,15 +97,19 @@ class CommentView extends StatelessWidget {
|
||||
itemCount: logic.comments.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final topIndex = logic.topPinnedCommentIndex;
|
||||
final showBanner = index == topIndex && logic.commentTopBanners.isNotEmpty;
|
||||
final showBanner = index == topIndex &&
|
||||
logic.commentTopBanners.isNotEmpty;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: CommentItem(
|
||||
key: ValueKey(logic.comments[index].id),
|
||||
logic.comments[index],
|
||||
objId: objId,
|
||||
topBanners: showBanner ? logic.commentTopBanners : null,
|
||||
replyHandler: (comment, {reply}) => logic.readyReplyComment(comment, replyModel: reply),
|
||||
topBanners:
|
||||
showBanner ? logic.commentTopBanners : null,
|
||||
replyHandler: (comment, {reply}) =>
|
||||
logic.readyReplyComment(comment,
|
||||
replyModel: reply),
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -114,7 +123,8 @@ class CommentView extends StatelessWidget {
|
||||
Obx(
|
||||
() => CommentFootView(
|
||||
isSending: logic.isSendingMsg.value,
|
||||
onComment: (isSend) => logic.readyReplyComment(null, isSend: isSend),
|
||||
onComment: (isSend) =>
|
||||
logic.readyReplyComment(null, isSend: isSend),
|
||||
textCtr: logic.commentController,
|
||||
imgPath: logic.selectedImagePath.value,
|
||||
onImgChange: (value) => logic.selectedImagePath.value = value,
|
||||
|
||||
@@ -4,14 +4,14 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:image_pickers/image_pickers.dart';
|
||||
import 'package:hgmj/assets_tool/app_colors.dart';
|
||||
import 'package:hgmj/assets_tool/images.dart';
|
||||
import 'package:hgmj/hj_model/video_model.dart';
|
||||
import 'package:hgmj/hj_utils/screen.dart';
|
||||
import 'package:hgmj/tools_base/widget/group_text_filed.dart';
|
||||
import 'package:wydj/assets_tool/app_colors.dart';
|
||||
import 'package:wydj/assets_tool/images.dart';
|
||||
import 'package:wydj/hj_model/video_model.dart';
|
||||
import 'package:wydj/hj_utils/screen.dart';
|
||||
import 'package:wydj/tools_base/widget/group_text_filed.dart';
|
||||
|
||||
import '../../../hj_utils/api_service/mine_service.dart';
|
||||
import 'package:hgmj/tools_base/toast.dart';
|
||||
import 'package:wydj/tools_base/toast.dart';
|
||||
import '../../mine/collec_history_buy/col_his_buy_sub_page.dart';
|
||||
|
||||
/// 底部评论条:假输入框 + 选图 + 收藏 + 发送
|
||||
@@ -50,7 +50,8 @@ class _CommentFootViewState extends State<CommentFootView> {
|
||||
selectCount: 1,
|
||||
showCamera: false,
|
||||
);
|
||||
if (listMedia.isNotEmpty) widget.onImgChange?.call(listMedia.first.path ?? '');
|
||||
if (listMedia.isNotEmpty)
|
||||
widget.onImgChange?.call(listMedia.first.path ?? '');
|
||||
if (mounted) setState(() {});
|
||||
}
|
||||
|
||||
@@ -60,7 +61,8 @@ class _CommentFootViewState extends State<CommentFootView> {
|
||||
try {
|
||||
final preCollect = isCollect;
|
||||
|
||||
await MineService.postCollect(widget.video?.id, LoadDataType.post.apiType, !isCollect);
|
||||
await MineService.postCollect(
|
||||
widget.video?.id, LoadDataType.post.apiType, !isCollect);
|
||||
|
||||
if (!preCollect) {
|
||||
widget.video?.collectCount = (widget.video?.collectCount ?? 0) + 1;
|
||||
@@ -82,100 +84,106 @@ class _CommentFootViewState extends State<CommentFootView> {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.black,
|
||||
padding: EdgeInsets.only(left: 18.w, right: 18.w, bottom: screen.paddingBottom),
|
||||
padding: EdgeInsets.only(
|
||||
left: 18.w, right: 18.w, bottom: screen.paddingBottom),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: SizedBox(
|
||||
height: 58,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => widget.onComment(false),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 2),
|
||||
child: GroupTextFiled(
|
||||
controller: widget.textCtr,
|
||||
height: 32,
|
||||
enabled: false,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
textStyle: TextStyle(color: Colors.white, fontSize: 14),
|
||||
placeholder: '请在此输入评论...',
|
||||
placeholderTextStyle: TextStyle(color: Color(0xff525252), fontSize: 14),
|
||||
decoration: BoxDecoration(color: Colors.white.withValues(alpha: .1), borderRadius: BorderRadius.circular(16)),
|
||||
children: [
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => widget.onComment(false),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 2),
|
||||
child: GroupTextFiled(
|
||||
controller: widget.textCtr,
|
||||
height: 32,
|
||||
enabled: false,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
textStyle: TextStyle(color: Colors.white, fontSize: 14),
|
||||
placeholder: '请在此输入评论...',
|
||||
placeholderTextStyle:
|
||||
TextStyle(color: Color(0xff525252), fontSize: 14),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: .1),
|
||||
borderRadius: BorderRadius.circular(16)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
12.sizeBoxW,
|
||||
Stack(
|
||||
children: [
|
||||
12.sizeBoxW,
|
||||
Stack(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.fromLTRB(0, 4, 4, 4),
|
||||
width: 30,
|
||||
height: 30,
|
||||
alignment: Alignment.center,
|
||||
child: GestureDetector(
|
||||
onTap: _pickImage,
|
||||
child: widget.imgPath?.isNotEmpty == true
|
||||
? Image.file(
|
||||
File(widget.imgPath!),
|
||||
width: 30,
|
||||
height: 30,
|
||||
fit: BoxFit.cover,
|
||||
)
|
||||
: Image.asset(
|
||||
'icon_pic.webp'.commentPath,
|
||||
width: 24,
|
||||
height: 24,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (widget.imgPath?.isNotEmpty == true)
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: 0,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
widget.onImgChange?.call(null);
|
||||
setState(() {});
|
||||
},
|
||||
child: Image.asset(
|
||||
"close_grey.png".commonImgPath,
|
||||
width: 12,
|
||||
height: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (widget.showCollect)
|
||||
Container(
|
||||
margin: EdgeInsets.fromLTRB(0, 4, 4, 4),
|
||||
width: 30,
|
||||
height: 30,
|
||||
alignment: Alignment.center,
|
||||
child: GestureDetector(
|
||||
onTap: _pickImage,
|
||||
child: widget.imgPath?.isNotEmpty == true
|
||||
? Image.file(
|
||||
File(widget.imgPath!),
|
||||
width: 30,
|
||||
height: 30,
|
||||
fit: BoxFit.cover,
|
||||
)
|
||||
: Image.asset(
|
||||
'icon_pic.webp'.commentPath,
|
||||
width: 24,
|
||||
height: 24,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (widget.imgPath?.isNotEmpty == true)
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: 0,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
widget.onImgChange?.call(null);
|
||||
setState(() {});
|
||||
},
|
||||
child: Image.asset(
|
||||
"close_grey.png".commonImgPath,
|
||||
width: 12,
|
||||
height: 12,
|
||||
),
|
||||
child: InkWell(
|
||||
enableFeedback: false,
|
||||
onTap: _onCollect,
|
||||
child: Image.asset(
|
||||
isCollect
|
||||
? "collect_red.png".commonImgPath
|
||||
: "collect_path.png".commonImgPath,
|
||||
width: 24,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (widget.showCollect)
|
||||
Container(
|
||||
),
|
||||
SizedBox(
|
||||
width: 30,
|
||||
height: 30,
|
||||
alignment: Alignment.center,
|
||||
child: InkWell(
|
||||
enableFeedback: false,
|
||||
onTap: _onCollect,
|
||||
child: Image.asset(
|
||||
isCollect ? "collect_red.png".commonImgPath : "collect_path.png".commonImgPath,
|
||||
width: 24,
|
||||
),
|
||||
child: GestureDetector(
|
||||
onTap: () => widget.onComment(true),
|
||||
child: widget.isSending
|
||||
? CupertinoActivityIndicator(
|
||||
color: AppColors.actionRed,
|
||||
radius: 12,
|
||||
)
|
||||
: Image.asset('ic_send.webp'.commentPath),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 30,
|
||||
height: 30,
|
||||
child: GestureDetector(
|
||||
onTap: () => widget.onComment(true),
|
||||
child: widget.isSending
|
||||
? CupertinoActivityIndicator(
|
||||
color: AppColors.actionRed,
|
||||
radius: 12,
|
||||
)
|
||||
: Image.asset('ic_send.webp'.commentPath),
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hgmj/hj_model/comment/comment_model.dart';
|
||||
import 'package:hgmj/routers/jump_router.dart';
|
||||
import 'package:wydj/hj_model/comment/comment_model.dart';
|
||||
import 'package:wydj/routers/jump_router.dart';
|
||||
|
||||
/// 评论正文:命中搜索词时把该词渲染成可点的橙色链接,其余按纯文本
|
||||
class CommentRichText extends StatelessWidget {
|
||||
@@ -13,8 +13,11 @@ class CommentRichText extends StatelessWidget {
|
||||
const style = TextStyle(color: Color(0xE5FFFFFF), fontSize: 14);
|
||||
final keyword = model?.searchKeyword ?? "";
|
||||
//按关键词切开,段与段之间插链接;切不出两段就当纯文本
|
||||
final parts = keyword.isEmpty ? <String>[] : (model?.content?.split(keyword) ?? []);
|
||||
if (model?.linkStr?.isNotEmpty != true || keyword.isEmpty || parts.length <= 1) {
|
||||
final parts =
|
||||
keyword.isEmpty ? <String>[] : (model?.content?.split(keyword) ?? []);
|
||||
if (model?.linkStr?.isNotEmpty != true ||
|
||||
keyword.isEmpty ||
|
||||
parts.length <= 1) {
|
||||
return Text(model?.content ?? '', style: style);
|
||||
}
|
||||
return Text.rich(
|
||||
@@ -29,7 +32,8 @@ class CommentRichText extends StatelessWidget {
|
||||
onTap: () => pushToPageByLink(model?.linkStr),
|
||||
child: Text(
|
||||
keyword,
|
||||
style: const TextStyle(color: Color(0xffF68804), fontSize: 14, height: 1.2),
|
||||
style: const TextStyle(
|
||||
color: Color(0xffF68804), fontSize: 14, height: 1.2),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hgmj/hj_model/banner/comment_top_banner_model.dart';
|
||||
import 'package:hgmj/hj_model/video_model.dart';
|
||||
import 'package:hgmj/routers/jump_router.dart';
|
||||
import 'package:hgmj/tools_base/banner/ads_banner.dart';
|
||||
import 'package:hgmj/tools_base/widget/card_swiper/src/swiper.dart';
|
||||
import 'package:hgmj/tools_base/widget/net_image_widget.dart';
|
||||
import 'package:wydj/hj_model/banner/comment_top_banner_model.dart';
|
||||
import 'package:wydj/hj_model/video_model.dart';
|
||||
import 'package:wydj/routers/jump_router.dart';
|
||||
import 'package:wydj/tools_base/banner/ads_banner.dart';
|
||||
import 'package:wydj/tools_base/widget/card_swiper/src/swiper.dart';
|
||||
import 'package:wydj/tools_base/widget/net_image_widget.dart';
|
||||
|
||||
/// 评论区置顶评论下方 Banner:支持多图轮播(含 GIF),按 linkType 跳转内外链
|
||||
class CommentTopBanner extends StatefulWidget {
|
||||
final List<CommentTopBannerModel> banners;
|
||||
final double borderRadius;
|
||||
|
||||
/// 宽高比,默认对齐站内 Banner 素材 720×150;勿用固定高度,窄/宽屏 cover 会裁切
|
||||
final double aspectRatio;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user