我是扑朔迷离的新手,即使没有按下,我也想在textformfield中查看前缀文本。 我的代码:
TextFormField(
decoration: InputDecoration(
prefix: Text("Subject: ",
style: TextStyle(color: Colors.black),),
hintText: "Unique Subject",
border: OutlineInputBorder(),
),
对不起img链接,我对stackoverflow还是陌生的,仍然没有达到10个声誉。
这是我的结果:
这就是我想要的,甚至没有按下textformfield
谢谢
答案 0 :(得分:0)
有很少的解决方法。 要了解更多信息,请参考:https://github.com/flutter/flutter/issues/19488
prefixIcon: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: Text('Subject:',style: TextStyle(color: Colors.black),),
)
],),
hintText: "Unique Subject",
border: OutlineInputBorder(),