Checkbox(
onChanged: (bool value) {
setState(() {
isHighBloodDisease = value;
});
},
value: isHighBloodDisease,
),
this is my code and when i click the checkbox the check is not apper but when i close the dropDownList and reopen it the box i have choice is checked and I tryed to print the value and it works when i click it print true
return SizedBox(
height: 50,
width: 350,
child: DropdownButtonFormField(
iconSize: 50,
iconEnabledColor: white,
decoration: InputDecoration(
hintText: 'الامراض المزمنة',
hintStyle: TextStyle(
fontSize: 23, fontWeight: FontWeight.bold, color: white),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: white,
),
borderRadius: BorderRadius.circular(30.0),
),
),
items: [
DropdownMenuItem(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Text(
chronicDisease[0]['disease'],
style: textStyle,
),
Checkbox(
value: isHeartDisease,
onChanged: (bool value) {
setState(() {
isHeartDisease = value;
});
},
),
],
),
),
DropdownMenuItem(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Text(
chronicDisease[4]['disease'],
style: textStyle,
),
Checkbox(
onChanged: (bool value) {
setState(() {
isHighBloodDisease = value;
});
},
value: isHighBloodDisease,
),
],
),
)
].toList(),
onChanged: (value) {},
),
);
}
}