问题描述
我希望DropdownButton提示和项(文本)具有与TextField小部件中的标签相同的TextStyle。就我而言,下拉项如下-
DropdownMenuItem<String>(
value: value,child: Text(value),);
// where the value is a String
解决方法
您可以将DropDownButton
提示中的Theme.of(context).inputDecorationTheme.labelStyle
和项目设置为:
Text(
'sample text',style: Theme.of(context).inputDecorationTheme.labelStyle,)
示例:
Float