Commit 81efd891 authored by Fikri's avatar Fikri
parents 5c18e929 8d8862f8
...@@ -4,7 +4,7 @@ import 'package:firebase_auth/firebase_auth.dart'; ...@@ -4,7 +4,7 @@ import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:form_field_validator/form_field_validator.dart'; import 'package:form_field_validator/form_field_validator.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:medapp_eksad/firebase/showSnackbar.dart'; import 'package:medapp_eksad/firebase/showSnackbar_Alertdialog.dart';
import 'package:medapp_eksad/widget/button_color.dart'; import 'package:medapp_eksad/widget/button_color.dart';
class ForgotPassword extends StatefulWidget { class ForgotPassword extends StatefulWidget {
......
...@@ -3,7 +3,7 @@ import 'package:firebase_auth/firebase_auth.dart'; ...@@ -3,7 +3,7 @@ import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:medapp_eksad/firebase/showOtpDialog.dart'; import 'package:medapp_eksad/firebase/showOtpDialog.dart';
import 'package:medapp_eksad/firebase/showSnackbar.dart'; import 'package:medapp_eksad/firebase/showSnackbar_Alertdialog.dart';
class FirebaseAuthMethods { class FirebaseAuthMethods {
final FirebaseAuth _auth; final FirebaseAuth _auth;
...@@ -55,7 +55,7 @@ class FirebaseAuthMethods { ...@@ -55,7 +55,7 @@ class FirebaseAuthMethods {
} else if (e.code == 'email-already-in-use') { } else if (e.code == 'email-already-in-use') {
print('The account already exists for that email.'); print('The account already exists for that email.');
} }
showSnackBar( showAlertError(
context, e.message!); // Displaying the usual firebase error message context, e.message!); // Displaying the usual firebase error message
} }
} }
...@@ -92,7 +92,7 @@ class FirebaseAuthMethods { ...@@ -92,7 +92,7 @@ class FirebaseAuthMethods {
Navigator.pushNamed(context, '/demo'); Navigator.pushNamed(context, '/demo');
} }
} on FirebaseAuthException catch (e) { } on FirebaseAuthException catch (e) {
showDialog(context: context, builder: (context) => AlertDialog(title: Text(e.message!,style: TextStyle(color: Colors.yellow),),backgroundColor: Colors.red,)); // Displaying the error message showAlertError(context, e.message!); // Displaying the error message
} }
} }
...@@ -100,9 +100,9 @@ class FirebaseAuthMethods { ...@@ -100,9 +100,9 @@ class FirebaseAuthMethods {
Future<void> sendEmailVerification(BuildContext context) async { Future<void> sendEmailVerification(BuildContext context) async {
try { try {
_auth.currentUser!.sendEmailVerification(); _auth.currentUser!.sendEmailVerification();
showSnackBar(context, 'Email verification sent! , Check your Inbox or Spam Email'); showAlert(context, 'Email verification sent! , Check your Inbox or Spam Email');
} on FirebaseAuthException catch (e) { } on FirebaseAuthException catch (e) {
showSnackBar(context, e.message!); // Display error message showAlertError(context, e.message!); // Display error message
} }
} }
......
import 'package:flutter/material.dart';
void showSnackBar(BuildContext context, String text) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(text),
),
);
}
import 'package:flutter/material.dart';
void showSnackBar(BuildContext context, String text) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(text),
backgroundColor: Colors.green,
),
);
}
void showSnackBarError(BuildContext context, String text) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(text),
backgroundColor: Colors.red,
),
);
}
void showAlert(BuildContext context, String isiAlert) {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(
isiAlert,
style: TextStyle(color: Colors.white),
),
backgroundColor: Colors.green,
));
}
void showAlertError(BuildContext context, String isiAlert) {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(
isiAlert,
style: TextStyle(color: Colors.yellow),
),
backgroundColor: Colors.red,
));
}
...@@ -119,6 +119,7 @@ class ContactUs2 extends StatelessWidget { ...@@ -119,6 +119,7 @@ class ContactUs2 extends StatelessWidget {
hintText: "Enter your Name", hintText: "Enter your Name",
fillColor: Colors.white, fillColor: Colors.white,
filled: true, filled: true,
errorStyle: TextStyle(color: Colors.white),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.zero, borderRadius: BorderRadius.zero,
borderSide: BorderSide(width: 1, color: Colors.white), borderSide: BorderSide(width: 1, color: Colors.white),
...@@ -130,7 +131,7 @@ class ContactUs2 extends StatelessWidget { ...@@ -130,7 +131,7 @@ class ContactUs2 extends StatelessWidget {
), ),
validator: (value) { validator: (value) {
if (value == null || value.isEmpty) { if (value == null || value.isEmpty) {
return 'Name cannot be empty!!!'; return 'Please enter your name';
} }
return null; return null;
}, },
...@@ -170,6 +171,7 @@ class ContactUs2 extends StatelessWidget { ...@@ -170,6 +171,7 @@ class ContactUs2 extends StatelessWidget {
hintText: "Enter a valid phone number", hintText: "Enter a valid phone number",
fillColor: Colors.white, fillColor: Colors.white,
filled: true, filled: true,
errorStyle: TextStyle(color: Colors.white),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.zero, borderRadius: BorderRadius.zero,
borderSide: borderSide:
...@@ -183,7 +185,7 @@ class ContactUs2 extends StatelessWidget { ...@@ -183,7 +185,7 @@ class ContactUs2 extends StatelessWidget {
), ),
validator: (value) { validator: (value) {
if (value == null || value.isEmpty) { if (value == null || value.isEmpty) {
return 'Phone cannot be empty!!!'; return 'Please enter your phone number';
} }
return null; return null;
}, },
...@@ -200,6 +202,7 @@ class ContactUs2 extends StatelessWidget { ...@@ -200,6 +202,7 @@ class ContactUs2 extends StatelessWidget {
hintText: "Enter a valid email address", hintText: "Enter a valid email address",
fillColor: Colors.white, fillColor: Colors.white,
filled: true, filled: true,
errorStyle: TextStyle(color: Colors.white),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.zero, borderRadius: BorderRadius.zero,
borderSide: borderSide:
...@@ -213,7 +216,7 @@ class ContactUs2 extends StatelessWidget { ...@@ -213,7 +216,7 @@ class ContactUs2 extends StatelessWidget {
), ),
validator: (value) { validator: (value) {
if (value == null || value.isEmpty) { if (value == null || value.isEmpty) {
return 'Email cannot be empty!!!'; return 'Please enter your email';
} }
return null; return null;
}, },
...@@ -243,6 +246,7 @@ class ContactUs2 extends StatelessWidget { ...@@ -243,6 +246,7 @@ class ContactUs2 extends StatelessWidget {
hintText: "Enter your message", hintText: "Enter your message",
fillColor: Colors.white, fillColor: Colors.white,
filled: true, filled: true,
errorStyle: TextStyle(color: Colors.white),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.zero, borderRadius: BorderRadius.zero,
borderSide: BorderSide(width: 1, color: Colors.white), borderSide: BorderSide(width: 1, color: Colors.white),
...@@ -255,7 +259,7 @@ class ContactUs2 extends StatelessWidget { ...@@ -255,7 +259,7 @@ class ContactUs2 extends StatelessWidget {
maxLines: 5, maxLines: 5,
validator: (value) { validator: (value) {
if (value == null || value.isEmpty) { if (value == null || value.isEmpty) {
return 'Message cannot be empty!!!'; return 'Please enter your message';
} }
return null; return null;
}, },
......
...@@ -40,7 +40,7 @@ class Footer extends StatelessWidget { ...@@ -40,7 +40,7 @@ class Footer extends StatelessWidget {
children: [ children: [
Container( Container(
width: screenSize.width * 0.12, width: screenSize.width * 0.12,
height: screenSize.height * 0.08, height: screenSize.height * 0.07,
decoration: const BoxDecoration( decoration: const BoxDecoration(
//color: Colors.lightBlueAccent, //color: Colors.lightBlueAccent,
image: DecorationImage( image: DecorationImage(
......
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