在图标和文本位于右侧的情况下如何使用TextFormField小部件?
我当前正在使用以下代码:
new TextFormField(
obscureText: obscure,
style: const TextStyle(
color: Colors.white,
),
decoration: new InputDecoration(
icon: new Icon(
icon,
color: Colors.white,
),
border: InputBorder.none,
hintText: hint,
hintStyle: const TextStyle(color: Colors.white, fontSize: 15.0),
contentPadding: const EdgeInsets.only(
top: 30.0, right: 30.0, bottom: 30.0, left: 5.0),
),
)
答案 0 :(得分:1)
添加textAligin:TextAlign.end并使用suffixIcon
new TextFormField(
textAlign: TextAlign.end,
obscureText: obscure,
style: const TextStyle(
color: Colors.white,
),
decoration: new InputDecoration(
suffixIcon: new Icon(
icon,
color: Colors.white,
),
border: InputBorder.none,
hintText: hint,
hintStyle: const TextStyle(color: Colors.white, fontSize: 15.0),
contentPadding: const EdgeInsets.only(
top: 30.0, right: 30.0, bottom: 30.0, left: 5.0),
),
)