merge with old
This commit is contained in:
commit
5a3c2a7fb9
File diff suppressed because it is too large
Load Diff
@ -42,9 +42,9 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
final ApiService apiService = ApiService();
|
final ApiService apiService = ApiService();
|
||||||
|
|
||||||
final GlobalKey<PersonalDetailsState> personalDetailsKey =
|
final GlobalKey<PersonalDetailsState> personalDetailsKey =
|
||||||
GlobalKey<PersonalDetailsState>();
|
GlobalKey<PersonalDetailsState>();
|
||||||
final GlobalKey<TravellerDetailsState> travellerDetailsKey =
|
final GlobalKey<TravellerDetailsState> travellerDetailsKey =
|
||||||
GlobalKey<TravellerDetailsState>();
|
GlobalKey<TravellerDetailsState>();
|
||||||
|
|
||||||
// late List<Map<String, dynamic>?> travelDetailsData;
|
// late List<Map<String, dynamic>?> travelDetailsData;
|
||||||
Map<String, dynamic>? travelDetailsData;
|
Map<String, dynamic>? travelDetailsData;
|
||||||
@ -299,7 +299,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
// Fix the invalid JSON (dangerous if the format changes)
|
// Fix the invalid JSON (dangerous if the format changes)
|
||||||
final fixedJson = raw.replaceAllMapped(
|
final fixedJson = raw.replaceAllMapped(
|
||||||
RegExp(r'(\w+):'), // matches `service_id:`
|
RegExp(r'(\w+):'), // matches `service_id:`
|
||||||
(match) => '"${match.group(1)}":',
|
(match) => '"${match.group(1)}":',
|
||||||
);
|
);
|
||||||
|
|
||||||
List<dynamic> decodedList = jsonDecode(fixedJson);
|
List<dynamic> decodedList = jsonDecode(fixedJson);
|
||||||
@ -363,7 +363,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
final extraData =
|
final extraData =
|
||||||
GoRouterState.of(context).extra as Map<String, dynamic>?;
|
GoRouterState.of(context).extra as Map<String, dynamic>?;
|
||||||
|
|
||||||
if (extraData != null) {
|
if (extraData != null) {
|
||||||
print("extraData: ${extraData['selectedUser']}");
|
print("extraData: ${extraData['selectedUser']}");
|
||||||
@ -381,8 +381,8 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
|
|
||||||
// Handle selectedUser as a Map (not a List)
|
// Handle selectedUser as a Map (not a List)
|
||||||
apiselectedUser =
|
apiselectedUser =
|
||||||
extraData['selectedUser']
|
extraData['selectedUser']
|
||||||
as Map<String, dynamic>?; // Cast it as a Map
|
as Map<String, dynamic>?; // Cast it as a Map
|
||||||
isViewMode = extraData['isViewMode'] ?? false;
|
isViewMode = extraData['isViewMode'] ?? false;
|
||||||
isEditProfile = extraData['isEditProfile'] ?? false;
|
isEditProfile = extraData['isEditProfile'] ?? false;
|
||||||
});
|
});
|
||||||
@ -444,7 +444,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
userMap = {
|
userMap = {
|
||||||
for (var user in userList)
|
for (var user in userList)
|
||||||
user['user_id'].toString():
|
user['user_id'].toString():
|
||||||
"${user['first_name']} ${user['last_name']}",
|
"${user['first_name']} ${user['last_name']}",
|
||||||
};
|
};
|
||||||
userIdsApi = userMap.keys.toList();
|
userIdsApi = userMap.keys.toList();
|
||||||
});
|
});
|
||||||
@ -483,14 +483,14 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
layoutColor =
|
layoutColor =
|
||||||
layoutString != null
|
layoutString != null
|
||||||
? Color(int.parse(layoutString))
|
? Color(int.parse(layoutString))
|
||||||
: Colors.redAccent;
|
: Colors.redAccent;
|
||||||
|
|
||||||
bodyColor =
|
bodyColor =
|
||||||
bodyStringColor != null
|
bodyStringColor != null
|
||||||
? Color(int.parse(bodyStringColor))
|
? Color(int.parse(bodyStringColor))
|
||||||
: Colors.white;
|
: Colors.white;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,7 +582,6 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
travelDetailsData = travellerDetailsKey.currentState?.travel_Detials;
|
travelDetailsData = travellerDetailsKey.currentState?.travel_Detials;
|
||||||
// errorMessagesTravel = travellerDetailsKey.currentState!.errorMessages;
|
// errorMessagesTravel = travellerDetailsKey.currentState!.errorMessages;
|
||||||
|
|
||||||
|
|
||||||
print("TRAVEL DETAILS FROM CHILD: $travelDetailsData");
|
print("TRAVEL DETAILS FROM CHILD: $travelDetailsData");
|
||||||
|
|
||||||
Map<String, dynamic> data = userDetials;
|
Map<String, dynamic> data = userDetials;
|
||||||
@ -657,56 +656,38 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
// printFormData();
|
// printFormData();
|
||||||
|
|
||||||
bool isValid = travellerDetailsKey.currentState?.boolValidation() ?? false;
|
bool isValid = travellerDetailsKey.currentState?.boolValidation() ?? false;
|
||||||
|
if (selectedTab == "travel" ||
|
||||||
|
selectedRole == "5" ||
|
||||||
|
setSelectesUserType == true) {
|
||||||
|
print("NO validation");
|
||||||
|
|
||||||
print("isValid- $isValid");
|
Map<String, dynamic> data = userDetials;
|
||||||
if (!isValid) {
|
|
||||||
print("Validation failed. Please check the inputs.");
|
if (!isValidData(data)) {
|
||||||
setState(() {});
|
print("USERDETAILS : $userDetials");
|
||||||
return; // ❌ STOP execution here if not valid
|
print("Validation Failed: Required fields are missing.");
|
||||||
}
|
setState(() {});
|
||||||
|
return; // Stop execution if validation fails
|
||||||
|
} else {
|
||||||
|
print("USERDETAILS : $userDetials");
|
||||||
|
orgId = await getOrgId();
|
||||||
|
|
||||||
|
createUserData(userDetials);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print("isValid- $isValid");
|
||||||
|
if (!isValid) {
|
||||||
|
print("Validation failed. Please check the inputs.");
|
||||||
|
setState(() {});
|
||||||
|
return; // ❌ STOP execution here if not valid
|
||||||
|
}
|
||||||
|
|
||||||
travelDetailsData = travellerDetailsKey.currentState?.travel_Detials;
|
travelDetailsData = travellerDetailsKey.currentState?.travel_Detials;
|
||||||
|
|
||||||
|
print("travelDetailsData - $travelDetailsData");
|
||||||
|
|
||||||
// Additional validation starts - travelDetailsData passport
|
print("travelDetailsData - $travelDetailsData");
|
||||||
String start_Date = travelDetailsData?['date_of_issue'];
|
// errorMessagesTravel = travellerDetailsKey.currentState!.errorMessages;
|
||||||
String 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";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// String valid_from = travelDetailsData?['valid_from'];
|
|
||||||
// String valid_upto = travelDetailsData?['valid_upto'];
|
|
||||||
//
|
|
||||||
// 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");
|
|
||||||
// final checkValidUpto = format.parse("$valid_upto");
|
|
||||||
//
|
|
||||||
// if (checkValidUpto.isBefore(checkValidFrom)) {
|
|
||||||
// // 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";
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// errorMessagesTravel = travellerDetailsKey.currentState!.errorMessages;
|
|
||||||
|
|
||||||
print("TRAVEL DETAILS FROM CHILD");
|
print("TRAVEL DETAILS FROM CHILD");
|
||||||
// print("TRAVEL DETAILS FROM CHILD: $travelDetailsData");
|
// print("TRAVEL DETAILS FROM CHILD: $travelDetailsData");
|
||||||
@ -731,6 +712,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
orgId = await getOrgId();
|
orgId = await getOrgId();
|
||||||
|
|
||||||
createUserData(userDetials);
|
createUserData(userDetials);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -762,7 +744,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
if (data["mobile_no"] != null && data["mobile_no"].toString().isNotEmpty) {
|
if (data["mobile_no"] != null && data["mobile_no"].toString().isNotEmpty) {
|
||||||
if (!RegExp(r"^\d{10}$").hasMatch(data["mobile_no"].toString())) {
|
if (!RegExp(r"^\d{10}$").hasMatch(data["mobile_no"].toString())) {
|
||||||
errorMessages["mobile_no"] =
|
errorMessages["mobile_no"] =
|
||||||
"Enter 10 digits"; // Invalid mobile number format
|
"Enter 10 digits"; // Invalid mobile number format
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -772,7 +754,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
r"^\d{10}$",
|
r"^\d{10}$",
|
||||||
).hasMatch(data["alternate_mobile_no"].toString())) {
|
).hasMatch(data["alternate_mobile_no"].toString())) {
|
||||||
errorMessages["alternate_mobile_no"] =
|
errorMessages["alternate_mobile_no"] =
|
||||||
"Enter 10 digits"; // Invalid mobile number format
|
"Enter 10 digits"; // Invalid mobile number format
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -962,7 +944,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
// ✅ Ensure UI updates
|
// ✅ Ensure UI updates
|
||||||
if (isMatch) {
|
if (isMatch) {
|
||||||
errorMessages["password"] =
|
errorMessages["password"] =
|
||||||
"New password is not similar to old password";
|
"New password is not similar to old password";
|
||||||
print(" Password match!");
|
print(" Password match!");
|
||||||
} else {
|
} else {
|
||||||
print(" Password NOT match!");
|
print(" Password NOT match!");
|
||||||
@ -991,16 +973,16 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
drawer: CustomDrawer(isDesktop: false),
|
drawer: CustomDrawer(isDesktop: false),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding:
|
padding:
|
||||||
isDesktop
|
isDesktop
|
||||||
? EdgeInsets.symmetric(
|
? EdgeInsets.symmetric(
|
||||||
horizontal:
|
horizontal:
|
||||||
MediaQuery.of(context).size.width *
|
MediaQuery.of(context).size.width *
|
||||||
0.1, // 30% of screen width as horizontal padding
|
0.1, // 30% of screen width as horizontal padding
|
||||||
vertical:
|
vertical:
|
||||||
MediaQuery.of(context).size.height *
|
MediaQuery.of(context).size.height *
|
||||||
0, // 5% of screen height as vertical padding
|
0, // 5% of screen height as vertical padding
|
||||||
)
|
)
|
||||||
: EdgeInsets.all(0),
|
: EdgeInsets.all(0),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [Expanded(child: buildData(isDesktop, context))],
|
children: [Expanded(child: buildData(isDesktop, context))],
|
||||||
),
|
),
|
||||||
@ -1022,9 +1004,9 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
height:
|
height:
|
||||||
isDesktop
|
isDesktop
|
||||||
? MediaQuery.of(context).size.height * 0.98
|
? MediaQuery.of(context).size.height * 0.98
|
||||||
: MediaQuery.of(context).size.height,
|
: MediaQuery.of(context).size.height,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(0.0),
|
padding: EdgeInsets.all(0.0),
|
||||||
child: _buildUserDetails(isDesktop),
|
child: _buildUserDetails(isDesktop),
|
||||||
@ -1036,39 +1018,39 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child:
|
child:
|
||||||
isDesktop
|
isDesktop
|
||||||
? Row(
|
? Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
if (selectedTab != "personal")
|
if (selectedTab != "personal")
|
||||||
..._buildBack(isDesktop, layoutColor!),
|
..._buildBack(isDesktop, layoutColor!),
|
||||||
Spacer(), // spacing between buttons
|
Spacer(), // spacing between buttons
|
||||||
// Next or Submit based on role or user type
|
// Next or Submit based on role or user type
|
||||||
if (selectedTab == "travel" ||
|
if (selectedTab == "travel" ||
|
||||||
selectedRole == "5" ||
|
selectedRole == "5" ||
|
||||||
setSelectesUserType == true)
|
setSelectesUserType == true)
|
||||||
..._buildSubmit(isDesktop, layoutColor!)
|
..._buildSubmit(isDesktop, layoutColor!)
|
||||||
else
|
else
|
||||||
..._buildNext(isDesktop, layoutColor!),
|
..._buildNext(isDesktop, layoutColor!),
|
||||||
// (selectedTab == "travel" ||
|
// (selectedTab == "travel" ||
|
||||||
// selectedRole == "5" ||
|
// selectedRole == "5" ||
|
||||||
// setSelectesUserType == true)
|
// setSelectesUserType == true)
|
||||||
// ? _buildSubmit(isDesktop, layoutColor!)
|
// ? _buildSubmit(isDesktop, layoutColor!)
|
||||||
// : _buildNext(
|
// : _buildNext(
|
||||||
// isDesktop,
|
// isDesktop,
|
||||||
// layoutColor!,
|
// layoutColor!,
|
||||||
// ), // _buildGoBack(isDesktop, layoutColor!),
|
// ), // _buildGoBack(isDesktop, layoutColor!),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: Row(
|
: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children:
|
children:
|
||||||
(selectedTab == "travel" ||
|
(selectedTab == "travel" ||
|
||||||
selectedRole == "5" ||
|
selectedRole == "5" ||
|
||||||
setSelectesUserType == true)
|
setSelectesUserType == true)
|
||||||
? _buildSubmit(isDesktop, layoutColor!)
|
? _buildSubmit(isDesktop, layoutColor!)
|
||||||
: _buildNext(isDesktop, layoutColor!),
|
: _buildNext(isDesktop, layoutColor!),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -1113,9 +1095,9 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
isDesktop
|
isDesktop
|
||||||
? buildTabsForUser()
|
? buildTabsForUser()
|
||||||
: SingleChildScrollView(
|
: SingleChildScrollView(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
child: buildTabsForUser(),
|
child: buildTabsForUser(),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
// color: Colors.yellow.shade50,
|
// color: Colors.yellow.shade50,
|
||||||
height: MediaQuery.of(context).size.height * 0.64,
|
height: MediaQuery.of(context).size.height * 0.64,
|
||||||
@ -1218,8 +1200,8 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
);
|
);
|
||||||
case "travel":
|
case "travel":
|
||||||
final fullName =
|
final fullName =
|
||||||
"${controllers["Fname"]?.text ?? ""} ${controllers["Lname"]?.text ?? ""}"
|
"${controllers["Fname"]?.text ?? ""} ${controllers["Lname"]?.text ?? ""}"
|
||||||
.trim();
|
.trim();
|
||||||
return TravellerDetails(
|
return TravellerDetails(
|
||||||
key: travellerDetailsKey,
|
key: travellerDetailsKey,
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
@ -1278,69 +1260,69 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
return Row(
|
return Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.end, // important
|
crossAxisAlignment: CrossAxisAlignment.end, // important
|
||||||
children:
|
children:
|
||||||
tabs.entries.map((entry) {
|
tabs.entries.map((entry) {
|
||||||
final targetTab = entry.key;
|
final targetTab = entry.key;
|
||||||
|
|
||||||
print("TargetsTAb: $targetTab");
|
print("TargetsTAb: $targetTab");
|
||||||
|
|
||||||
final isSelected = selectedTab == entry.key;
|
final isSelected = selectedTab == entry.key;
|
||||||
print("isSelected: $isSelected");
|
print("isSelected: $isSelected");
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
bool isValid = false;
|
bool isValid = false;
|
||||||
|
|
||||||
final currentTab = selectedTab;
|
final currentTab = selectedTab;
|
||||||
if (currentTab == "personal") {
|
if (currentTab == "personal") {
|
||||||
isValid = isValidData(userDetials);
|
isValid = isValidData(userDetials);
|
||||||
|
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
selectedTab = entry.key;
|
selectedTab = entry.key;
|
||||||
}
|
}
|
||||||
} else if (currentTab == "office" &&
|
} else if (currentTab == "office" &&
|
||||||
targetTab == "personal") {
|
targetTab == "personal") {
|
||||||
selectedTab = entry.key;
|
selectedTab = entry.key;
|
||||||
} else if (currentTab == "office") {
|
} else if (currentTab == "office") {
|
||||||
isValid = isValidDataTwo(userDetials);
|
isValid = isValidDataTwo(userDetials);
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
selectedTab = entry.key;
|
selectedTab = entry.key;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
isValid =
|
isValid =
|
||||||
true; // Travel tab might not need validation at this point
|
true; // Travel tab might not need validation at this point
|
||||||
selectedTab = entry.key;
|
selectedTab = entry.key;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
right: 24.0,
|
right: 24.0,
|
||||||
), // space between tabs
|
), // space between tabs
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
entry.value,
|
entry.value,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color:
|
color:
|
||||||
isSelected ? Color(0xFF114D8B) : Color(0xFF475569),
|
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(
|
||||||
}).toList(),
|
duration: Duration(milliseconds: 300),
|
||||||
|
height: 2,
|
||||||
|
width: isSelected ? 50 : 0, // small line
|
||||||
|
color: Color(0xFF114D8B),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1350,17 +1332,17 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
return [
|
return [
|
||||||
MouseRegion(
|
MouseRegion(
|
||||||
cursor:
|
cursor:
|
||||||
isViewMode
|
isViewMode
|
||||||
? SystemMouseCursors.forbidden
|
? SystemMouseCursors.forbidden
|
||||||
: SystemMouseCursors.click,
|
: SystemMouseCursors.click,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
isViewMode ? layoutColor : layoutColor, // Keep original color
|
isViewMode ? layoutColor : layoutColor, // Keep original color
|
||||||
foregroundColor:
|
foregroundColor:
|
||||||
isViewMode ? Colors.white : Colors.white, // Keep original color
|
isViewMode ? Colors.white : Colors.white, // Keep original color
|
||||||
disabledBackgroundColor:
|
disabledBackgroundColor:
|
||||||
layoutColor, // Ensure color remains when disabled
|
layoutColor, // Ensure color remains when disabled
|
||||||
disabledForegroundColor: Colors.white,
|
disabledForegroundColor: Colors.white,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
@ -1379,17 +1361,17 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
return [
|
return [
|
||||||
MouseRegion(
|
MouseRegion(
|
||||||
cursor:
|
cursor:
|
||||||
isViewMode
|
isViewMode
|
||||||
? SystemMouseCursors.forbidden
|
? SystemMouseCursors.forbidden
|
||||||
: SystemMouseCursors.click,
|
: SystemMouseCursors.click,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
isViewMode ? layoutColor : layoutColor, // Keep original color
|
isViewMode ? layoutColor : layoutColor, // Keep original color
|
||||||
foregroundColor:
|
foregroundColor:
|
||||||
isViewMode ? Colors.white : Colors.white, // Keep original color
|
isViewMode ? Colors.white : Colors.white, // Keep original color
|
||||||
disabledBackgroundColor:
|
disabledBackgroundColor:
|
||||||
layoutColor, // Ensure color remains when disabled
|
layoutColor, // Ensure color remains when disabled
|
||||||
disabledForegroundColor: Colors.white,
|
disabledForegroundColor: Colors.white,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
@ -1410,17 +1392,17 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
return [
|
return [
|
||||||
MouseRegion(
|
MouseRegion(
|
||||||
cursor:
|
cursor:
|
||||||
isViewMode
|
isViewMode
|
||||||
? SystemMouseCursors.forbidden
|
? SystemMouseCursors.forbidden
|
||||||
: SystemMouseCursors.click,
|
: SystemMouseCursors.click,
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
isViewMode ? Colors.white : Colors.white, // Keep original color
|
isViewMode ? Colors.white : Colors.white, // Keep original color
|
||||||
foregroundColor:
|
foregroundColor:
|
||||||
isViewMode ? layoutColor : layoutColor, // Keep original color
|
isViewMode ? layoutColor : layoutColor, // Keep original color
|
||||||
disabledBackgroundColor:
|
disabledBackgroundColor:
|
||||||
layoutColor, // Ensure color remains when disabled
|
layoutColor, // Ensure color remains when disabled
|
||||||
disabledForegroundColor: Colors.white,
|
disabledForegroundColor: Colors.white,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
@ -1458,19 +1440,19 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
if (!isViewMode)
|
if (!isViewMode)
|
||||||
MouseRegion(
|
MouseRegion(
|
||||||
cursor:
|
cursor:
|
||||||
isViewMode
|
isViewMode
|
||||||
? SystemMouseCursors.forbidden
|
? SystemMouseCursors.forbidden
|
||||||
: SystemMouseCursors.click,
|
: SystemMouseCursors.click,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
isViewMode ? layoutColor : layoutColor, // Keep original color
|
isViewMode ? layoutColor : layoutColor, // Keep original color
|
||||||
foregroundColor:
|
foregroundColor:
|
||||||
isViewMode
|
isViewMode
|
||||||
? Colors.white
|
? Colors.white
|
||||||
: Colors.white, // Keep original color
|
: Colors.white, // Keep original color
|
||||||
disabledBackgroundColor:
|
disabledBackgroundColor:
|
||||||
layoutColor, // Ensure color remains when disabled
|
layoutColor, // Ensure color remains when disabled
|
||||||
disabledForegroundColor: Colors.white,
|
disabledForegroundColor: Colors.white,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
@ -1479,7 +1461,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||||
),
|
),
|
||||||
onPressed:
|
onPressed:
|
||||||
isViewMode ? null : handleSubmit, // Disable when in view mode
|
isViewMode ? null : handleSubmit, // Disable when in view mode
|
||||||
child: Text("Submit"),
|
child: Text("Submit"),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import 'dart:convert';
|
|||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
// import 'package:flutter/rendering.dart';
|
||||||
import 'dart:html' as html;
|
import 'dart:html' as html;
|
||||||
import 'package:frontend/config/apiUrl.dart'; // 1 newly added
|
import 'package:frontend/config/apiUrl.dart'; // 1 newly added
|
||||||
import 'package:frontend/services/apiService.dart';
|
import 'package:frontend/services/apiService.dart';
|
||||||
@ -31,7 +31,7 @@ class _MyAppState extends State<MyApp> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
SemanticsBinding.instance.ensureSemantics(); // ✅ Safe here
|
// SemanticsBinding.instance.ensureSemantics(); // ✅ Safe here
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
final uri = Uri.parse(html.window.location.href);
|
final uri = Uri.parse(html.window.location.href);
|
||||||
if (uri.path == '/authredirection' &&
|
if (uri.path == '/authredirection' &&
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user