答案 0 :(得分:0)
只需在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: () {},
)
),
答案 1 :(得分:0)
尽管@Drashan答案是正确的,但是如果有人只在重点关注时需要显示“需要帮助”,请尝试
TextFormField(
controller: messageController,
decoration: InputDecoration(
labelText: 'Message*',
suffix: InkWell(onTap:(){},child: Text('Need Help?',style:
TextStyle(color: Colors.black,fontSize: 14),)),
),
keyboardType: TextInputType.multiline,
),
关注
不专心