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