我希望DropdownButton提示和项(Text(的TextStyle与TextField小部件中标签的TextStyle相同。在我的情况下,下拉项如下-
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,
)