【发布时间】:2020-08-26 16:08:33
【问题描述】:
我需要为 TextField() 的 labelText 设置两种不同的颜色。我有一个实现 TextField 的功能请求,其标题将显示为“必需*”,但我需要为标签文本设置两种不同的颜色,例如“必需”为绿色,仅“*”为红色。
TextField(
controller: _controller,
decoration: new InputDecoration(
hintText: 'Search here',
labelStyle: TextStyle(),
labelText: 'Required*' //make 'Required' green and '*' red color
),
onChanged: (str) {
//need to implement debounce
}
)
【问题讨论】:
-
我认为flutter现在不支持它,你必须为它创建一个自定义小部件
标签: flutter textfield text-styling