import 'package:easy_localization/easy_localization.dart' show tr, StringTranslateExtension;
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/appointemnet_filters.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
import 'package:smooth_corner/smooth_corner.dart';

class AppointmentFilters extends StatelessWidget {
  final AppointmentListingFilters item;
  final List<AppointmentListingFilters>? selectedFilter;
  final VoidCallback onClicked;

  const AppointmentFilters(
      {super.key,
      required this.item,
      required this.onClicked,
      required this.selectedFilter});

  @override
  Widget build(BuildContext context) {
    return AppCustomChipWidget(
        backgroundColor:  selectedFilter?.contains(item) == true?AppColors.chipSecondaryLightRedColor:AppColors.whiteColor,
        icon: item.leadingIcon,
        textColor: selectedFilter?.contains(item) == true
            ? AppColors.chipPrimaryRedBorderColor: AppColors.blackColor,
        labelText: item.labelText.isNotEmpty?item.labelText.tr():"",
        iconHasColor: true,
        iconColor: selectedFilter?.contains(item) == true
            ? AppColors.chipPrimaryRedBorderColor:AppColors.blackColor,
        iconSize: 16,
        deleteIcon: item.trailingIcon,
        labelPadding: EdgeInsetsDirectional.only(start: 8.h, end: 0.h),
        padding: EdgeInsets.symmetric(vertical: 12.h, horizontal: 8.h),
        deleteIconSize: Size(18.h, 18.h),
        shape: SmoothRectangleBorder(
          borderRadius: BorderRadius.circular(10.h),
          smoothness: 10.h,
          side: BorderSide(
              color: selectedFilter?.contains(item) == true
                  ? AppColors.chipPrimaryRedBorderColor
                  : AppColors.borderGrayColor,
              width: 1),
        )).onPress(onClicked);
  }
}
