gpt4 book ai didi

flutter - 文本格式字段中的内联平面按钮

转载 作者:行者123 更新时间:2023-12-03 03:04:52 25 4
gpt4 key购买 nike

enter image description here

尝试在textform字段中添加一个flatbutton,以下是当前字段实现的代码,

TextFormField(
textAlign: TextAlign.left,
obscureText: true,
cursorColor: Colors.white,
onChanged: (value) {
//Do something with the user input.
password = value;
},
style: TextStyle(color: Colors.white),
decoration: InputDecoration(
icon: Icon(Icons.help, color: Colors.white, ),
// contentPadding: EdgeInsets.fromLTRB(20, 20, 20, 20),
labelText: 'Enter your password',
labelStyle: TextStyle(color: Colors.white),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white)),
),
),

有人可以协助您按照上述屏幕截图添加此内容。

最佳答案

只需在suffixIcon实现中添加InputDecoration属性,并将FlatButton小部件传递给它即可。下面的示例代码:

decoration: InputDecoration(
icon: Icon(Icons.help, color: Colors.black, ),
// contentPadding: EdgeInsets.fromLTRB(20, 20, 20, 20),
labelText: 'Enter your password',
labelStyle: TextStyle(color: Colors.black),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.black)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.black)),
suffixIcon: FlatButton(
child: Text('Need Help?'),
onPressed: () {},
)
),

enter image description here

关于flutter - 文本格式字段中的内联平面按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58874426/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com