import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:get/get.dart';
import 'package:percent_indicator/linear_percent_indicator.dart';
import 'package:taafee_mobile/common/const/const.dart';
import 'package:taafee_mobile/common/widgets/listview.dart';
import 'package:taafee_mobile/common/widgets/text.dart';

class ViewRatingsWidget extends StatelessWidget {
  const ViewRatingsWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        Column(
          children: [
            Container(
              alignment: Alignment.center,
              width: 75,
              height: 75,
              decoration: BoxDecoration(
                color: AppColors.primeColor,
                shape: BoxShape.circle,
              ),
              child: const BoldTextWidget(
                "5.0",
                fontSize: 24,
                color: Colors.white,
              ),
            ),
            RatingBar.builder(
              itemSize: 15,
              initialRating: 3.5,
              minRating: 1,
              direction: Axis.horizontal,
              allowHalfRating: true,
              itemCount: 5,
              itemPadding: const EdgeInsets.symmetric(horizontal: 2),
              itemBuilder: (context, _) => const Icon(
                Icons.star,
                color: Colors.amber,
              ),
              onRatingUpdate: (rating) {
                print(rating);
              },
              ignoreGestures: true,
            )
          ],
        ).paddingSymmetric(horizontal: 10),
        Expanded(
          child: Container(
            child: ListViewWidget(
              itemCount: 5,
              childBuilder: (index) {
                return Row(
                  children: [
                    Container(
                      width: 30,
                      alignment: Alignment.center,
                      child: RegularTextWidget(
                        (index + 1).toString(),
                      ),
                    ),
                    Expanded(
                      child: LinearPercentIndicator(
                        key: UniqueKey(),
                        animation: true,
                        // lineHeight: 10,
                        animationDuration: 600,
                        percent: 1,
                        backgroundColor: Colors.red,
                        progressColor: Colors.blue,
                      ),
                    ),
                  ],
                );
              },
            ),
          ),
        ),
      ],
    ).paddingSymmetric(horizontal: 10, vertical: 10);
  }
}
