如何在 Flutter 中向 TextFormField 添加静态单元(文本)?

Nuq*_*uqo 2 textfield dart flutter

我目前有TextFormField一个hintText:

当前文本表单字段

目标是在 TextFormField 内添加单位,无论用户是否正在键入。它应该看起来像这样:

目标

如何实现这一目标?另外,如何将值居中?

这是我当前的 TextFormField 代码:

TextFormField(
  decoration: InputDecoration(
    hintText: '0.0',
    contentPadding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 5.0),
    filled: true,
    fillColor: Colors.white24,
    floatingLabelBehavior: FloatingLabelBehavior.never,
    border: OutlineInputBorder(
      borderRadius: BorderRadius.circular(10.0),
      borderSide: BorderSide.none,
    ),
    counterText: '',
  ),
),
Run Code Online (Sandbox Code Playgroud)

Pra*_*hik 8

装修TextFormField可以是suffixText房产

     TextFormField(
       controller: c,
       // align to center
       textAlign: TextAlign.center,
       decoration:  InputDecoration(
         hintText: '0.0',
         // show kg
         suffixText: 'Kg',
     )
Run Code Online (Sandbox Code Playgroud)

文本可以使用该textAlign属性居中