如何在 TextFormField 中添加额外标签?

2024-01-09

有没有办法将“忘记密码”标签放置在 TextFormField 内?

在示例图片上输入忘记密码?就在输入里面

new TextFormField(
                    decoration: InputDecoration(labelText: 'Password',
                      labelStyle: TextStyle(
                        color: Colors.black87,
                        fontSize: 17,
                        fontFamily: 'AvenirLight'
                      ),
                      focusedBorder: UnderlineInputBorder(      
                        borderSide: BorderSide(color: Colors.purple),   
                      ),
                      enabledBorder: new UnderlineInputBorder(
                        borderSide: BorderSide(color: Colors.grey, 
                          width: 1.0)
                      ),
                    ),
                    style: TextStyle(
                      color: Colors.black87,
                      fontSize: 17,
                      fontFamily: 'AvenirLight'
                    ),
                    controller: _passwordController,
                    obscureText: true,
                  ),

use the Suffix:财产 -InputDecoration:

TextFormField(
            decoration: InputDecoration(
              suffix: GestureDetector(
                onTap: () {
                  print('tapped');
                },
                child: Text(
                  'Forgot Password?',
                  style: TextStyle(
                      color: Colors.blue, fontWeight: FontWeight.bold),
                ),
              ),
              labelText: 'Password',
              labelStyle: TextStyle(
                  color: Colors.black87,
                  fontSize: 17,
                  fontFamily: 'AvenirLight'),
              focusedBorder: UnderlineInputBorder(
                borderSide: BorderSide(color: Colors.purple),
              ),
              enabledBorder: new UnderlineInputBorder(
                  borderSide: BorderSide(color: Colors.grey, width: 1.0)),
            ),
            style: TextStyle(
                color: Colors.black87, fontSize: 17, fontFamily: 'AvenirLight'),
            //  controller: _passwordController,
            obscureText: true,
          ),
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在 TextFormField 中添加额外标签? 的相关文章

随机推荐