|
|
|
|
@ -193,7 +193,7 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
rememberMe = _settingProvider!.rememberMe;
|
|
|
|
|
if (rememberMe) {
|
|
|
|
|
_user.userName = _settingProvider!.username;
|
|
|
|
|
userNameController.text=_user.userName??'';
|
|
|
|
|
userNameController.text = _user.userName ?? '';
|
|
|
|
|
_user.password = _settingProvider!.password;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -228,7 +228,7 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
context.translation.signInToYour.customHeadingText(context).custom(color: Colors.white, fontSize: 27, fontWeight: FontWeight.w500),
|
|
|
|
|
context.translation.account.customHeadingText(context).custom(color: Colors.white, fontSize: 27, fontWeight: FontWeight.w500),
|
|
|
|
|
15.height,
|
|
|
|
|
// context.translation.letSignInToAccount.customHeadingText(context).custom(color: Colors.white, fontWeight: FontWeight.w500, fontSize: 12),
|
|
|
|
|
// context.translation.letSignInToAccount.customHeadingText(context).custom(color: Colors.white, fontWeight: FontWeight.w500, fontSize: 12),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -256,7 +256,7 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
_user.userName = value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
18.height,
|
|
|
|
|
16.height,
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
initialValue: _user.password ?? "",
|
|
|
|
|
showWithoutDecoration: true,
|
|
|
|
|
@ -270,9 +270,11 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
// Based on passwordVisible state choose the icon
|
|
|
|
|
_passwordVisible ? Icons.visibility : Icons.visibility_off,
|
|
|
|
|
color: context.isDark ? AppColor.neutral10 : AppColor.neutral20,
|
|
|
|
|
).paddingOnly(end: 12).onPress(() { setState(() {
|
|
|
|
|
_passwordVisible = !_passwordVisible;
|
|
|
|
|
}); }),
|
|
|
|
|
).paddingOnly(end: 12).onPress(() {
|
|
|
|
|
setState(() {
|
|
|
|
|
_passwordVisible = !_passwordVisible;
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
validator: (value) => Validator.isValidPassword(value!)
|
|
|
|
|
? null
|
|
|
|
|
: value.isEmpty
|
|
|
|
|
@ -282,25 +284,27 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
_user.password = value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
16.height,
|
|
|
|
|
Align(
|
|
|
|
|
alignment: AlignmentDirectional.centerEnd,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () async {
|
|
|
|
|
if(userNameController.text.isNotEmpty){
|
|
|
|
|
GeneralResponseModel response = await _userProvider.sendForgetPasswordOtp(context: context, employeeId: userNameController.text);
|
|
|
|
|
if( response.isSuccess==true){
|
|
|
|
|
Navigator.push(context, MaterialPageRoute(builder: (context)=>ForgetPasswordVerifyOtpView(data: {'employeeId':userNameController.text,'phoneNumber':response.data},)));
|
|
|
|
|
// Navigator.push(context, ForgetPasswordVerifyOtpView.routeName);
|
|
|
|
|
}else{
|
|
|
|
|
Fluttertoast.showToast(msg: response.message ?? context.translation.failedToCompleteRequest);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
Fluttertoast.showToast(msg: context.translation.employeeIdIsRequired);
|
|
|
|
|
child: context.translation.forgotPassword.bodyText(context).custom(color: AppColor.primary10, fontWeight: FontWeight.w500).onPress(() async {
|
|
|
|
|
if (userNameController.text.isNotEmpty) {
|
|
|
|
|
GeneralResponseModel response = await _userProvider.sendForgetPasswordOtp(context: context, employeeId: userNameController.text);
|
|
|
|
|
if (response.isSuccess == true) {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => ForgetPasswordVerifyOtpView(
|
|
|
|
|
data: {'employeeId': userNameController.text, 'phoneNumber': response.data},
|
|
|
|
|
)));
|
|
|
|
|
// Navigator.push(context, ForgetPasswordVerifyOtpView.routeName);
|
|
|
|
|
} else {
|
|
|
|
|
context.showConfirmDialog(response.message ?? context.translation.failedToCompleteRequest);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
child: context.translation.forgotPassword.bodyText(context).custom(color: AppColor.primary10, fontWeight: FontWeight.w500),
|
|
|
|
|
),
|
|
|
|
|
} else {
|
|
|
|
|
Fluttertoast.showToast(msg: context.translation.employeeIdIsRequired);
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
@ -335,10 +339,7 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
await _settingProvider!.setUser(_userProvider.user!);
|
|
|
|
|
(await SharedPreferences.getInstance()).remove(ASettings.localAuth);
|
|
|
|
|
await _settingProvider!.setRememberMe(_user.userName!, _user.password!, rememberMe);
|
|
|
|
|
|
|
|
|
|
/// The below line for the new design
|
|
|
|
|
// Navigator.pushNamed(context, LandPage.routeName);
|
|
|
|
|
Navigator.pushNamed(context, LandPage.routeName);
|
|
|
|
|
Navigator.pushReplacementNamed(context, LandPage.routeName);
|
|
|
|
|
} else {
|
|
|
|
|
Fluttertoast.showToast(msg: _userProvider.user?.message ?? context.translation.failedToCompleteRequest);
|
|
|
|
|
}
|
|
|
|
|
|