我试图在颤振网络中创建一个投资组合,然后我想添加一个联系人表格。我用的是EmailJS。当我点击“发送”按钮时,我会收到电子邮件,但它们是空白的.
我怎么才能解决这个问题?你能帮帮我吗?
这是我代码的一部分
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: TextField(
controller: messageController,
style: const TextStyle(color: Colors.white),
minLines: 10,
maxLines: 15,
decoration: const InputDecoration(
hintText: 'Enter Your Message',
hintStyle: TextStyle(color: Colors.grey),
border: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0xFF66FcF1),
),
),
contentPadding: EdgeInsets.all(10.0)),
),
),
Row(
children: [
Expanded(
child: OutlinedButton(
onPressed: () {
sendEmail(
email: '',
message: '',
name: '',
subject: '');
},
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text(
'Submit',
style: TextStyle(
color: Color(0xFF66FcF1),
fontSize: 16,
),
),
),
),
),
],
),
发布于 2022-04-11 10:03:14
你在发送空字符串
sendEmail(
email: '',
message: '',
name: '',
subject: '');
},
尝试使用TextFormField()。不要忘记,您必须为输入定义控制器才能获得字符串。然后它就能起作用了。
Form(
key: _formKey,
TextFormField(
controller: controllerMensagem,
validator: (value) {
if (value == null || value.isEmpty) {
return '*required';
}
return null;
},
),
),
https://stackoverflow.com/questions/71424539
复制相似问题