validations
This commit is contained in:
parent
2e85273b06
commit
2a77ebc7d1
File diff suppressed because it is too large
Load Diff
@ -267,6 +267,11 @@ class _ForexScreenState extends State<ForexScreen> {
|
||||
errorMessages["end_date"] =
|
||||
"End date cannot be earlier than start date";
|
||||
;
|
||||
} else if (checkEndDate.isAtSameMomentAs(checkStartDate)) {
|
||||
setState(() {
|
||||
errorMessages["end_date"] =
|
||||
"Start and end dates cannot be the same";
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
errorMessages["end_date"] = "Invalid date format";
|
||||
@ -320,6 +325,16 @@ class _ForexScreenState extends State<ForexScreen> {
|
||||
final cash = data["deposit_on_cash"];
|
||||
print("card - $card");
|
||||
print("cash - $cash");
|
||||
// Call validations first (they populate errorMessages)
|
||||
_validateCardAmount(card);
|
||||
_validateCashAmount(cash);
|
||||
|
||||
// Now check if any errors exist
|
||||
if (errorMessages.isNotEmpty) {
|
||||
print("Validation Failed: ${errorMessages}");
|
||||
setState(() {}); // Refresh UI with error messages
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isValidForexData(data)) {
|
||||
// && errorMessages.isNotEmpty) {
|
||||
@ -495,6 +510,7 @@ class _ForexScreenState extends State<ForexScreen> {
|
||||
|
||||
// Check if all required fields have data
|
||||
bool _isForexDataDurationComplete() {
|
||||
print("Calculate 13ww Duration");
|
||||
final data = getForexData;
|
||||
return (data["start_date"]?.isNotEmpty ?? false) &&
|
||||
(data["end_date"]?.isNotEmpty ?? false);
|
||||
@ -503,7 +519,7 @@ class _ForexScreenState extends State<ForexScreen> {
|
||||
// Handle field changes
|
||||
void _onFieldChanged() {
|
||||
if (_isForexDataDurationComplete()) {
|
||||
print("Calculate 1");
|
||||
print("Calculate 1 Duration");
|
||||
CalculateDuration();
|
||||
}
|
||||
|
||||
@ -517,7 +533,7 @@ class _ForexScreenState extends State<ForexScreen> {
|
||||
}
|
||||
|
||||
void CalculateDuration() {
|
||||
print("Calculate 2");
|
||||
print("Calculate 2 Duration");
|
||||
final data = getForexData;
|
||||
final startDateString = data["start_date"];
|
||||
final endDateString = data["end_date"];
|
||||
@ -539,7 +555,7 @@ class _ForexScreenState extends State<ForexScreen> {
|
||||
|
||||
// Calculate difference
|
||||
final durationInDays =
|
||||
endDate.difference(startDate).inDays + 1; // +1 to include both days
|
||||
endDate.difference(startDate).inDays; // +1 to include both days
|
||||
|
||||
// You can now use durationInDays however you want:
|
||||
print("Duration: $durationInDays days");
|
||||
@ -976,18 +992,36 @@ class _ForexScreenState extends State<ForexScreen> {
|
||||
textControllers["_forexEndDate"]!.text,
|
||||
);
|
||||
|
||||
if (startDate != null &&
|
||||
endDate != null &&
|
||||
endDate.isBefore(startDate)) {
|
||||
setState(() {
|
||||
errorMessages["end_date"] =
|
||||
"End date cannot be earlier than start date";
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
errorMessages.remove("end_date");
|
||||
});
|
||||
if (startDate != null && endDate != null) {
|
||||
if (endDate.isBefore(startDate)) {
|
||||
setState(() {
|
||||
errorMessages["end_date"] =
|
||||
"End date cannot be earlier than start date";
|
||||
});
|
||||
} else if (endDate.isAtSameMomentAs(startDate)) {
|
||||
setState(() {
|
||||
errorMessages["end_date"] =
|
||||
"Start and end dates cannot be the same";
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
errorMessages.remove("end_date");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// if (startDate != null &&
|
||||
// endDate != null &&
|
||||
// endDate.isBefore(startDate)) {
|
||||
// setState(() {
|
||||
// errorMessages["end_date"] =
|
||||
// "End date cannot be earlier than start date";
|
||||
// });
|
||||
// } else {
|
||||
// setState(() {
|
||||
// errorMessages.remove("end_date");
|
||||
// });
|
||||
// }
|
||||
}
|
||||
},
|
||||
child: AbsorbPointer(
|
||||
@ -1062,6 +1096,11 @@ class _ForexScreenState extends State<ForexScreen> {
|
||||
errorMessages["end_date"] =
|
||||
"End date cannot be earlier than start date";
|
||||
});
|
||||
} else if (endDate!.isAtSameMomentAs(startDate!)) {
|
||||
setState(() {
|
||||
errorMessages["end_date"] =
|
||||
"Start and end dates cannot be the same";
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
errorMessages.remove("end_date");
|
||||
@ -1098,7 +1137,8 @@ class _ForexScreenState extends State<ForexScreen> {
|
||||
errorMessages["end_date"]!,
|
||||
style: const TextStyle(color: Colors.red, fontSize: 12),
|
||||
maxLines: 2, // Allow it to wrap onto two lines
|
||||
overflow: TextOverflow.ellipsis, // Add ellipsis if it still overflows
|
||||
overflow:
|
||||
TextOverflow.ellipsis, // Add ellipsis if it still overflows
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
@ -42,9 +42,9 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
final ApiService apiService = ApiService();
|
||||
|
||||
final GlobalKey<PersonalDetailsState> personalDetailsKey =
|
||||
GlobalKey<PersonalDetailsState>();
|
||||
GlobalKey<PersonalDetailsState>();
|
||||
final GlobalKey<TravellerDetailsState> travellerDetailsKey =
|
||||
GlobalKey<TravellerDetailsState>();
|
||||
GlobalKey<TravellerDetailsState>();
|
||||
|
||||
// late List<Map<String, dynamic>?> travelDetailsData;
|
||||
Map<String, dynamic>? travelDetailsData;
|
||||
@ -64,6 +64,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
final Map<String, TextEditingController> controllers = {};
|
||||
bool isViewMode = false;
|
||||
bool isEditProfile = false;
|
||||
|
||||
// late final List<dynamic>? apiCountryData ;
|
||||
|
||||
late List<dynamic>? apiCountryData;
|
||||
@ -86,6 +87,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
|
||||
String? selectedCountry;
|
||||
String? selectedGender;
|
||||
|
||||
// String? selectedGender = personalDetailsKey.currentState?.selectedGender;
|
||||
|
||||
String? selectedUserType;
|
||||
@ -299,7 +301,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
// Fix the invalid JSON (dangerous if the format changes)
|
||||
final fixedJson = raw.replaceAllMapped(
|
||||
RegExp(r'(\w+):'), // matches `service_id:`
|
||||
(match) => '"${match.group(1)}":',
|
||||
(match) => '"${match.group(1)}":',
|
||||
);
|
||||
|
||||
List<dynamic> decodedList = jsonDecode(fixedJson);
|
||||
@ -363,7 +365,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
// }
|
||||
|
||||
final extraData =
|
||||
GoRouterState.of(context).extra as Map<String, dynamic>?;
|
||||
GoRouterState.of(context).extra as Map<String, dynamic>?;
|
||||
|
||||
if (extraData != null) {
|
||||
print("extraData: ${extraData['selectedUser']}");
|
||||
@ -381,8 +383,8 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
|
||||
// Handle selectedUser as a Map (not a List)
|
||||
apiselectedUser =
|
||||
extraData['selectedUser']
|
||||
as Map<String, dynamic>?; // Cast it as a Map
|
||||
extraData['selectedUser']
|
||||
as Map<String, dynamic>?; // Cast it as a Map
|
||||
isViewMode = extraData['isViewMode'] ?? false;
|
||||
isEditProfile = extraData['isEditProfile'] ?? false;
|
||||
});
|
||||
@ -444,7 +446,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
userMap = {
|
||||
for (var user in userList)
|
||||
user['user_id'].toString():
|
||||
"${user['first_name']} ${user['last_name']}",
|
||||
"${user['first_name']} ${user['last_name']}",
|
||||
};
|
||||
userIdsApi = userMap.keys.toList();
|
||||
});
|
||||
@ -483,14 +485,14 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
|
||||
setState(() {
|
||||
layoutColor =
|
||||
layoutString != null
|
||||
? Color(int.parse(layoutString))
|
||||
: Colors.redAccent;
|
||||
layoutString != null
|
||||
? Color(int.parse(layoutString))
|
||||
: Colors.redAccent;
|
||||
|
||||
bodyColor =
|
||||
bodyStringColor != null
|
||||
? Color(int.parse(bodyStringColor))
|
||||
: Colors.white;
|
||||
bodyStringColor != null
|
||||
? Color(int.parse(bodyStringColor))
|
||||
: Colors.white;
|
||||
});
|
||||
}
|
||||
|
||||
@ -656,9 +658,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
// printFormData();
|
||||
|
||||
bool isValid = travellerDetailsKey.currentState?.boolValidation() ?? false;
|
||||
if (selectedTab == "travel" ||
|
||||
selectedRole == "5" ||
|
||||
setSelectesUserType == true) {
|
||||
if (selectedRole == "5" || setSelectesUserType == true) {
|
||||
print("NO validation");
|
||||
|
||||
Map<String, dynamic> data = userDetials;
|
||||
@ -702,30 +702,64 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
|
||||
// block-submit-here
|
||||
|
||||
// Additional validation starts - travelDetailsData passport
|
||||
DateTime? start_Date = travelDetailsData?['date_of_issue'];
|
||||
DateTime? end_Date = travelDetailsData?['date_of_expiry'];
|
||||
final format = DateFormat("dd-MM-yyyy");
|
||||
|
||||
if (start_Date != null && end_Date != null && start_Date.toString().isNotEmpty && end_Date.toString().isNotEmpty) {
|
||||
try {
|
||||
final format = DateFormat("dd-MM-yyyy");
|
||||
final checkStartDate = format.parse("$start_Date");
|
||||
final checkEndDate = format.parse("$end_Date");
|
||||
DateTime? start_Date;
|
||||
DateTime? end_Date;
|
||||
|
||||
if (checkEndDate.isBefore(checkStartDate)) {
|
||||
// return "End date cannot be earlier than start date";;
|
||||
return ;
|
||||
}
|
||||
} catch (e) { // return "End date cannot be earlier than start date";
|
||||
return ;
|
||||
// errorMessages["end_date"] = "Invalid date format";
|
||||
try {
|
||||
if (travelDetailsData?['date_of_issue'] != null &&
|
||||
travelDetailsData!['date_of_issue'].toString().isNotEmpty) {
|
||||
start_Date = format.parse(travelDetailsData!['date_of_issue']);
|
||||
}
|
||||
if (travelDetailsData?['date_of_expiry'] != null &&
|
||||
travelDetailsData!['date_of_expiry'].toString().isNotEmpty) {
|
||||
end_Date = format.parse(travelDetailsData!['date_of_expiry']);
|
||||
}
|
||||
|
||||
if (start_Date != null &&
|
||||
end_Date != null &&
|
||||
end_Date.isBefore(start_Date)) {
|
||||
print("End date cannot be earlier than start date");
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
print("Invalid passport date format");
|
||||
return;
|
||||
}
|
||||
|
||||
// Additional validation starts - travelDetailsData passport
|
||||
// DateTime? start_Date = travelDetailsData?['date_of_issue'];
|
||||
// DateTime? end_Date = travelDetailsData?['date_of_expiry'];
|
||||
//
|
||||
// if (start_Date != null &&
|
||||
// end_Date != null &&
|
||||
// start_Date.toString().isNotEmpty &&
|
||||
// end_Date.toString().isNotEmpty) {
|
||||
// try {
|
||||
// final format = DateFormat("dd-MM-yyyy");
|
||||
// final checkStartDate = format.parse("$start_Date");
|
||||
// final checkEndDate = format.parse("$end_Date");
|
||||
//
|
||||
// if (checkEndDate.isBefore(checkStartDate)) {
|
||||
// // return "End date cannot be earlier than start date";;
|
||||
// return;
|
||||
// }
|
||||
// } catch (e) {
|
||||
// // return "End date cannot be earlier than start date";
|
||||
// return;
|
||||
// // errorMessages["end_date"] = "Invalid date format";
|
||||
// }
|
||||
// }
|
||||
|
||||
// valid_from: 20-06-2025, valid_upto: 19-06-2025
|
||||
DateTime? valid_from = data?['valid_from'];
|
||||
DateTime? valid_upto = data?['valid_upto'];
|
||||
|
||||
if (valid_from != null && valid_upto != null && valid_from.toString().isNotEmpty && valid_upto.toString().isNotEmpty) {
|
||||
if (valid_from != null &&
|
||||
valid_upto != null &&
|
||||
valid_from.toString().isNotEmpty &&
|
||||
valid_upto.toString().isNotEmpty) {
|
||||
try {
|
||||
final format = DateFormat("dd-MM-yyyy");
|
||||
final checkValidFrom = format.parse("$valid_from");
|
||||
@ -733,10 +767,11 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
|
||||
if (checkValidUpto.isBefore(checkValidFrom)) {
|
||||
// return "valid upto cannot be earlier than valid from";
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
} catch (e) { // return "valid upto cannot be earlier than valid from";
|
||||
return ;
|
||||
} catch (e) {
|
||||
// return "valid upto cannot be earlier than valid from";
|
||||
return;
|
||||
// errorMessages["end_date"] = "Invalid date format";
|
||||
}
|
||||
}
|
||||
@ -785,7 +820,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
if (data["mobile_no"] != null && data["mobile_no"].toString().isNotEmpty) {
|
||||
if (!RegExp(r"^\d{10}$").hasMatch(data["mobile_no"].toString())) {
|
||||
errorMessages["mobile_no"] =
|
||||
"Enter 10 digits"; // Invalid mobile number format
|
||||
"Enter 10 digits"; // Invalid mobile number format
|
||||
}
|
||||
}
|
||||
|
||||
@ -795,7 +830,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
r"^\d{10}$",
|
||||
).hasMatch(data["alternate_mobile_no"].toString())) {
|
||||
errorMessages["alternate_mobile_no"] =
|
||||
"Enter 10 digits"; // Invalid mobile number format
|
||||
"Enter 10 digits"; // Invalid mobile number format
|
||||
}
|
||||
}
|
||||
|
||||
@ -985,7 +1020,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
// ✅ Ensure UI updates
|
||||
if (isMatch) {
|
||||
errorMessages["password"] =
|
||||
"New password is not similar to old password";
|
||||
"New password is not similar to old password";
|
||||
print(" Password match!");
|
||||
} else {
|
||||
print(" Password NOT match!");
|
||||
@ -1014,16 +1049,16 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
drawer: CustomDrawer(isDesktop: false),
|
||||
body: Padding(
|
||||
padding:
|
||||
isDesktop
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal:
|
||||
MediaQuery.of(context).size.width *
|
||||
0.1, // 30% of screen width as horizontal padding
|
||||
vertical:
|
||||
MediaQuery.of(context).size.height *
|
||||
0, // 5% of screen height as vertical padding
|
||||
)
|
||||
: EdgeInsets.all(0),
|
||||
isDesktop
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal:
|
||||
MediaQuery.of(context).size.width *
|
||||
0.1, // 30% of screen width as horizontal padding
|
||||
vertical:
|
||||
MediaQuery.of(context).size.height *
|
||||
0, // 5% of screen height as vertical padding
|
||||
)
|
||||
: EdgeInsets.all(0),
|
||||
child: Row(
|
||||
children: [Expanded(child: buildData(isDesktop, context))],
|
||||
),
|
||||
@ -1045,9 +1080,9 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
Expanded(
|
||||
child: Container(
|
||||
height:
|
||||
isDesktop
|
||||
? MediaQuery.of(context).size.height * 0.98
|
||||
: MediaQuery.of(context).size.height,
|
||||
isDesktop
|
||||
? MediaQuery.of(context).size.height * 0.98
|
||||
: MediaQuery.of(context).size.height,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(0.0),
|
||||
child: _buildUserDetails(isDesktop),
|
||||
@ -1059,39 +1094,39 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child:
|
||||
isDesktop
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
if (selectedTab != "personal")
|
||||
..._buildBack(isDesktop, layoutColor!),
|
||||
Spacer(), // spacing between buttons
|
||||
// Next or Submit based on role or user type
|
||||
if (selectedTab == "travel" ||
|
||||
selectedRole == "5" ||
|
||||
setSelectesUserType == true)
|
||||
..._buildSubmit(isDesktop, layoutColor!)
|
||||
else
|
||||
..._buildNext(isDesktop, layoutColor!),
|
||||
// (selectedTab == "travel" ||
|
||||
// selectedRole == "5" ||
|
||||
// setSelectesUserType == true)
|
||||
// ? _buildSubmit(isDesktop, layoutColor!)
|
||||
// : _buildNext(
|
||||
// isDesktop,
|
||||
// layoutColor!,
|
||||
// ), // _buildGoBack(isDesktop, layoutColor!),
|
||||
],
|
||||
)
|
||||
: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children:
|
||||
(selectedTab == "travel" ||
|
||||
selectedRole == "5" ||
|
||||
setSelectesUserType == true)
|
||||
? _buildSubmit(isDesktop, layoutColor!)
|
||||
: _buildNext(isDesktop, layoutColor!),
|
||||
),
|
||||
isDesktop
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
if (selectedTab != "personal")
|
||||
..._buildBack(isDesktop, layoutColor!),
|
||||
Spacer(), // spacing between buttons
|
||||
// Next or Submit based on role or user type
|
||||
if (selectedTab == "travel" ||
|
||||
selectedRole == "5" ||
|
||||
setSelectesUserType == true)
|
||||
..._buildSubmit(isDesktop, layoutColor!)
|
||||
else
|
||||
..._buildNext(isDesktop, layoutColor!),
|
||||
// (selectedTab == "travel" ||
|
||||
// selectedRole == "5" ||
|
||||
// setSelectesUserType == true)
|
||||
// ? _buildSubmit(isDesktop, layoutColor!)
|
||||
// : _buildNext(
|
||||
// isDesktop,
|
||||
// layoutColor!,
|
||||
// ), // _buildGoBack(isDesktop, layoutColor!),
|
||||
],
|
||||
)
|
||||
: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children:
|
||||
(selectedTab == "travel" ||
|
||||
selectedRole == "5" ||
|
||||
setSelectesUserType == true)
|
||||
? _buildSubmit(isDesktop, layoutColor!)
|
||||
: _buildNext(isDesktop, layoutColor!),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -1136,9 +1171,9 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
isDesktop
|
||||
? buildTabsForUser()
|
||||
: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: buildTabsForUser(),
|
||||
),
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: buildTabsForUser(),
|
||||
),
|
||||
Container(
|
||||
// color: Colors.yellow.shade50,
|
||||
height: MediaQuery.of(context).size.height * 0.64,
|
||||
@ -1241,8 +1276,8 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
);
|
||||
case "travel":
|
||||
final fullName =
|
||||
"${controllers["Fname"]?.text ?? ""} ${controllers["Lname"]?.text ?? ""}"
|
||||
.trim();
|
||||
"${controllers["Fname"]?.text ?? ""} ${controllers["Lname"]?.text ?? ""}"
|
||||
.trim();
|
||||
return TravellerDetails(
|
||||
key: travellerDetailsKey,
|
||||
isDesktop: isDesktop,
|
||||
@ -1301,69 +1336,69 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end, // important
|
||||
children:
|
||||
tabs.entries.map((entry) {
|
||||
final targetTab = entry.key;
|
||||
tabs.entries.map((entry) {
|
||||
final targetTab = entry.key;
|
||||
|
||||
print("TargetsTAb: $targetTab");
|
||||
print("TargetsTAb: $targetTab");
|
||||
|
||||
final isSelected = selectedTab == entry.key;
|
||||
print("isSelected: $isSelected");
|
||||
final isSelected = selectedTab == entry.key;
|
||||
print("isSelected: $isSelected");
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
bool isValid = false;
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
bool isValid = false;
|
||||
|
||||
final currentTab = selectedTab;
|
||||
if (currentTab == "personal") {
|
||||
isValid = isValidData(userDetials);
|
||||
final currentTab = selectedTab;
|
||||
if (currentTab == "personal") {
|
||||
isValid = isValidData(userDetials);
|
||||
|
||||
if (isValid) {
|
||||
selectedTab = entry.key;
|
||||
}
|
||||
} else if (currentTab == "office" &&
|
||||
targetTab == "personal") {
|
||||
selectedTab = entry.key;
|
||||
} else if (currentTab == "office") {
|
||||
isValid = isValidDataTwo(userDetials);
|
||||
if (isValid) {
|
||||
selectedTab = entry.key;
|
||||
}
|
||||
} else {
|
||||
isValid =
|
||||
true; // Travel tab might not need validation at this point
|
||||
selectedTab = entry.key;
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 24.0,
|
||||
), // space between tabs
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
entry.value,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color:
|
||||
isSelected ? Color(0xFF114D8B) : Color(0xFF475569),
|
||||
),
|
||||
if (isValid) {
|
||||
selectedTab = entry.key;
|
||||
}
|
||||
} else if (currentTab == "office" &&
|
||||
targetTab == "personal") {
|
||||
selectedTab = entry.key;
|
||||
} else if (currentTab == "office") {
|
||||
isValid = isValidDataTwo(userDetials);
|
||||
if (isValid) {
|
||||
selectedTab = entry.key;
|
||||
}
|
||||
} else {
|
||||
isValid =
|
||||
true; // Travel tab might not need validation at this point
|
||||
selectedTab = entry.key;
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 24.0,
|
||||
), // space between tabs
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
entry.value,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color:
|
||||
isSelected ? Color(0xFF114D8B) : Color(0xFF475569),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
AnimatedContainer(
|
||||
duration: Duration(milliseconds: 300),
|
||||
height: 2,
|
||||
width: isSelected ? 50 : 0, // small line
|
||||
color: Color(0xFF114D8B),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
AnimatedContainer(
|
||||
duration: Duration(milliseconds: 300),
|
||||
height: 2,
|
||||
width: isSelected ? 50 : 0, // small line
|
||||
color: Color(0xFF114D8B),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
}
|
||||
|
||||
@ -1373,17 +1408,17 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
return [
|
||||
MouseRegion(
|
||||
cursor:
|
||||
isViewMode
|
||||
? SystemMouseCursors.forbidden
|
||||
: SystemMouseCursors.click,
|
||||
isViewMode
|
||||
? SystemMouseCursors.forbidden
|
||||
: SystemMouseCursors.click,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor:
|
||||
isViewMode ? layoutColor : layoutColor, // Keep original color
|
||||
isViewMode ? layoutColor : layoutColor, // Keep original color
|
||||
foregroundColor:
|
||||
isViewMode ? Colors.white : Colors.white, // Keep original color
|
||||
isViewMode ? Colors.white : Colors.white, // Keep original color
|
||||
disabledBackgroundColor:
|
||||
layoutColor, // Ensure color remains when disabled
|
||||
layoutColor, // Ensure color remains when disabled
|
||||
disabledForegroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
@ -1402,17 +1437,17 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
return [
|
||||
MouseRegion(
|
||||
cursor:
|
||||
isViewMode
|
||||
? SystemMouseCursors.forbidden
|
||||
: SystemMouseCursors.click,
|
||||
isViewMode
|
||||
? SystemMouseCursors.forbidden
|
||||
: SystemMouseCursors.click,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor:
|
||||
isViewMode ? layoutColor : layoutColor, // Keep original color
|
||||
isViewMode ? layoutColor : layoutColor, // Keep original color
|
||||
foregroundColor:
|
||||
isViewMode ? Colors.white : Colors.white, // Keep original color
|
||||
isViewMode ? Colors.white : Colors.white, // Keep original color
|
||||
disabledBackgroundColor:
|
||||
layoutColor, // Ensure color remains when disabled
|
||||
layoutColor, // Ensure color remains when disabled
|
||||
disabledForegroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
@ -1433,17 +1468,17 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
return [
|
||||
MouseRegion(
|
||||
cursor:
|
||||
isViewMode
|
||||
? SystemMouseCursors.forbidden
|
||||
: SystemMouseCursors.click,
|
||||
isViewMode
|
||||
? SystemMouseCursors.forbidden
|
||||
: SystemMouseCursors.click,
|
||||
child: TextButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor:
|
||||
isViewMode ? Colors.white : Colors.white, // Keep original color
|
||||
isViewMode ? Colors.white : Colors.white, // Keep original color
|
||||
foregroundColor:
|
||||
isViewMode ? layoutColor : layoutColor, // Keep original color
|
||||
isViewMode ? layoutColor : layoutColor, // Keep original color
|
||||
disabledBackgroundColor:
|
||||
layoutColor, // Ensure color remains when disabled
|
||||
layoutColor, // Ensure color remains when disabled
|
||||
disabledForegroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
@ -1481,19 +1516,19 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
if (!isViewMode)
|
||||
MouseRegion(
|
||||
cursor:
|
||||
isViewMode
|
||||
? SystemMouseCursors.forbidden
|
||||
: SystemMouseCursors.click,
|
||||
isViewMode
|
||||
? SystemMouseCursors.forbidden
|
||||
: SystemMouseCursors.click,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor:
|
||||
isViewMode ? layoutColor : layoutColor, // Keep original color
|
||||
isViewMode ? layoutColor : layoutColor, // Keep original color
|
||||
foregroundColor:
|
||||
isViewMode
|
||||
? Colors.white
|
||||
: Colors.white, // Keep original color
|
||||
isViewMode
|
||||
? Colors.white
|
||||
: Colors.white, // Keep original color
|
||||
disabledBackgroundColor:
|
||||
layoutColor, // Ensure color remains when disabled
|
||||
layoutColor, // Ensure color remains when disabled
|
||||
disabledForegroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
@ -1502,7 +1537,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
),
|
||||
onPressed:
|
||||
isViewMode ? null : handleSubmit, // Disable when in view mode
|
||||
isViewMode ? null : handleSubmit, // Disable when in view mode
|
||||
child: Text("Submit"),
|
||||
),
|
||||
),
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
This is a placeholder for base href that will be replaced by the value of
|
||||
the `--base-href` argument provided to `flutter build`.
|
||||
-->
|
||||
<base href="$FLUTTER_BASE_HREF">
|
||||
<base href="/tstat/">
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user