-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from Hegazy02/features/loginView
create login cubit
- Loading branch information
Showing
16 changed files
with
416 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
class AppRegex { | ||
static bool isEmailValid(String email) { | ||
return RegExp(r'^.+@[a-zA-Z]+\.{1}[a-zA-Z]+(\.{0,1}[a-zA-Z]+)$') | ||
.hasMatch(email); | ||
} | ||
|
||
static bool isPasswordValid(String password) { | ||
return RegExp( | ||
r"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$") | ||
.hasMatch(password); | ||
} | ||
|
||
static bool isPhoneNumberValid(String phoneNumber) { | ||
return RegExp(r'^(010|011|012|015)[0-9]{8}$').hasMatch(phoneNumber); | ||
} | ||
|
||
static bool hasLowerCase(String password) { | ||
return RegExp(r'^(?=.*[a-z])').hasMatch(password); | ||
} | ||
|
||
static bool hasUpperCase(String password) { | ||
return RegExp(r'^(?=.*[A-Z])').hasMatch(password); | ||
} | ||
|
||
static bool hasNumber(String password) { | ||
return RegExp(r'^(?=.*?[0-9])').hasMatch(password); | ||
} | ||
|
||
static bool hasSpecialCharacter(String password) { | ||
return RegExp(r'^(?=.*?[#?!@$%^&*-])').hasMatch(password); | ||
} | ||
|
||
static bool hasMinLength(String password) { | ||
return RegExp(r'^(?=.{8,})').hasMatch(password); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,78 @@ | ||
import 'package:doctorito/features/auth/presentation/views/widgets/login_view_body.dart'; | ||
import 'package:doctorito/core/theme/styles.dart'; | ||
import 'package:doctorito/features/auth/data/models/login_request_body.dart'; | ||
import 'package:doctorito/features/auth/presentation/view_model/login/login_cubit.dart'; | ||
import 'package:doctorito/features/auth/presentation/views/widgets/email_and_password.dart'; | ||
import 'package:doctorito/features/auth/presentation/views/widgets/login_bloc_listener.dart'; | ||
import 'package:doctorito/features/auth/presentation/views/widgets/remember_me.dart'; | ||
import 'package:doctorito/features/auth/presentation/views/widgets/terms_and_conditions.dart'; | ||
import 'package:doctorito/features/onboarding/presentation/views/widgets/custom_button.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
|
||
class LoginView extends StatelessWidget { | ||
const LoginView({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return const Scaffold(body: SafeArea(child: LoginViewBody())); | ||
return Scaffold( | ||
body: SafeArea( | ||
child: SingleChildScrollView( | ||
child: Padding( | ||
padding: const EdgeInsets.all(24), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Text( | ||
"Welcome Back", | ||
style: Styles.style24PrimaryColorw700, | ||
), | ||
Text( | ||
"We're excited to have you back, can't wait to see what you've been up to since you last logged in.", | ||
style: Styles.style15rGreyw400, | ||
), | ||
SizedBox( | ||
height: 28.h, | ||
), | ||
const EmailAndPassword(), | ||
const RememberMe(), | ||
SizedBox( | ||
height: 24.h, | ||
), | ||
CustomButton( | ||
text: "Login", | ||
onPressed: () { | ||
context.read<LoginCubit>().login(LoginRequestBody( | ||
email: context.read<LoginCubit>().emailController.text, | ||
password: | ||
context.read<LoginCubit>().passwordController.text)); | ||
}, | ||
), | ||
SizedBox( | ||
height: 10.h, | ||
), | ||
const TermsAndConditions(), | ||
SizedBox( | ||
height: 24.h, | ||
), | ||
Row( | ||
children: [ | ||
const Spacer(), | ||
Text.rich( | ||
textAlign: TextAlign.center, | ||
style: Styles.style12Grey3w400, | ||
TextSpan(children: [ | ||
const TextSpan(text: "Don't have an account yet? "), | ||
TextSpan( | ||
text: "Sign Up", style: Styles.style12PrimaryColorw600), | ||
]), | ||
), | ||
const Spacer(), | ||
], | ||
), | ||
const LoginBlocListener() | ||
], | ||
), | ||
)))); | ||
} | ||
} |
Oops, something went wrong.