Flutter中TextField中标签的默认TextStyle是什么?

问题描述

我希望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

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...