Flutter-如何查看TextFormField的前缀,即使没有按下

问题描述 投票:0回答:1

我是不熟悉Flutter的人,即使没有按下,我也想在textformfield中查看前缀文本。我的代码:

TextFormField(
 decoration: InputDecoration(
   prefix: Text("Subject: ",
     style: TextStyle(color: Colors.black),),
   hintText: "Unique Subject",
   border: OutlineInputBorder(),
),

对不起img链接,我对stackoverflow还是陌生的,至今还没有达到10个声誉。

这是我的结果:

Result

这是我想要的,甚至没有按下textformfield

Output

谢谢

flutter dart flutter-layout
1个回答
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(),
© www.soinside.com 2019 - 2024. All rights reserved.