Commit 163106e3 authored by rizky ramadhan's avatar rizky ramadhan

forget

parent 3736c03c
import 'package:flutter/material.dart'; import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:medapp_eksad/widget/button_color.dart';
class ForgotPassword extends StatefulWidget { class ForgotPassword extends StatefulWidget {
const ForgotPassword({Key? key}) : super(key: key); const ForgotPassword({Key? key}) : super(key: key);
...@@ -9,9 +12,13 @@ class ForgotPassword extends StatefulWidget { ...@@ -9,9 +12,13 @@ class ForgotPassword extends StatefulWidget {
} }
class _ForgotPasswordState extends State<ForgotPassword> { class _ForgotPasswordState extends State<ForgotPassword> {
final formKey = GlobalKey<FormState>(); final formKey = GlobalKey<FormState>();
final _formKey = GlobalKey<FormState>();
String email = ''; String email = '';
final nameController = TextEditingController();
final phoneController = TextEditingController();
final emailController = TextEditingController();
final messageController = TextEditingController();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Stack( return Stack(
...@@ -24,39 +31,89 @@ class _ForgotPasswordState extends State<ForgotPassword> { ...@@ -24,39 +31,89 @@ class _ForgotPasswordState extends State<ForgotPassword> {
), ),
Padding( Padding(
padding: const EdgeInsets.all(21.0), padding: const EdgeInsets.all(21.0),
child: ElevatedButton(onPressed: (){ child: ElevatedButton(
Navigator.pushNamed(context, '/login'); onPressed: () {
}, child: Icon(Icons.arrow_back)), Navigator.pushNamed(context, '/login');
},
child: Icon(Icons.arrow_back)),
), ),
Center( Center(
child:AlertDialog( child: AlertDialog(
title: Text('Find your account'), title: Text('Find your account'),
content: Form( content: Form(
key: formKey, key: formKey,
child: TextFormField( child: TextFormField(
textAlign: TextAlign.start, textAlign: TextAlign.start,
decoration: InputDecoration( controller: emailController,
labelText: "Enter your email address", decoration: InputDecoration(
hintStyle: const TextStyle(), labelText: "Enter your email address",
border: OutlineInputBorder( hintStyle: const TextStyle(),
borderRadius: border: OutlineInputBorder(
BorderRadius.circular(5.0)), borderRadius: BorderRadius.circular(5.0)),
),
onChanged: (value) => email = value,
), ),
// onChanged: (value) => email = value,
), ),
actions: <Widget>[ ),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.pushNamed(context, 'dashboard');
},
child: const Text('Send'),
TextButton( // onPressed: () async {
onPressed: () { // if (_formKey.currentState!.validate()) {
Navigator.pushNamed(context, 'dashboard'); // final response = await SendEmail(
}, // nameController.value.text,
child: const Text('Send'), // phoneController.value.text,
), // emailController.value.text,
], // messageController.value.text);
) // ScaffoldMessenger.of(context).showSnackBar(
), // response == 200
// ? const SnackBar(
// content: Text('Message Sent!'),
// backgroundColor: Colors.green)
// : const SnackBar(
// content: Text('Failed to send message!'),
// backgroundColor: Colors.red),
// );
// nameController.clear();
// phoneController.clear();
// emailController.clear();
// messageController.clear();
// }
// },
// child: const Text('Send'),
),
],
)),
], ],
); );
} }
} }
// Future SendEmail(
// String name, String phone, String email, String message) async {
// final url = Uri.parse('https://api.emailjs.com/api/v1.0/email/send');
// const serviceId = 'service_wava70j';
// const templateId = 'template_koc73cj';
// const userId = 'h4BmDnyWlm3OziBDx';
// final response = await http.post(url,
// headers: {
// 'Content-Type': 'application/json'
// }, //This line makes sure it works for all platforms.
// body: json.encode({
// 'service_id': serviceId,
// 'template_id': templateId,
// 'user_id': userId,
// 'template_params': {
// 'from_name': name,
// 'from_phone': phone,
// 'to_email': email,
// 'message': message
// }
// }));
// return response.statusCode;
// }
\ No newline at end of file
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