Commit 580c14bb authored by Fikri's avatar Fikri

menambahkan consume api contact us dan send email di halaman public contact us

parent 6c281611
...@@ -260,8 +260,8 @@ class ContactUs2 extends StatelessWidget { ...@@ -260,8 +260,8 @@ class ContactUs2 extends StatelessWidget {
if (_formKey.currentState!.validate()) { if (_formKey.currentState!.validate()) {
final response = await sendEmail( final response = await sendEmail(
nameController.value.text, nameController.value.text,
emailController.value.text,
phoneController.value.text, phoneController.value.text,
emailController.value.text,
messageController.value.text); messageController.value.text);
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
response == 200 response == 200
...@@ -302,7 +302,7 @@ class ContactUs2 extends StatelessWidget { ...@@ -302,7 +302,7 @@ class ContactUs2 extends StatelessWidget {
final url = Uri.parse('https://api.emailjs.com/api/v1.0/email/send'); final url = Uri.parse('https://api.emailjs.com/api/v1.0/email/send');
const serviceId = 'service_7wwup8c'; const serviceId = 'service_7wwup8c';
const templateId = 'template_4u8rbur'; const templateId = 'template_4u8rbur';
const userId = 'bzSFpP9flgDHE1D8dDLOP'; const userId = 'fF4-BJSJ11O-S3J0Z';
final response = await http.post(url, final response = await http.post(url,
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
......
...@@ -277,9 +277,9 @@ class _ContactUs2_smallState extends State<ContactUs2_small> { ...@@ -277,9 +277,9 @@ class _ContactUs2_smallState extends State<ContactUs2_small> {
Future SendEmail( Future SendEmail(
String name, String phone, String email, String message) async { String name, String phone, String email, String message) async {
final url = Uri.parse('https://api.emailjs.com/api/v1.0/email/send'); final url = Uri.parse('https://api.emailjs.com/api/v1.0/email/send');
const serviceId = 'service_7wwup8c'; const serviceId = 'service_7wwup8c';
const templateId = 'template_4u8rbur'; const templateId = 'template_4u8rbur';
const userId = 'bzSFpP9flgDHE1D8dDLOP'; const userId = 'fF4-BJSJ11O-S3J0Z';
final response = await http.post(url, final response = await http.post(url,
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment