【问题标题】:How to add different textstyle for dropdownmenuitem and item selected in dropdown in flutter?如何为下拉菜单中的下拉菜单和颤动中选择的项目添加不同的文本样式?
【发布时间】:2021-10-03 03:42:30
【问题描述】:

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

【问题讨论】:

标签: flutter dart drop-down-menu text-styling flutter-dropdownbutton


【解决方案1】:

你应该使用:

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,
    ),
),

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-02-06
    • 1970-01-01
    • 2021-09-05
    • 1970-01-01
    • 1970-01-01
    • 2021-01-28
    • 2018-02-16
    • 1970-01-01
    相关资源
    最近更新 更多