This is a dropdown list I have. How do I change the code to have a condition where if the user chooses an option it will give "valueChoose_f4" that chosen option else give "valueChoose_f4" the value that is stored in "M${widget.orgUnit}". Thanks, hope my question made sense.
ListTileTheme(
tileColor: Colors.white,
child: ListTile(
title: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(color: Colors.blueGrey),
borderRadius: BorderRadius.circular(10),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
isExpanded: true,
value: valueChoose_f4,
hint: Text('M${widget.orgUnit}'),
onChanged: (newValue){
setState(() {
valueChoose_f4 = newValue;
});
},
items: listUserType.map((map) {
return DropdownMenuItem<String>(
value: map['value'],
child: Text(map['name']),
);
}).toList(),
),
),
),
),
),
),