This commit is contained in:
venbaittech 2025-06-06 14:20:25 +05:30
commit fe6ccab809

View File

@ -1436,6 +1436,59 @@ class FlightScreenState extends State<FlightScreen> {
],
),
if (isDesktop) Spacer() else SizedBox(height: 8),
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// "Class *",
// style: GoogleFonts.poppins(
// fontSize: 12,
// fontWeight: FontWeight.w600,
// color: Color(0xFF575A74),
// ),
// ),
// SizedBox(height: 5),
// CustomTextFieldItnerarySubWrapper(
// isFocused: focusStates["_class${index}Focused"] ?? false,
// isDesktop: isDesktop,
// // width: isDesktop
// // ? MediaQuery.of(context).size.width * 0.34
// // : MediaQuery.of(context).size.width * 0.66,
// child: SizedBox(
// height: 40,
// child:
// isFlightClassLoading
// ? const Center(child: CircularProgressIndicator())
// : DropdownButtonFormField<String>(
// focusNode: focusNodes["_class${index}FocusNode"],
// // focusNode: _tripTypeFocusNode, // Assign the correct focus node
// // controller: _hotelNameController,
// value: selectedClasses[index],
//
// style: TextStyle(fontSize: 12),
// decoration: InputDecoration(
// border: InputBorder.none,
// contentPadding: EdgeInsets.symmetric(
// horizontal: 10,
// ), // Proper padding
// ),
// onChanged:
// purposeList.isNotEmpty
// ? (newValue) {
// setState(() {
// selectedClasses[index] = newValue;
// });
//
// print(selectedClasses[index]);
// }
// : null,
// items: dropdownItems,
// ),
// ),
// ),
// ],
// ),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -1451,41 +1504,83 @@ class FlightScreenState extends State<FlightScreen> {
CustomTextFieldItnerarySubWrapper(
isFocused: focusStates["_class${index}Focused"] ?? false,
isDesktop: isDesktop,
// width: isDesktop
// ? MediaQuery.of(context).size.width * 0.34
// : MediaQuery.of(context).size.width * 0.66,
child: SizedBox(
height: 40,
child:
isFlightClassLoading
? const Center(child: CircularProgressIndicator())
: DropdownButtonFormField<String>(
focusNode: focusNodes["_class${index}FocusNode"],
// focusNode: _tripTypeFocusNode, // Assign the correct focus node
// controller: _hotelNameController,
value: selectedClasses[index],
style: TextStyle(fontSize: 12),
decoration: InputDecoration(
border: InputBorder.none,
contentPadding: EdgeInsets.symmetric(
horizontal: 10,
), // Proper padding
),
onChanged:
purposeList.isNotEmpty
? (newValue) {
setState(() {
selectedClasses[index] = newValue;
});
print(selectedClasses[index]);
}
: null,
items: dropdownItems,
height: 35,
width: double.infinity,
child: DropdownSearch<Map<String, dynamic>>(
items: purposeList.cast<Map<String, dynamic>>(),
selectedItem: purposeList.firstWhere(
(item) => item['dropdown_key'] == selectedClasses[index],
orElse: () => {},
),
itemAsString: (item) => item['dropdown_value'] ?? '',
popupProps: PopupProps.menu(
showSearchBox: false,
fit: FlexFit.loose,
menuProps: const MenuProps(backgroundColor: Colors.white),
itemBuilder: (context, item, isSelected) {
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
child: Text(
item['dropdown_value'] ?? '',
style: GoogleFonts.poppins(
fontSize: 12,
color: Colors.black,
),
),
);
},
),
dropdownDecoratorProps: const DropDownDecoratorProps(
dropdownSearchDecoration: InputDecoration(
border: InputBorder.none,
contentPadding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
),
),
dropdownBuilder: (context, selectedItem) {
if (selectedItem == null || selectedItem.isEmpty) {
return Text(
"Select Class",
style: GoogleFonts.poppins(
color: Colors.grey,
fontSize: 13,
),
);
}
return Text(
selectedItem['dropdown_value'] ?? '',
style: GoogleFonts.poppins(
fontSize: 12,
color: Colors.black,
),
);
},
onChanged:
purposeList.isNotEmpty
? (Map<String, dynamic>? newValue) {
setState(() {
selectedClasses[index] = newValue?['dropdown_key'];
print("Selected Class: ${selectedClasses[index]}");
});
}
: null,
),
),
),
if (errorMessages["class_$index"] != null)
Padding(
padding: const EdgeInsets.only(top: 4),
child: Text(
errorMessages["class_$index"]!,
style: GoogleFonts.poppins(fontSize: 12, color: Colors.red),
),
),
],
),
if (isDesktop) Spacer() else SizedBox(height: 8),
@ -1647,6 +1742,61 @@ class FlightScreenState extends State<FlightScreen> {
);
}
return [
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// "Visa Required",
// style: GoogleFonts.poppins(
// fontSize: 12,
// fontWeight: FontWeight.w600,
// color: Color(0xFF575A74),
// ),
// ),
// SizedBox(height: 5),
// CustomTextFieldItnerarySubWrapper(
// // isFocused: _tripTypeFocused,
// isFocused: focusStates["_visa1Focused"] ?? false,
// isDesktop: isDesktop,
// // width: isDesktop
// // ? MediaQuery.of(context).size.width * 0.34
// // : MediaQuery.of(context).size.width * 0.66,
// child: SizedBox(
// height: 40,
// child: DropdownButtonFormField<String>(
// // focusNode: _tripTypeFocusNode, // Assign the correct focus node
// focusNode: focusNodes["_visa1FocusNode"],
// value: selectedvisa_available,
// style: TextStyle(fontSize: 12),
// decoration: InputDecoration(
// border: InputBorder.none,
// contentPadding: EdgeInsets.symmetric(
// horizontal: 10,
// ), // Proper padding
// ),
// onChanged:
// visa_available.isNotEmpty
// ? (newValue) {
// setState(() {
// selectedvisa_available = newValue;
// // selectedTripType = "Oneway";
// // Reset `multiTripRowCount` when switching away from Multitrip
// });
// print(
// "Updating form data: Flight -> trip_type -> $selectedvisa_available",
// );
//
// // _initializeRows();
// }
// : null,
//
// items: dropdownItems,
// ),
// ),
// ),
// ],
// ),
//********//
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -1659,43 +1809,76 @@ class FlightScreenState extends State<FlightScreen> {
),
),
SizedBox(height: 5),
CustomTextFieldItnerarySubWrapper(
// isFocused: _tripTypeFocused,
CustomTextFieldWrapper(
// use same wrapper as class
isFocused: focusStates["_visa1Focused"] ?? false,
isDesktop: isDesktop,
// width: isDesktop
// ? MediaQuery.of(context).size.width * 0.34
// : MediaQuery.of(context).size.width * 0.66,
child: SizedBox(
height: 40,
child: DropdownButtonFormField<String>(
// focusNode: _tripTypeFocusNode, // Assign the correct focus node
focusNode: focusNodes["_visa1FocusNode"],
value: selectedvisa_available,
style: TextStyle(fontSize: 12),
decoration: InputDecoration(
border: InputBorder.none,
contentPadding: EdgeInsets.symmetric(
horizontal: 10,
), // Proper padding
height: 35,
width: double.infinity,
child: DropdownSearch<Map<String, dynamic>>(
items: visa_available.cast<Map<String, dynamic>>(),
selectedItem: visa_available.firstWhere(
(item) => item['dropdown_key'] == selectedvisa_available,
orElse: () => {},
),
itemAsString: (item) => item['dropdown_value'] ?? '',
popupProps: PopupProps.menu(
showSearchBox: false,
fit: FlexFit.loose,
menuProps: const MenuProps(backgroundColor: Colors.white),
itemBuilder: (context, item, isSelected) {
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
child: Text(
item['dropdown_value'] ?? '',
style: GoogleFonts.poppins(
fontSize: 12,
color: Colors.black,
),
),
);
},
),
dropdownDecoratorProps: const DropDownDecoratorProps(
dropdownSearchDecoration: InputDecoration(
border: InputBorder.none,
contentPadding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
),
),
dropdownBuilder: (context, selectedItem) {
if (selectedItem == null || selectedItem.isEmpty) {
return Text(
"Select Option",
style: GoogleFonts.poppins(
color: Colors.grey,
fontSize: 13,
),
);
}
return Text(
selectedItem['dropdown_value'] ?? '',
style: GoogleFonts.poppins(
fontSize: 12,
color: Colors.black,
),
);
},
onChanged:
visa_available.isNotEmpty
? (newValue) {
? (Map<String, dynamic>? newValue) {
setState(() {
selectedvisa_available = newValue;
// selectedTripType = "Oneway";
// Reset `multiTripRowCount` when switching away from Multitrip
selectedvisa_available = newValue?['dropdown_key'];
print("Selected Visa: $selectedvisa_available");
});
print(
"Updating form data: Flight -> trip_type -> $selectedvisa_available",
);
// _initializeRows();
}
: null,
items: dropdownItems,
),
),
),
@ -1793,14 +1976,14 @@ class FlightScreenState extends State<FlightScreen> {
),
),
SizedBox(height: 5),
CustomTextFieldWrapper(
CustomTextFieldItnerarySubWrapper(
// isFocused: _tripTypeFocused,
isFocused: focusStates["_visa1Focused"] ?? false,
isDesktop: isDesktop,
width:
isDesktop
? MediaQuery.of(context).size.width * 0.34
: MediaQuery.of(context).size.width * 0.66,
// width:
// isDesktop
// ? MediaQuery.of(context).size.width * 0.34
// : MediaQuery.of(context).size.width * 0.66,
child: SizedBox(
height: 40,
child: DropdownButtonFormField<String>(