如何在图标和文本放置在右侧的同时使用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),
),
)发布于 2018-06-25 12:22:57
添加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),
),
)发布于 2022-08-07 11:55:50
您可以同时使用direction和align
TextFormField(
textAlign: TextAlign.right,
textDirection: TextDirection.rtl,https://stackoverflow.com/questions/51020120
复制相似问题