import 'package:cs_resources/constants/color_constants.dart';
import 'package:cs_resources/generated/assets.dart';
import 'package:domain/entity/response/staff_review_history_s_g_entity.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:plugin_basic/basic_export.dart';
import 'package:widgets/ext/ex_widget.dart';
import 'package:widgets/my_text_view.dart';
import 'package:widgets/shatter/rating_widget.dart';

/**
 * 员工的评价记录
 */
class StaffReviewsItem extends StatelessWidget {
  final int index;
  final StaffReviewHistorySGReviews item;

  StaffReviewsItem({
    required this.index,
    required this.item,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(bottom: 25, left: 21,right: 21,top: 18.5),
      margin: EdgeInsets.only(left: 15, right: 15, top: 5, bottom: 5),
      decoration: BoxDecoration(
        color: Color(0xFF4DCFF6).withOpacity(0.2), // 设置背景颜色和不透明度
        borderRadius: BorderRadius.circular(5), // 设置圆角
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          MyTextView(
            item.employerName ?? "",
            isFontRegular: true,
            textColor: Colors.white,
            fontSize: 17,
          ),

          //态度评分
          Row(
            children: [
              MyTextView(
                "Attitude".tr,
                isFontRegular: true,
                textColor: ColorConstants.textGrayAECAE5,
                fontSize: 15,
              ).expanded(flex: 2),
              RatingWidget(
                nomalImage: Assets.baseServiceRatingUnselected,
                selectImage: Assets.baseServiceRatingSelected,
                size: 21,
                padding: 5,
                selectAble: false,
                integerOnly: true,
                value: item.attitudeRate,
                onRatingUpdate: (value) {},
              ).expanded(flex: 3)
            ],
          ).marginOnly(top: 15),

          //表现评分
          Row(
            children: [
              MyTextView(
                "Performance".tr,
                isFontRegular: true,
                textColor: ColorConstants.textGrayAECAE5,
                fontSize: 15,
              ).expanded(flex: 2),
              RatingWidget(
                nomalImage: Assets.baseServiceRatingUnselected,
                selectImage: Assets.baseServiceRatingSelected,
                size: 21,
                padding: 5,
                selectAble: false,
                integerOnly: true,
                value: item.performanceRate,
                onRatingUpdate: (value) {},
              ).expanded(flex: 3)
            ],
          ).marginOnly(top: 15),

          //经验评分
          Row(
            children: [
              MyTextView(
                "Experience".tr,
                isFontRegular: true,
                textColor: ColorConstants.textGrayAECAE5,
                fontSize: 15,
              ).expanded(flex: 2),
              RatingWidget(
                nomalImage: Assets.baseServiceRatingUnselected,
                selectImage: Assets.baseServiceRatingSelected,
                size: 21,
                padding: 5,
                selectAble: false,
                integerOnly: true,
                value: item.experienceRate,
                onRatingUpdate: (value) {},
              ).expanded(flex: 3)
            ],
          ).marginOnly(top: 15),

          //着装评分
          Row(
            children: [
              MyTextView(
                "Grooming".tr,
                isFontRegular: true,
                textColor: ColorConstants.textGrayAECAE5,
                fontSize: 15,
              ).expanded(flex: 2),
              RatingWidget(
                nomalImage: Assets.baseServiceRatingUnselected,
                selectImage: Assets.baseServiceRatingSelected,
                size: 21,
                padding: 5,
                selectAble: false,
                integerOnly: true,
                value: item.groomingRate,
                onRatingUpdate: (value) {},
              ).expanded(flex: 3)
            ],
          ).marginOnly(top: 15),

          MyTextView(
            item.feedback ?? "",
            textColor: Colors.white,
            fontSize: 15,
            isFontRegular: true,
            borderColor: Color(0XFF6D92BA),
            borderWidth: 0.5,
            boxHeight: 130,
            boxWidth: double.infinity,
            paddingTop: 15,
            paddingLeft: 12.5,
            paddingRight: 12.5,
            paddingBottom: 15,
            marginTop: 18,
          ),

        ],
      ),
    );
  }
}
