I have a Radio
and I want to disable it with a condition, like:
if (enabled == true){
*enable radio button*
} else {
*disable radio button*
}
EDIT
I'll add the complete code of my class because I only added a portion of it.
Here is the complete code:
import 'package:flutter/material.dart';
class RadioButton extends StatelessWidget {
final String label;
final int groupValue;
final int value;
final ValueChanged<int> onChanged;
const RadioButton(
{super.key,
required this.label,
required this.groupValue,
required this.value,
required this.onChanged});
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: Row(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: Radio<int>(
groupValue: groupValue,
value: value,
onChanged: (int? newValue) {
onChanged(newValue!);
}),
),
Text(label),
],
),
),
],
),
],
);
}
}