postCommentsWidget static method

Widget postCommentsWidget(
  1. BuildContext context,
  2. ARMOYUServices service,
  3. Comment comment, {
  4. required Function deleteFunction,
  5. required Function profileFunction,
})

Implementation

static Widget postCommentsWidget(
    BuildContext context, ARMOYUServices service, Comment comment,
    {required Function deleteFunction, required Function profileFunction}) {
  final controller = Get.put(
      PostCommentsController(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();
              },
              child: CircleAvatar(
                backgroundColor: Colors.transparent,
                foregroundImage: CachedNetworkImageProvider(
                  controller
                      .xcomment!.value!.user.avatar!.mediaURL.minURL.value,
                ),
                radius: 20,
              ),
            ),
          ],
        ),
      ),
      title: Text(controller.xcomment!.value!.user.displayName!.value),
      subtitle: Text(controller.xcomment!.value!.content),
      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!.user.userID,
              child: IconButton(
                onPressed: () async => ARMOYUWidget.showConfirmationDialog(
                  context,
                  accept: () {
                    controller.removeComment(deleteFunction);
                  },
                ),
                icon: const Icon(
                  Icons.delete,
                  color: Colors.grey,
                ),
              ),
            ),
          ),
        ],
      ),
    ),
  );
}