import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:proxibuy/core/gen/assets.gen.dart';
import 'package:proxibuy/data/models/comment_model.dart';
import 'package:proxibuy/presentation/widgets/user_comment_card.dart';

class CommentsSection extends StatelessWidget {
  final List<CommentModel> comments;

  const CommentsSection({super.key, required this.comments});

  @override
  Widget build(BuildContext context) {
    if (comments.isEmpty) {
      return const SizedBox.shrink();
    }

    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        SizedBox(height: 10,),
        Row(
          children: [
            SvgPicture.asset(Assets.icons.line2.path),
            const SizedBox(width: 8),
            const Text('نظرات کاربران', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
          ],
        ),
        ListView.builder(
          shrinkWrap: true,
          physics: const NeverScrollableScrollPhysics(),
          itemCount: comments.length,
          itemBuilder: (context, index) {
            return UserCommentCard(comment: comments[index]);
          },
        ),
      ],
    );
  }
}