How to change selected value text color in DropdownButtonFormField?

Advertisements

I am using dropdownbuttonformfield for creating dropdown. I need to change selected value text color white and dropdown items text color should be black as shown in image. I need to change color for image 1.
image 1

image 2

>Solution :

selectedItemBuilder: (context) {
    final List<DropdownMenuItem<String>> list = [];
    for (int i = 0; i < tpoicList.lenght; i++) {
      list.add(DropdownMenuItem<String>(
        value: tpoicList[i],
        child: Container(
          child: Text(
            value,
            style: i == dropdownValue? 
            [YourNewTextStyle],
            const TextStyle(color: Colors.black),
          ),
        ),
      ));
    }
    return list;
  },

Leave a ReplyCancel reply