首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从右到左TextFormField

从右到左TextFormField
EN

Stack Overflow用户
提问于 2018-06-25 09:23:37
回答 2查看 4.2K关注 0票数 3

如何在图标和文本放置在右侧的同时使用TextFormField小部件?

我目前正在使用以下代码:

代码语言:javascript
复制
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),
    ),
)
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-06-25 12:22:57

添加textAligin: TextAlign.end并使用suffixIcon

代码语言:javascript
复制
 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),
    ),
)
票数 7
EN

Stack Overflow用户

发布于 2022-08-07 11:55:50

您可以同时使用directionalign

代码语言:javascript
复制
TextFormField(
  textAlign: TextAlign.right,
  textDirection: TextDirection.rtl,
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51020120

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档