简体   繁体   English

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

[英]How to add different textstyle for dropdownmenuitem and item selected in dropdown in flutter?

I am new application development.我是新的应用程序开发。 How can I add individual textstyles for a dropdown in flutter like i need to add black textcolor for dropdownmenuitems and white textcolor for the selected value in dropdown ?如何为颤动中的下拉列表添加单独的文本样式,就像我需要为下拉菜单项添加黑色文本颜色和为下拉列表中的选定值添加白色文本颜色一样?

You should be use :你应该使用:

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,
        fontSize: 15,
      ),
        textAlign: TextAlign.center,
    ),
),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM