I want to add icon to left of DropDownButton
but can't find a way to do so.
What I want to achieve is like this:
I have tried following code but it places icon to right where I don't want it and it also overrides arrow icon:
`@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
margin: EdgeInsets.only(top: 64.0, left: 16.0, right: 16.0),
color: Colors.white,
child: DropdownButton(
icon: Icon(
Icons.person,
color: Colors.redAccent,
size: 20.09,
),
isExpanded: true,
items: _studentList.map((val) {
return DropdownMenuItem(
value: val,
child: Text(val),
);
}).toList(),
value: _currentSelectedItem,
onChanged: (value) {
setState(() {
_currentSelectedItem = value;
});
},
),
),
);
}`
Output of above code is like this:
I have also tried to place Icon()
and DropDownButton()
inside Row()
widget but that does not allow the DropDownButton()
to expand to full width.
Any help would be appreciated.
Thanks