postCommentsWidgetV2 static method
Widget
postCommentsWidgetV2(
})
Implementation
static Widget postCommentsWidgetV2(
BuildContext context,
ARMOYUServices service,
APIPostComments comment, {
required Function deleteFunction,
required Function({
required int userID,
required String username,
required String? displayname,
required Media? avatar,
required Media? banner,
}) profileFunction,
}) {
final controller = Get.put(
PostCommentsControllerV2(comment: comment, service: service),
tag: comment.commentID.toString());
final findCurrentAccountController = Get.find<AccountUserController>();
return Obx(
() => ListTile(
minLeadingWidth: 1.0,
minVerticalPadding: 5.0,
contentPadding: const EdgeInsets.all(0),
leading: SizedBox(
height: double.infinity,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
InkWell(
onTap: () {
profileFunction(
userID: controller.xcomment!.value!.postcommenter.userID,
username:
controller.xcomment!.value!.postcommenter.username,
avatar: Media(
mediaID: 0,
mediaType: MediaType.image,
mediaURL: MediaURL(
bigURL: Rx(
controller
.xcomment!.value!.postcommenter.avatar.bigURL,
),
normalURL: Rx(
controller
.xcomment!.value!.postcommenter.avatar.normalURL,
),
minURL: Rx(
controller
.xcomment!.value!.postcommenter.avatar.minURL,
),
),
),
banner: null,
displayname:
controller.xcomment!.value!.postcommenter.displayname,
);
},
child: CircleAvatar(
backgroundColor: Colors.transparent,
foregroundImage: CachedNetworkImageProvider(
controller.xcomment!.value!.postcommenter.avatar.minURL,
),
radius: 20,
),
),
],
),
),
title: Text(controller.xcomment!.value!.postcommenter.displayname),
subtitle: Text(controller.xcomment!.value!.commentContent),
trailing: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
GestureDetector(
onTap: () async {
await controller.likeunlikefunction();
},
child: Obx(
() => Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
controller.favoritestatus,
const SizedBox(height: 3),
CustomText.costum1(
controller.xcomment!.value!.likeCount.toString(),
weight: FontWeight.bold,
),
],
),
),
),
Obx(
() => Visibility(
visible: findCurrentAccountController
.currentUserAccounts.value.user.value.userID ==
controller.xcomment!.value!.postcommenter.userID,
child: IconButton(
onPressed: () async => ARMOYUWidget.showConfirmationDialog(
context,
accept: () {
controller.removeComment(deleteFunction);
},
),
icon: const Icon(
Icons.delete,
color: Colors.grey,
),
),
),
),
],
),
),
);
}