如何放置变化的Flutter TextFormField前缀图标?

时间:2020-04-04 16:21:08

标签: flutter

我试图更改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,
  ),
)

enter image description here

1 个答案:

答案 0 :(得分:0)

prefixIcon: Padding(
                        padding: EdgeInsetsDirectional.only(start: 20),
                        child: Image.asset(
                          "assets/images/user-form-icon.svg",
                        ), // myIcon is a 48px-wide widget.
                      ),

这可以尝试您想要的吗?或者您可以使用

prefix: Container () directly