You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.5 KiB
Dart
50 lines
1.5 KiB
Dart
|
3 weeks ago
|
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: 20.h,
|
||
|
|
height: 20.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(weight: FontWeight.w500), // The provided content
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|