[英]How to position change flutter TextFormField prefix icon?
I have tried to change TextFormField prefix icon positions but I don't understand how to do it anyone has a any idea I'm used code as below我试图更改 TextFormField 前缀图标的位置,但我不明白该怎么做任何人都有任何想法我使用的代码如下
child: TextFormField( autocorrect: false, maxLines: 4, decoration: InputDecoration( border: new OutlineInputBorder( borderSide: new BorderSide( style: BorderStyle.solid)), hintStyle: TextStyle( color: Color.fromRGBO(0, 0, 0, 0.1)), prefixIcon: Icon(Icons.edit), hintText: "Onion 1kg", labelText: 'Item Description (Optional)', ), style: TextStyle( color: Color.fromRGBO(25, 25, 35, 1), fontSize:18, ), )
I think you are trying to change the icon position in your TextFormField
to right position, so just use suffixIcon: Icon(Icons.edit),
instead of prefixIcon: Icon(Icons.edit),
so your code will be come like below:我认为您正在尝试将
TextFormField
中的图标 position 更改为右 position,所以只需使用suffixIcon: Icon(Icons.edit),
而不是prefixIcon: Icon(Icons.edit),
因此您的代码将如下所示:
child: TextFormField(
autocorrect: false,
maxLines: 4,
decoration: InputDecoration(
border: new OutlineInputBorder(
borderSide: new BorderSide(
style: BorderStyle.solid)),
hintStyle: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.1)),
//prefixIcon: Icon(Icons.edit), // this is left side
suffixIcon: Icon(Icons.edit), // this is right side.
hintText: "Onion 1kg",
labelText: 'Item Description (Optional)',
),
style: TextStyle(
color: Color.fromRGBO(25, 25, 35, 1),
fontSize:18,
),
)
prefixIcon: Padding(
padding: EdgeInsetsDirectional.only(start: 20),
child: Image.asset(
"assets/images/user-form-icon.svg",
), // myIcon is a 48px-wide widget.
),
Does this try what you want?这会尝试你想要的吗? Or you can use
或者你可以使用
prefix: Container () directly
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.