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), 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( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -1451,41 +1504,83 @@ class FlightScreenState extends State<FlightScreen> {
CustomTextFieldItnerarySubWrapper( CustomTextFieldItnerarySubWrapper(
isFocused: focusStates["_class${index}Focused"] ?? false, isFocused: focusStates["_class${index}Focused"] ?? false,
isDesktop: isDesktop, isDesktop: isDesktop,
// width: isDesktop
// ? MediaQuery.of(context).size.width * 0.34
// : MediaQuery.of(context).size.width * 0.66,
child: SizedBox( child: SizedBox(
height: 40, height: 35,
child: width: double.infinity,
isFlightClassLoading child: DropdownSearch<Map<String, dynamic>>(
? const Center(child: CircularProgressIndicator()) items: purposeList.cast<Map<String, dynamic>>(),
: DropdownButtonFormField<String>( selectedItem: purposeList.firstWhere(
focusNode: focusNodes["_class${index}FocusNode"], (item) => item['dropdown_key'] == selectedClasses[index],
// focusNode: _tripTypeFocusNode, // Assign the correct focus node orElse: () => {},
// controller: _hotelNameController, ),
value: selectedClasses[index], itemAsString: (item) => item['dropdown_value'] ?? '',
popupProps: PopupProps.menu(
style: TextStyle(fontSize: 12), showSearchBox: false,
decoration: InputDecoration( 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, border: InputBorder.none,
contentPadding: EdgeInsets.symmetric( contentPadding: EdgeInsets.symmetric(
horizontal: 10, horizontal: 10,
), // Proper padding 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: onChanged:
purposeList.isNotEmpty purposeList.isNotEmpty
? (newValue) { ? (Map<String, dynamic>? newValue) {
setState(() { setState(() {
selectedClasses[index] = newValue; selectedClasses[index] = newValue?['dropdown_key'];
print("Selected Class: ${selectedClasses[index]}");
}); });
print(selectedClasses[index]);
} }
: null, : null,
items: dropdownItems,
), ),
), ),
), ),
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), if (isDesktop) Spacer() else SizedBox(height: 8),
@ -1647,6 +1742,61 @@ class FlightScreenState extends State<FlightScreen> {
); );
} }
return [ 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( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -1659,43 +1809,76 @@ class FlightScreenState extends State<FlightScreen> {
), ),
), ),
SizedBox(height: 5), SizedBox(height: 5),
CustomTextFieldItnerarySubWrapper( CustomTextFieldWrapper(
// isFocused: _tripTypeFocused, // use same wrapper as class
isFocused: focusStates["_visa1Focused"] ?? false, isFocused: focusStates["_visa1Focused"] ?? false,
isDesktop: isDesktop, isDesktop: isDesktop,
// width: isDesktop
// ? MediaQuery.of(context).size.width * 0.34
// : MediaQuery.of(context).size.width * 0.66,
child: SizedBox( child: SizedBox(
height: 40, height: 35,
child: DropdownButtonFormField<String>( width: double.infinity,
// focusNode: _tripTypeFocusNode, // Assign the correct focus node child: DropdownSearch<Map<String, dynamic>>(
focusNode: focusNodes["_visa1FocusNode"], items: visa_available.cast<Map<String, dynamic>>(),
value: selectedvisa_available, selectedItem: visa_available.firstWhere(
style: TextStyle(fontSize: 12), (item) => item['dropdown_key'] == selectedvisa_available,
decoration: InputDecoration( 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, border: InputBorder.none,
contentPadding: EdgeInsets.symmetric( contentPadding: EdgeInsets.symmetric(
horizontal: 10, horizontal: 10,
), // Proper padding 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: onChanged:
visa_available.isNotEmpty visa_available.isNotEmpty
? (newValue) { ? (Map<String, dynamic>? newValue) {
setState(() { setState(() {
selectedvisa_available = newValue; selectedvisa_available = newValue?['dropdown_key'];
// selectedTripType = "Oneway"; print("Selected Visa: $selectedvisa_available");
// Reset `multiTripRowCount` when switching away from Multitrip
}); });
print(
"Updating form data: Flight -> trip_type -> $selectedvisa_available",
);
// _initializeRows();
} }
: null, : null,
items: dropdownItems,
), ),
), ),
), ),
@ -1793,14 +1976,14 @@ class FlightScreenState extends State<FlightScreen> {
), ),
), ),
SizedBox(height: 5), SizedBox(height: 5),
CustomTextFieldWrapper( CustomTextFieldItnerarySubWrapper(
// isFocused: _tripTypeFocused, // isFocused: _tripTypeFocused,
isFocused: focusStates["_visa1Focused"] ?? false, isFocused: focusStates["_visa1Focused"] ?? false,
isDesktop: isDesktop, isDesktop: isDesktop,
width: // width:
isDesktop // isDesktop
? MediaQuery.of(context).size.width * 0.34 // ? MediaQuery.of(context).size.width * 0.34
: MediaQuery.of(context).size.width * 0.66, // : MediaQuery.of(context).size.width * 0.66,
child: SizedBox( child: SizedBox(
height: 40, height: 40,
child: DropdownButtonFormField<String>( child: DropdownButtonFormField<String>(