import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';

class TitleCheckBox extends StatelessWidget {
  const TitleCheckBox({
    super.key,
    this.selectedColor,
    this.unSelectedColor,
    required this.title,
    required this.isSelected,
    required this.onChanged,
  });

  final Color? selectedColor;
  final Color? unSelectedColor;
  final String title;
  final bool isSelected;
  final Function(bool?) onChanged;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        onChanged(!isSelected);
      },
      child: Row(
        children: [
          Checkbox(
            value: isSelected,
            onChanged: onChanged,
            activeColor: selectedColor ?? AppColor.blueNormal,
            visualDensity: VisualDensity.compact,
            side: BorderSide(width: 1.w, color: AppColor.unselectTextColor),
          ),
          Text(
            title,
            style: isSelected
                ? AppFonts.yekan14Bold.copyWith(color: AppColor.blueNormal)
                : AppFonts.yekan12.copyWith(color: AppColor.unselectTextColor),
          ),
        ],
      ),
    );
  }
}
