【发布时间】:2020-08-26 17:11:25
【问题描述】:
我希望 DropdownButton 提示和项目(文本)的 TextStyle 与 TextField 小部件中的标签相同。就我而言,下拉项如下 -
DropdownMenuItem<String>(
value: value,
child: Text(value),
);
// where the value is a String
【问题讨论】:
我希望 DropdownButton 提示和项目(文本)的 TextStyle 与 TextField 小部件中的标签相同。就我而言,下拉项如下 -
DropdownMenuItem<String>(
value: value,
child: Text(value),
);
// where the value is a String
【问题讨论】:
您可以将DropDownButton 提示和项目的style 设置为:
Theme.of(context).inputDecorationTheme.labelStyle
例子:
Text(
'sample text',
style: Theme.of(context).inputDecorationTheme.labelStyle,
)
【讨论】: