import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:ftc_mobile_app/utilities/custom_app_colors.dart'; import 'package:get/get.dart'; import 'custom_text_widget.dart'; class RadioButton extends StatelessWidget { final String value; final Rx selectedOption; final bool isEnabled; const RadioButton({ super.key, required this.value, required this.selectedOption, this.isEnabled = true, }); @override Widget build(BuildContext context) { return InkWell( onTap: () { selectedOption(value); }, child: Row( mainAxisSize: MainAxisSize.min, children: [ Ink( width: 32.r, height: 32.r, child: Obx(() { return Radio( value: value, groupValue: selectedOption(), onChanged: selectedOption, fillColor: MaterialStateProperty.resolveWith((states) { if (!isEnabled) return CustomAppColors.kLightGreyColor; if (states.contains(MaterialState.selected)) { return CustomAppColors.kSecondaryColor; } return Colors.black; }), ); }), ), CustomTextWidget( text: value, isExpanded: false, fontSize: 14.sp, fontWeight: FontWeight.w400, fontColor: isEnabled ? Colors.black : CustomAppColors.kLightGreyColor, ) ], ), ); } }