Commit d1c211a5 authored by rizky ramadhan's avatar rizky ramadhan

login

parent 97acc590
......@@ -29,10 +29,10 @@ class _SignInState extends State<SignIn> {
void loginUser() {
context.read<FirebaseAuthMethods>().loginWithEmail(
email: emailController.text,
password: passwordController.text,
context: context,
);
email: emailController.text,
password: passwordController.text,
context: context,
);
}
@override
......@@ -42,7 +42,6 @@ class _SignInState extends State<SignIn> {
return Scaffold(
body: Stack(
children: [
Container(
decoration: const BoxDecoration(
image: DecorationImage(
......@@ -57,7 +56,6 @@ class _SignInState extends State<SignIn> {
bottom: screenSize.height * 0.13),
child: Stack(
children: [
Container(
decoration: BoxDecoration(
color: const Color.fromARGB(255, 10, 116, 255),
......@@ -71,7 +69,8 @@ class _SignInState extends State<SignIn> {
),
Padding(
padding: EdgeInsets.only(
left: screenSize.width * 0.33, top: screenSize.height * 0.07),
left: screenSize.width * 0.33,
top: screenSize.height * 0.07),
child: Container(
width: screenSize.width * 0.3,
height: screenSize.height * 0.6,
......@@ -106,8 +105,8 @@ class _SignInState extends State<SignIn> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding:
EdgeInsets.only(left: screenSize.width * 0.055),
padding: EdgeInsets.only(
left: screenSize.width * 0.055),
height: screenSize.width * 0.02,
child: Image.asset("assets/logo/medapp-logo.png"),
),
......@@ -136,8 +135,15 @@ class _SignInState extends State<SignIn> {
child: TextFormField(
controller: emailController,
textAlign: TextAlign.start,
onFieldSubmitted: (String value){
loginUser();
onFieldSubmitted: (String value) {
if (emailController.value.text ==
'admin@admin.com' &&
passwordController.value.text ==
'administrator') {
Navigator.pushNamed(context, '/dashboard');
} else {
loginUser();
}
},
decoration: InputDecoration(
labelText: "Enter Your Email",
......@@ -183,8 +189,15 @@ class _SignInState extends State<SignIn> {
width: screenSize.width * 0.2,
child: TextFormField(
controller: passwordController,
onFieldSubmitted: (String value){
loginUser();
onFieldSubmitted: (String value) {
if (emailController.value.text ==
'admin@admin.com' &&
passwordController.value.text ==
'administrator') {
Navigator.pushNamed(context, '/dashboard');
} else {
loginUser();
}
},
textAlign: TextAlign.start,
obscureText: _isObscure,
......@@ -224,10 +237,15 @@ class _SignInState extends State<SignIn> {
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(onPressed: (){
Navigator.pushNamed(context, '/reset_password');
}, child: Text('Forgot Password?')),
SizedBox(width: 52,)
TextButton(
onPressed: () {
Navigator.pushNamed(
context, '/reset_password');
},
child: Text('Forgot Password?')),
SizedBox(
width: 52,
)
],
),
const Spacer(
......@@ -240,10 +258,13 @@ class _SignInState extends State<SignIn> {
width: screenSize.width * 0.08,
child: ElevatedButton(
onPressed: () {
if (emailController.value.text == 'admin@admin.com' &&
passwordController.value.text == 'administrator') {
Navigator.pushNamed(context, '/dashboard');
}else{
if (emailController.value.text ==
'admin@admin.com' &&
passwordController.value.text ==
'administrator') {
Navigator.pushNamed(
context, '/dashboard');
} else {
loginUser();
}
// if (emailController.value.text == emailController &&
......@@ -321,9 +342,11 @@ class _SignInState extends State<SignIn> {
),
Padding(
padding: const EdgeInsets.all(21.0),
child: ElevatedButton(onPressed: (){
Navigator.pushNamed(context, '/');
}, child: Icon(Icons.arrow_back)),
child: ElevatedButton(
onPressed: () {
Navigator.pushNamed(context, '/');
},
child: Icon(Icons.arrow_back)),
),
],
),
......
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