defaultCommentList static method

Widget defaultCommentList(
  1. List<CommentModel> comments,
  2. String commentSectionID,
  3. {double maxHeight = double.infinity,
  4. Color backgroundColor = Colors.transparent}
)

A default builder for a list of comments. Height and color can be set.

Implementation

static Widget defaultCommentList(
  List<CommentModel> comments,
  String commentSectionID, {
  double maxHeight = double.infinity,
  Color backgroundColor = Colors.transparent,
}) {
  return AnimatedSize(
    duration: const Duration(milliseconds: 400),
    alignment: Alignment.topCenter,
    curve: Curves.easeInOutQuad,
    child: Container(
      color: backgroundColor,
      constraints: BoxConstraints(maxHeight: maxHeight),
      child: ListView.builder(
        primary: false,
        shrinkWrap: true,
        itemCount: comments.length,
        itemBuilder: (_, index) => CommentTile(
          commentSectionID,
          key: ValueKey(comments[index].commentID),
          comment: comments[index],
        ),
      ),
    ),
  );
}