imageComment method
dynamic
imageComment(
{
})
Implementation
imageComment(
{String? postId,
required String userId,
required List<Media> list}) async {
try {
List<String> imagePaths = [];
if (list.isNotEmpty) {
list.forEach((element) {
imagePaths.add(element.path);
});
}
if (replyYes) {
var subComment = SubCommentDTO(
postId: '$postId',
commentedBy: "commentedBy",
userId: "XXXXX-001",
userDispalyName: "KM",
commentedDate: DateTime.now(),
comment: textController.text,
commentImgUrl: imagePaths,
commentLikeCounts: getEmojiesForLike(),
likesUsers: [],
tagTo: '@${replyTo}',
);
listOfComments[mainCommnetId].replies.add(subComment);
changCommentState();
} else {
var mainComment = CommentDTO(
postId: '$postId',
commentedBy: "Login User",
userId: "Login User Id",
userDispalyName: "SA",
commentedDate: DateTime.now(),
comment: textController.text,
commentImgUrl: imagePaths,
commentLikeCounts: getEmojiesForLike(),
replies: [],
likesUsers: [],
);
listOfComments.add(mainComment);
changCommentState();
}
} catch (e) {
changCommentState();
}
}