如何为下拉菜单项和颤动下拉列表中选择的项目添加不同的文本样式?

问题描述

我是新的应用程序开发者。如何为颤动中的下拉列表添加单独的文本样式,就像我需要为下拉菜单添加黑色文本颜色和为下拉列表中的选定值添加白色文本颜色一样?

解决方法

你应该使用:

DropdownButton(
//Use style for dropdown text color
   style: TextStyle(
   color: Colors.blue,fontSize: 15,),// use dropdownColor for color of flutter dropdown
  dropdownColor:Colors.green,//below is the hint of your dropdown
  hint: Text(
       'Select Month',style: TextStyle(
        color: Colors.black,textAlign: TextAlign.center,