FIX_image
This commit is contained in:
parent
3e9a30b635
commit
24f532f750
@ -28,136 +28,142 @@ class changesPassword extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _changesPasswordState extends State<changesPassword> {
|
class _changesPasswordState extends State<changesPassword> {
|
||||||
final TextEditingController oldPasswordController = TextEditingController();
|
final TextEditingController oldPasswordController = TextEditingController();
|
||||||
final TextEditingController newPasswordController = TextEditingController();
|
final TextEditingController newPasswordController = TextEditingController();
|
||||||
final TextEditingController confirmPasswordController = TextEditingController();
|
final TextEditingController confirmPasswordController = TextEditingController();
|
||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
dynamic _preToken;
|
dynamic _preToken;
|
||||||
dynamic _postToken;
|
dynamic _postToken;
|
||||||
dynamic clientName;
|
dynamic clientName;
|
||||||
dynamic clientLogo;
|
dynamic clientLogo;
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
bool _obscureOldPassword = true;
|
bool _obscureOldPassword = true;
|
||||||
bool _obscureNewPassword = true;
|
bool _obscureNewPassword = true;
|
||||||
bool _obscureConfirmPassword = true;
|
bool _obscureConfirmPassword = true;
|
||||||
late SessionManager session;
|
late SessionManager session;
|
||||||
bool hasMinLength = false;
|
bool hasMinLength = false;
|
||||||
bool hasUpperLower = false;
|
bool hasUpperLower = false;
|
||||||
bool hasNumber = false;
|
bool hasNumber = false;
|
||||||
bool hasSpecialChar = false;
|
bool hasSpecialChar = false;
|
||||||
bool get isPasswordValid => hasMinLength && hasUpperLower && hasNumber && hasSpecialChar;
|
bool get isPasswordValid => hasMinLength && hasUpperLower && hasNumber && hasSpecialChar;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void validatePassword(String password) {
|
void validatePassword(String password) {
|
||||||
setState(() {
|
setState(() {
|
||||||
hasMinLength = password.length >= 8;
|
hasMinLength = password.length >= 8;
|
||||||
hasUpperLower = RegExp(r'(?=.*[A-Za-z])').hasMatch(password);
|
hasUpperLower = RegExp(r'(?=.*[A-Za-z])').hasMatch(password);
|
||||||
hasNumber = RegExp(r'(?=.*\d)').hasMatch(password);
|
hasNumber = RegExp(r'(?=.*\d)').hasMatch(password);
|
||||||
hasSpecialChar = RegExp(r'(?=.*[@$!%*#?&])').hasMatch(password);
|
hasSpecialChar = RegExp(r'(?=.*[@$!%*#?&])').hasMatch(password);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> resetYourPassword() async {
|
Future<void> resetYourPassword() async {
|
||||||
final oldpassword = oldPasswordController.text.trim();
|
final oldpassword = oldPasswordController.text.trim();
|
||||||
final newPassword = newPasswordController.text.trim();
|
final newPassword = newPasswordController.text.trim();
|
||||||
final confirmPassword = confirmPasswordController.text.trim();
|
final confirmPassword = confirmPasswordController.text.trim();
|
||||||
try {
|
try {
|
||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
if (!isPasswordValid) {
|
// Extra safety checks before calling the API
|
||||||
ToastHelper.showErrorToast(
|
if (oldpassword == newPassword) {
|
||||||
context,
|
ToastHelper.showErrorToast(
|
||||||
'Password must be 8+ characters with 1 letter, 1 number, and 1 special character');
|
context, 'New password cannot be same as old password');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (confirmPassword != newPassword) {
|
if (!isPasswordValid) {
|
||||||
ToastHelper.showErrorToast(context, 'Passwords do not match');
|
ToastHelper.showErrorToast(
|
||||||
return;
|
context,
|
||||||
}
|
'Password must be 8+ characters with 1 letter, 1 number, and 1 special character');
|
||||||
setState(() {
|
return;
|
||||||
_isLoading = true;
|
}
|
||||||
});
|
if (confirmPassword != newPassword) {
|
||||||
|
ToastHelper.showErrorToast(context, 'Passwords do not match');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setState(() {
|
||||||
|
_isLoading = true;
|
||||||
|
});
|
||||||
|
|
||||||
// Determine the API and the payload based on the visible field
|
// Determine the API and the payload based on the visible field
|
||||||
String apiEndpoint = Environment.apiUrlEnrollment + 'changePassword';
|
String apiEndpoint = Environment.apiUrlEnrollment + 'changePassword';
|
||||||
Map<String, dynamic> payload = {
|
Map<String, dynamic> payload = {
|
||||||
'email_id': widget.email,
|
'email_id': widget.email,
|
||||||
'client_id': widget.client_id,
|
'client_id': widget.client_id,
|
||||||
'old_password': oldpassword,
|
'old_password': oldpassword,
|
||||||
'new_password': newPassword,
|
'new_password': newPassword,
|
||||||
'confirm_password': confirmPassword
|
'confirm_password': confirmPassword
|
||||||
};
|
};
|
||||||
|
|
||||||
// var enteredMobileNumber = mobileController.text;
|
// var enteredMobileNumber = mobileController.text;
|
||||||
final response = await http.post(
|
final response = await http.post(
|
||||||
Uri.parse(apiEndpoint),
|
Uri.parse(apiEndpoint),
|
||||||
body: json.encode(payload),
|
body: json.encode(payload),
|
||||||
headers: {
|
headers: {
|
||||||
HttpHeaders.contentTypeHeader: 'application/json',
|
HttpHeaders.contentTypeHeader: 'application/json',
|
||||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
Map<String, dynamic> data = json.decode(response.body);
|
Map<String, dynamic> data = json.decode(response.body);
|
||||||
String? statusVerification = data['status'];
|
String? statusVerification = data['status'];
|
||||||
String? message = data['message'];
|
String? message = data['message'];
|
||||||
if (statusVerification == 'success') {
|
if (statusVerification == 'success') {
|
||||||
final SharedPreferences prefs = await SharedPreferences
|
final SharedPreferences prefs = await SharedPreferences
|
||||||
.getInstance();
|
.getInstance();
|
||||||
await SessionManager().clear();
|
await SessionManager().clear();
|
||||||
await prefs.clear();
|
await prefs.clear();
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
});
|
});
|
||||||
ToastHelper.showSuccessToast(context, message!);
|
ToastHelper.showSuccessToast(context, message!);
|
||||||
context.go('/login');
|
context.go('/login');
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
});
|
});
|
||||||
ToastHelper.showErrorToast(context, message!);
|
ToastHelper.showErrorToast(context, message!);
|
||||||
print('Invalid mobile number');
|
print('Invalid mobile number');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
});
|
});
|
||||||
ToastHelper.showErrorToast(context, 'Something went wrong');
|
ToastHelper.showErrorToast(context, 'Something went wrong');
|
||||||
throw Exception('Failed to verify mobile number');
|
throw Exception('Failed to verify mobile number');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
});
|
});
|
||||||
// ToastHelper.showErrorToast(context, 'Something went wrong');
|
// ToastHelper.showErrorToast(context, 'Something went wrong');
|
||||||
print('Error: $e');
|
print('Error: $e');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 🔹 Password validation
|
// 🔹 Password validation
|
||||||
// if (password.isEmpty) {
|
// if (password.isEmpty) {
|
||||||
// ToastHelper.showErrorToast(context, 'Please enter your password');
|
// ToastHelper.showErrorToast(context, 'Please enter your password');
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
// if (password.length < 6) {
|
// if (password.length < 6) {
|
||||||
// ToastHelper.showErrorToast(context, 'Password must be at least 6 characters');
|
// ToastHelper.showErrorToast(context, 'Password must be at least 6 characters');
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
// if (!RegExp(r'^(?=.*[A-Z])(?=.*[0-9]).{6,}$').hasMatch(password)) {
|
// if (!RegExp(r'^(?=.*[A-Z])(?=.*[0-9]).{6,}$').hasMatch(password)) {
|
||||||
// ToastHelper.showErrorToast(context, 'Include at least 1 uppercase letter and 1 number');
|
// ToastHelper.showErrorToast(context, 'Include at least 1 uppercase letter and 1 number');
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// // 🔹 Confirm password validation
|
// // 🔹 Confirm password validation
|
||||||
// if (confirmPassword.isEmpty) {
|
// if (confirmPassword.isEmpty) {
|
||||||
// ToastHelper.showErrorToast(context, 'Please confirm your password');
|
// ToastHelper.showErrorToast(context, 'Please confirm your password');
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
//Ends Login with UserName and Password
|
//Ends Login with UserName and Password
|
||||||
|
|
||||||
@ -311,7 +317,7 @@ class _changesPasswordState extends State<changesPassword> {
|
|||||||
if (Responsive.isDesktop(context))
|
if (Responsive.isDesktop(context))
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.center,
|
MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@ -387,267 +393,267 @@ class _changesPasswordState extends State<changesPassword> {
|
|||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
// 🔹 Password Field
|
// 🔹 Password Field
|
||||||
Container(
|
Container(
|
||||||
height: 55,
|
height: 55,
|
||||||
margin: Responsive.isDesktop(
|
margin: Responsive.isDesktop(
|
||||||
context)
|
context)
|
||||||
? const EdgeInsets
|
? const EdgeInsets
|
||||||
|
.symmetric(
|
||||||
|
horizontal: 150)
|
||||||
|
: const EdgeInsets
|
||||||
|
.symmetric(
|
||||||
|
horizontal: 0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
width: 1,
|
||||||
|
color: Colors.grey),
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(
|
||||||
|
10),
|
||||||
|
),
|
||||||
|
child: TextFormField(
|
||||||
|
controller:
|
||||||
|
oldPasswordController,
|
||||||
|
obscureText:
|
||||||
|
_obscureOldPassword,
|
||||||
|
textAlignVertical:
|
||||||
|
TextAlignVertical
|
||||||
|
.center,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: InputBorder.none,
|
||||||
|
hintText:
|
||||||
|
"Old Password",
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets
|
||||||
.symmetric(
|
.symmetric(
|
||||||
horizontal: 150)
|
horizontal: 10),
|
||||||
: const EdgeInsets
|
suffixIcon: IconButton(
|
||||||
.symmetric(
|
icon: Icon(
|
||||||
horizontal: 0),
|
_obscureOldPassword
|
||||||
decoration: BoxDecoration(
|
? Icons
|
||||||
border: Border.all(
|
.visibility_off
|
||||||
width: 1,
|
: Icons
|
||||||
color: Colors.grey),
|
.visibility,
|
||||||
borderRadius:
|
color: Colors.grey,
|
||||||
BorderRadius.circular(
|
|
||||||
10),
|
|
||||||
),
|
|
||||||
child: TextFormField(
|
|
||||||
controller:
|
|
||||||
oldPasswordController,
|
|
||||||
obscureText:
|
|
||||||
_obscureOldPassword,
|
|
||||||
textAlignVertical:
|
|
||||||
TextAlignVertical
|
|
||||||
.center,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
border: InputBorder.none,
|
|
||||||
hintText:
|
|
||||||
"Old Password",
|
|
||||||
contentPadding:
|
|
||||||
const EdgeInsets
|
|
||||||
.symmetric(
|
|
||||||
horizontal: 10),
|
|
||||||
suffixIcon: IconButton(
|
|
||||||
icon: Icon(
|
|
||||||
_obscureOldPassword
|
|
||||||
? Icons
|
|
||||||
.visibility_off
|
|
||||||
: Icons
|
|
||||||
.visibility,
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
setState(() {
|
|
||||||
_obscureOldPassword =
|
|
||||||
!_obscureOldPassword;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
validator: (value) {
|
onPressed: () {
|
||||||
if (value == null ||
|
setState(() {
|
||||||
value.isEmpty) {
|
_obscureOldPassword =
|
||||||
return 'Please enter your old password';
|
!_obscureOldPassword;
|
||||||
}
|
});
|
||||||
if (value.length < 8) {
|
|
||||||
return 'Password must be at least 8 characters';
|
|
||||||
}
|
|
||||||
if (!RegExp(
|
|
||||||
r'^(?=.*[A-Z])(?=.*[0-9]).{6,}$')
|
|
||||||
.hasMatch(value)) {
|
|
||||||
return 'Include at least 1 uppercase letter and 1 number';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
validator: (value) {
|
||||||
Container(
|
if (value == null ||
|
||||||
height: 55,
|
value.isEmpty) {
|
||||||
margin: Responsive.isDesktop(context)
|
return 'Please enter your old password';
|
||||||
? const EdgeInsets.symmetric(horizontal: 150)
|
}
|
||||||
: const EdgeInsets.symmetric(horizontal: 0),
|
if (value.length < 8) {
|
||||||
decoration: BoxDecoration(
|
return 'Password must be at least 8 characters';
|
||||||
border: Border.all(width: 1, color: Colors.grey),
|
}
|
||||||
borderRadius: BorderRadius.circular(10),
|
if (!RegExp(
|
||||||
),
|
r'^(?=.*[A-Z])(?=.*[0-9]).{6,}$')
|
||||||
child: TextFormField(
|
.hasMatch(value)) {
|
||||||
controller: newPasswordController,
|
return 'Include at least 1 uppercase letter and 1 number';
|
||||||
obscureText: _obscureNewPassword,
|
}
|
||||||
onChanged: validatePassword,
|
return null;
|
||||||
textAlignVertical: TextAlignVertical.center,
|
},
|
||||||
decoration: InputDecoration(
|
),
|
||||||
border: InputBorder.none,
|
),
|
||||||
hintText: "New Password",
|
const SizedBox(height: 10),
|
||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 10),
|
Container(
|
||||||
suffixIcon: IconButton(
|
height: 55,
|
||||||
icon: Icon(
|
margin: Responsive.isDesktop(context)
|
||||||
_obscureNewPassword ? Icons.visibility_off : Icons.visibility,
|
? const EdgeInsets.symmetric(horizontal: 150)
|
||||||
color: Colors.grey,
|
: const EdgeInsets.symmetric(horizontal: 0),
|
||||||
),
|
decoration: BoxDecoration(
|
||||||
onPressed: () {
|
border: Border.all(width: 1, color: Colors.grey),
|
||||||
setState(() {
|
borderRadius: BorderRadius.circular(10),
|
||||||
_obscureNewPassword = !_obscureNewPassword;
|
),
|
||||||
});
|
child: TextFormField(
|
||||||
},
|
controller: newPasswordController,
|
||||||
),
|
obscureText: _obscureNewPassword,
|
||||||
|
onChanged: validatePassword,
|
||||||
|
textAlignVertical: TextAlignVertical.center,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: InputBorder.none,
|
||||||
|
hintText: "New Password",
|
||||||
|
contentPadding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
_obscureNewPassword ? Icons.visibility_off : Icons.visibility,
|
||||||
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
validator: (value) {
|
onPressed: () {
|
||||||
final password = value ?? '';
|
setState(() {
|
||||||
if (password.isEmpty) {
|
_obscureNewPassword = !_obscureNewPassword;
|
||||||
return 'Please enter your new password';
|
});
|
||||||
}
|
|
||||||
if (password.length < 8) {
|
|
||||||
return 'Password must be at least 8 characters';
|
|
||||||
}
|
|
||||||
if (!RegExp(r'[A-Za-z]').hasMatch(password)) {
|
|
||||||
return 'Password must include at least 1 letter';
|
|
||||||
}
|
|
||||||
if (!RegExp(r'\d').hasMatch(password)) {
|
|
||||||
return 'Password must include at least 1 number';
|
|
||||||
}
|
|
||||||
if (!RegExp(r'[@$!%*#?&]').hasMatch(password)) {
|
|
||||||
return 'Password must include at least 1 special character';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
validator: (value) {
|
||||||
// 🔹 VALIDATION LIST
|
final password = value ?? '';
|
||||||
Padding(
|
if (password.isEmpty) {
|
||||||
padding: Responsive.isDesktop(context)
|
return 'Please enter your new password';
|
||||||
? const EdgeInsets.symmetric(horizontal: 150)
|
}
|
||||||
: const EdgeInsets.symmetric(horizontal: 5),
|
if (password.length < 8) {
|
||||||
child: Column(
|
return 'Password must be at least 8 characters';
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
}
|
||||||
|
if (!RegExp(r'[A-Za-z]').hasMatch(password)) {
|
||||||
|
return 'Password must include at least 1 letter';
|
||||||
|
}
|
||||||
|
if (!RegExp(r'\d').hasMatch(password)) {
|
||||||
|
return 'Password must include at least 1 number';
|
||||||
|
}
|
||||||
|
if (!RegExp(r'[@$!%*#?&]').hasMatch(password)) {
|
||||||
|
return 'Password must include at least 1 special character';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
// 🔹 VALIDATION LIST
|
||||||
|
Padding(
|
||||||
|
padding: Responsive.isDesktop(context)
|
||||||
|
? const EdgeInsets.symmetric(horizontal: 150)
|
||||||
|
: const EdgeInsets.symmetric(horizontal: 5),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Expanded(child: _buildCheckItem(hasMinLength, "Minimum 8 characters")),
|
||||||
children: [
|
Expanded(child: _buildCheckItem(hasSpecialChar, "1 special character")),
|
||||||
Expanded(child: _buildCheckItem(hasMinLength, "Minimum 8 characters")),
|
|
||||||
Expanded(child: _buildCheckItem(hasSpecialChar, "1 special character")),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Expanded(child: _buildCheckItem(hasUpperLower, "1 UPPER or lower case")),
|
|
||||||
Expanded(child: _buildCheckItem(hasNumber, "1 numerical")),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
Row(
|
||||||
const SizedBox(height: 10),
|
children: [
|
||||||
Container(
|
Expanded(child: _buildCheckItem(hasUpperLower, "1 UPPER or lower case")),
|
||||||
height: 55,
|
Expanded(child: _buildCheckItem(hasNumber, "1 numerical")),
|
||||||
margin: Responsive.isDesktop(
|
],
|
||||||
context)
|
|
||||||
? const EdgeInsets
|
|
||||||
.symmetric(
|
|
||||||
horizontal: 150)
|
|
||||||
: const EdgeInsets
|
|
||||||
.symmetric(
|
|
||||||
horizontal: 0),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.all(
|
|
||||||
width: 1,
|
|
||||||
color: Colors.grey),
|
|
||||||
borderRadius:
|
|
||||||
BorderRadius.circular(
|
|
||||||
10),
|
|
||||||
),
|
),
|
||||||
child: TextFormField(
|
],
|
||||||
controller:
|
),
|
||||||
confirmPasswordController,
|
),
|
||||||
obscureText:
|
const SizedBox(height: 10),
|
||||||
_obscureConfirmPassword,
|
Container(
|
||||||
textAlignVertical:
|
height: 55,
|
||||||
TextAlignVertical
|
margin: Responsive.isDesktop(
|
||||||
.center,
|
context)
|
||||||
decoration: InputDecoration(
|
? const EdgeInsets
|
||||||
border: InputBorder.none,
|
.symmetric(
|
||||||
hintText:
|
horizontal: 150)
|
||||||
"Confirm Password",
|
: const EdgeInsets
|
||||||
contentPadding:
|
.symmetric(
|
||||||
const EdgeInsets
|
horizontal: 0),
|
||||||
.symmetric(
|
decoration: BoxDecoration(
|
||||||
horizontal: 10),
|
border: Border.all(
|
||||||
suffixIcon: IconButton(
|
width: 1,
|
||||||
icon: Icon(
|
color: Colors.grey),
|
||||||
_obscureConfirmPassword
|
borderRadius:
|
||||||
? Icons
|
BorderRadius.circular(
|
||||||
.visibility_off
|
10),
|
||||||
: Icons
|
),
|
||||||
.visibility,
|
child: TextFormField(
|
||||||
color: Colors.grey,
|
controller:
|
||||||
),
|
confirmPasswordController,
|
||||||
onPressed: () {
|
obscureText:
|
||||||
setState(() {
|
_obscureConfirmPassword,
|
||||||
_obscureConfirmPassword =
|
textAlignVertical:
|
||||||
!_obscureConfirmPassword;
|
TextAlignVertical
|
||||||
});
|
.center,
|
||||||
},
|
decoration: InputDecoration(
|
||||||
),
|
border: InputBorder.none,
|
||||||
|
hintText:
|
||||||
|
"Confirm Password",
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets
|
||||||
|
.symmetric(
|
||||||
|
horizontal: 10),
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
_obscureConfirmPassword
|
||||||
|
? Icons
|
||||||
|
.visibility_off
|
||||||
|
: Icons
|
||||||
|
.visibility,
|
||||||
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
validator: (value) {
|
onPressed: () {
|
||||||
if (value == null ||
|
setState(() {
|
||||||
value.isEmpty) {
|
_obscureConfirmPassword =
|
||||||
return 'Please confirm your password';
|
!_obscureConfirmPassword;
|
||||||
}
|
});
|
||||||
if (value !=
|
|
||||||
newPasswordController
|
|
||||||
.text) {
|
|
||||||
return 'Passwords do not match';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
validator: (value) {
|
||||||
|
if (value == null ||
|
||||||
|
value.isEmpty) {
|
||||||
|
return 'Please confirm your password';
|
||||||
|
}
|
||||||
|
if (value !=
|
||||||
|
newPasswordController
|
||||||
|
.text) {
|
||||||
|
return 'Passwords do not match';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 15),
|
],
|
||||||
Container(
|
),
|
||||||
margin:
|
SizedBox(height: 15),
|
||||||
Responsive.isDesktop(context)
|
Container(
|
||||||
? EdgeInsets.symmetric(
|
margin:
|
||||||
horizontal: 150)
|
Responsive.isDesktop(context)
|
||||||
: EdgeInsets.symmetric(
|
? EdgeInsets.symmetric(
|
||||||
horizontal: 0),
|
horizontal: 150)
|
||||||
child: SizedBox(
|
: EdgeInsets.symmetric(
|
||||||
width: double.infinity,
|
horizontal: 0),
|
||||||
height: 40,
|
child: SizedBox(
|
||||||
child: ElevatedButton(
|
width: double.infinity,
|
||||||
style:
|
height: 40,
|
||||||
ElevatedButton.styleFrom(
|
child: ElevatedButton(
|
||||||
backgroundColor:
|
style:
|
||||||
Color(0xFF00989E),
|
ElevatedButton.styleFrom(
|
||||||
shape:
|
backgroundColor:
|
||||||
RoundedRectangleBorder(
|
Color(0xFF00989E),
|
||||||
borderRadius:
|
shape:
|
||||||
BorderRadius.circular(
|
RoundedRectangleBorder(
|
||||||
10),
|
borderRadius:
|
||||||
),
|
BorderRadius.circular(
|
||||||
),
|
10),
|
||||||
onPressed: _isLoading
|
),
|
||||||
? null
|
),
|
||||||
: resetYourPassword,
|
onPressed: _isLoading
|
||||||
|
? null
|
||||||
|
: resetYourPassword,
|
||||||
|
|
||||||
child: _isLoading
|
child: _isLoading
|
||||||
? CircularProgressIndicator(
|
? CircularProgressIndicator(
|
||||||
valueColor:
|
valueColor:
|
||||||
AlwaysStoppedAnimation<
|
AlwaysStoppedAnimation<
|
||||||
Color>(
|
Color>(
|
||||||
Color(0xFF00989E),
|
Color(0xFF00989E),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(
|
||||||
"Reset Password",
|
"Reset Password",
|
||||||
style: GoogleFonts
|
style: GoogleFonts
|
||||||
.poppins(
|
.poppins(
|
||||||
color: Color(
|
color: Color(
|
||||||
0xFFFFFFFF),
|
0xFFFFFFFF),
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: Responsive.isDesktop(context)
|
height: Responsive.isDesktop(context)
|
||||||
@ -770,27 +776,27 @@ class _changesPasswordState extends State<changesPassword> {
|
|||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCheckItem(bool status, String text) {
|
Widget _buildCheckItem(bool status, String text) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 2),
|
padding: const EdgeInsets.symmetric(vertical: 2),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
status ? Icons.check : Icons.close,
|
status ? Icons.check : Icons.close,
|
||||||
color: status ? Colors.green : Colors.red,
|
color: status ? Colors.green : Colors.red,
|
||||||
size: 18,
|
size: 18,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
Text(
|
Text(
|
||||||
text,
|
text,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: status ? Colors.green : Colors.red,
|
color: status ? Colors.green : Colors.red,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1935,6 +1935,14 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
Image.network(
|
Image.network(
|
||||||
clientLogo ?? '', // Nhance logo
|
clientLogo ?? '', // Nhance logo
|
||||||
height: 40,
|
height: 40,
|
||||||
|
errorBuilder: (BuildContext context, Object error,
|
||||||
|
StackTrace? stackTrace) {
|
||||||
|
return Image.asset(
|
||||||
|
'assets/Solid_gray.png',
|
||||||
|
height: 40,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
// Image.network(
|
// Image.network(
|
||||||
// 'https://i.imgur.com/qOihOvk.png', // Prodapt logo
|
// 'https://i.imgur.com/qOihOvk.png', // Prodapt logo
|
||||||
|
|||||||
@ -760,15 +760,15 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
// errorBuilder: (BuildContext context,
|
errorBuilder: (BuildContext context,
|
||||||
// Object error, StackTrace? stackTrace) {
|
Object error, StackTrace? stackTrace) {
|
||||||
// return Image.asset(
|
return Image.asset(
|
||||||
// 'assets/Solid_gray.png', // Replace 'default_image.png' with your default image asset path
|
'assets/Solid_gray.png',
|
||||||
// width: 80,
|
width: 80,
|
||||||
// height: 80,
|
height: 80,
|
||||||
// fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
// );
|
);
|
||||||
// },
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1413,6 +1413,14 @@ setState(() {
|
|||||||
Image.network(
|
Image.network(
|
||||||
clientLogo ?? '', // Nhance logo
|
clientLogo ?? '', // Nhance logo
|
||||||
height: 40,
|
height: 40,
|
||||||
|
errorBuilder: (BuildContext context, Object error,
|
||||||
|
StackTrace? stackTrace) {
|
||||||
|
return Image.asset(
|
||||||
|
'assets/Solid_gray.png',
|
||||||
|
height: 40,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
// Image.network(
|
// Image.network(
|
||||||
// 'https://i.imgur.com/qOihOvk.png', // Prodapt logo
|
// 'https://i.imgur.com/qOihOvk.png', // Prodapt logo
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user