import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';

class CustomRadioOption<T> extends StatelessWidget {
  final T value;
  final T? groupValue;
  final ValueChanged<T?> onChanged;
  final String text;

  // final Widget child; // The content of your radio option (e.g., Text, Image)

  const CustomRadioOption(
      {super.key,
      required this.value,
      required this.groupValue,
      required this.onChanged,
      // required this.child,
      required this.text});

  @override
  Widget build(BuildContext context) {
    // bool isSelected = value == groupValue;
    bool isSelected = false;
    return InkWell(
      onTap: () => onChanged(value),
      child: Container(
        padding: EdgeInsets.all(8.h),
        child: Row(
          children: [
            Container(
              width: 18.h,
              height: 18.h,
              decoration: BoxDecoration(
                  shape: BoxShape.circle,
                  color: isSelected ? AppColors.primaryRedColor : AppColors.whiteColor,
                  border: Border.all(color: isSelected ? AppColors.primaryRedColor : AppColors.bottomNAVBorder, width: 2.h)),
            ),
            SizedBox(width: 8.h),
            text.toText16(isBold: true), // The provided content
          ],
        ),
      ),
    );
  }
}
