postCommentSectionBuilder static method

CommentSectionWidgetBuilder postCommentSectionBuilder()

A builder for a comment section that is used for posts.

Implementation

static CommentSectionWidgetBuilder postCommentSectionBuilder() =>
    (context, commentSectionId, comments) => Column(
          mainAxisSize: MainAxisSize.min,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Padding(
              padding: const EdgeInsets.only(left: 16, bottom: 4, top: 8),
              child: Consumer(
                builder: (context, ref, _) {
                  // Display the number of comments
                  return Text(
                    t.comment.numberOfComments(
                      count: comments.asData?.value.length ?? 0,
                    ),
                    style: Theme.of(context).textTheme.labelMedium?.copyWith(
                          color:
                              Theme.of(context).colorScheme.onSurfaceVariant,
                        ),
                  );
                },
              ),
            ),
            if (comments.asData?.value != null)
              defaultCommentList(
                comments.asData!.value,
                commentSectionId,
                maxHeight: 200,
              ),
            CommentForm(commentSectionId),
          ],
        );