dropdown fixes
This commit is contained in:
parent
4887c69950
commit
424d93cc9f
@ -1145,6 +1145,51 @@ class _ForexScreenState extends State<ForexScreen> {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
// CustomTextFieldForexWrapper(
|
||||
// isFocused: focusStates["_countries"] ?? false,
|
||||
// isDesktop: isDesktop,
|
||||
// child: SizedBox(
|
||||
// height: 40,
|
||||
// child: DropdownSearch<String>(
|
||||
// selectedItem: countryMap[selectedCountry],
|
||||
// popupProps: PopupProps.menu(
|
||||
// showSearchBox: true, // Enables search functionality
|
||||
// searchFieldProps: TextFieldProps(
|
||||
// decoration: InputDecoration(
|
||||
// hintText: "Search ...",
|
||||
// contentPadding: EdgeInsets.symmetric(horizontal: 10),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// items: countryMap.values.toList(),
|
||||
// dropdownDecoratorProps: DropDownDecoratorProps(
|
||||
// dropdownSearchDecoration: InputDecoration(
|
||||
// border: InputBorder.none,
|
||||
// contentPadding: EdgeInsets.symmetric(horizontal: 1),
|
||||
// ),
|
||||
// ),
|
||||
// dropdownBuilder:
|
||||
// (context, selectedItem) => Align(
|
||||
// // Center-align selected item
|
||||
// alignment: Alignment.centerLeft,
|
||||
// child: Text(
|
||||
// selectedItem ?? "Select ",
|
||||
// style: TextStyle(fontSize: 12),
|
||||
// ),
|
||||
// ),
|
||||
// onChanged: (String? newValue) {
|
||||
// setState(() {
|
||||
// // Find the country_code based on selected country_name
|
||||
// selectedCountry =
|
||||
// countryMap.entries
|
||||
// .firstWhere((entry) => entry.value == newValue)
|
||||
// .key;
|
||||
// _onCountryChanged(selectedCountry);
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
CustomTextFieldForexWrapper(
|
||||
isFocused: focusStates["_countries"] ?? false,
|
||||
isDesktop: isDesktop,
|
||||
@ -1153,7 +1198,22 @@ class _ForexScreenState extends State<ForexScreen> {
|
||||
child: DropdownSearch<String>(
|
||||
selectedItem: countryMap[selectedCountry],
|
||||
popupProps: PopupProps.menu(
|
||||
showSearchBox: true, // Enables search functionality
|
||||
showSearchBox: true,
|
||||
fit: FlexFit.loose,
|
||||
constraints: BoxConstraints(maxHeight: 250),
|
||||
menuProps: const MenuProps(backgroundColor: Colors.white),
|
||||
itemBuilder:
|
||||
(context, item, isSelected) => Container(
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 6,
|
||||
),
|
||||
child: Text(
|
||||
item,
|
||||
style: GoogleFonts.poppins(fontSize: 11.5),
|
||||
),
|
||||
),
|
||||
searchFieldProps: TextFieldProps(
|
||||
decoration: InputDecoration(
|
||||
hintText: "Search ...",
|
||||
@ -1170,13 +1230,15 @@ class _ForexScreenState extends State<ForexScreen> {
|
||||
),
|
||||
dropdownBuilder:
|
||||
(context, selectedItem) => Align(
|
||||
// Center-align selected item
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
selectedItem ?? "Select ",
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
selectedItem ?? "Select ",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
// Find the country_code based on selected country_name
|
||||
|
||||
@ -695,56 +695,128 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
|
||||
// ▼ Dropdown Wrapper ▼
|
||||
// CustomTextFieldWrapper(
|
||||
// isFocused: _isHotelNameFocused,
|
||||
// isDesktop: isDesktop,
|
||||
// width: isDesktop ? MediaQuery.of(context).size.width * 0.31 : null,
|
||||
// child: SizedBox(
|
||||
// height: 35,
|
||||
// width: double.infinity,
|
||||
// child: DropdownButtonFormField<String>(
|
||||
// focusNode: _tripTypeFocusNode,
|
||||
// value: selectedInsuranceType,
|
||||
// style: GoogleFonts.poppins(fontSize: 12, color: Colors.black),
|
||||
// decoration: const InputDecoration(
|
||||
// border: InputBorder.none,
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// horizontal: 10,
|
||||
// vertical: 5,
|
||||
// ),
|
||||
// ),
|
||||
// hint: Text(
|
||||
// "Select ",
|
||||
// style: GoogleFonts.poppins(color: Colors.grey, fontSize: 13),
|
||||
// ),
|
||||
// items:
|
||||
// purposeList.map<DropdownMenuItem<String>>((item) {
|
||||
// return DropdownMenuItem<String>(
|
||||
// value: item['dropdown_key'],
|
||||
// child: Text(
|
||||
// item['dropdown_value'] ?? '',
|
||||
// style: GoogleFonts.poppins(fontSize: 12),
|
||||
// ),
|
||||
// );
|
||||
// }).toList(),
|
||||
// onChanged:
|
||||
// purposeList.isNotEmpty
|
||||
// ? (String? newValue) {
|
||||
// setState(() {
|
||||
// selectedInsuranceType = newValue;
|
||||
// if ((selectedInsuranceType ?? '').isNotEmpty) {
|
||||
// errorMessages.remove("type_of_insurance");
|
||||
// }
|
||||
// });
|
||||
// print(
|
||||
// "Selected Insurance Type: $selectedInsuranceType",
|
||||
// );
|
||||
// }
|
||||
// : null,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ▼ Dropdown Wrapper ▼
|
||||
CustomTextFieldWrapper(
|
||||
isFocused: _isHotelNameFocused,
|
||||
isDesktop: isDesktop,
|
||||
width: isDesktop ? MediaQuery.of(context).size.width * 0.31 : null,
|
||||
child: SizedBox(
|
||||
height: 35,
|
||||
height: 40,
|
||||
width: double.infinity,
|
||||
child: DropdownButtonFormField<String>(
|
||||
focusNode: _tripTypeFocusNode,
|
||||
value: selectedInsuranceType,
|
||||
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black),
|
||||
decoration: const InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 5,
|
||||
child: DropdownSearch<Map<String, dynamic>>(
|
||||
items: purposeList.cast<Map<String, dynamic>>(),
|
||||
selectedItem: purposeList.firstWhere(
|
||||
(item) => item['dropdown_key'] == selectedInsuranceType,
|
||||
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: 5,
|
||||
),
|
||||
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: 10,),
|
||||
),
|
||||
),
|
||||
hint: Text(
|
||||
"Select ",
|
||||
style: GoogleFonts.poppins(color: Colors.grey, fontSize: 13),
|
||||
),
|
||||
items:
|
||||
purposeList.map<DropdownMenuItem<String>>((item) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: item['dropdown_key'],
|
||||
child: Text(
|
||||
item['dropdown_value'] ?? '',
|
||||
style: GoogleFonts.poppins(fontSize: 12),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
dropdownBuilder: (context, selectedItem) {
|
||||
if (selectedItem == null || selectedItem.isEmpty) {
|
||||
return Text(
|
||||
"Select ",
|
||||
style: GoogleFonts.poppins(
|
||||
color: Colors.grey,
|
||||
fontSize: 13,
|
||||
),
|
||||
);
|
||||
}
|
||||
return Text(
|
||||
selectedItem['dropdown_value'] ?? '',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
color: Colors.black,
|
||||
),
|
||||
);
|
||||
},
|
||||
onChanged:
|
||||
purposeList.isNotEmpty
|
||||
? (String? newValue) {
|
||||
setState(() {
|
||||
selectedInsuranceType = newValue;
|
||||
if ((selectedInsuranceType ?? '').isNotEmpty) {
|
||||
errorMessages.remove("type_of_insurance");
|
||||
}
|
||||
});
|
||||
print(
|
||||
"Selected Insurance Type: $selectedInsuranceType",
|
||||
);
|
||||
}
|
||||
: null,
|
||||
purposeList.isNotEmpty
|
||||
? (Map<String, dynamic>? newValue) {
|
||||
setState(() {
|
||||
selectedInsuranceType= newValue?['dropdown_key'];
|
||||
print("selected Insurance Type: ${selectedInsuranceType}");
|
||||
});
|
||||
}
|
||||
: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import 'package:dropdown_search/dropdown_search.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
@ -244,36 +245,114 @@ class _MiscellaneousScreenState extends State<MiscellaneousScreen> {
|
||||
dropdownItems.isNotEmpty ? dropdownItems.first.value : "No options";
|
||||
|
||||
return [
|
||||
CustomTextFieldWrapper(
|
||||
// CustomTextFieldWrapper(
|
||||
// isFocused: _isHotelNameFocused,
|
||||
// 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
|
||||
// value: selectedSpecialType,
|
||||
// style: TextStyle(fontSize: 12),
|
||||
// decoration: InputDecoration(
|
||||
// border: InputBorder.none,
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// horizontal: 10,
|
||||
// ), // Proper padding
|
||||
// ),
|
||||
// onChanged:
|
||||
// purposeList.isNotEmpty
|
||||
// ? (newValue) {
|
||||
// setState(() {
|
||||
// selectedSpecialType = newValue;
|
||||
// });
|
||||
//
|
||||
// print(selectedSpecialType);
|
||||
// }
|
||||
// : null,
|
||||
// items: dropdownItems,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
CustomTextFieldItnerarySubWrapper(
|
||||
isFocused: _isHotelNameFocused,
|
||||
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>(
|
||||
focusNode: _tripTypeFocusNode, // Assign the correct focus node
|
||||
value: selectedSpecialType,
|
||||
style: TextStyle(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
), // Proper padding
|
||||
width: double.infinity,
|
||||
child: DropdownSearch<Map<String, dynamic>>(
|
||||
// focusNode: _taxiReqFocusNode,
|
||||
items: purposeList.cast<Map<String, dynamic>>(),
|
||||
selectedItem: purposeList.firstWhere(
|
||||
(item) => item['dropdown_key'] == selectedSpecialType,
|
||||
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: 5,
|
||||
),
|
||||
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: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
dropdownBuilder: (context, selectedItem) {
|
||||
if (selectedItem == null || selectedItem.isEmpty) {
|
||||
return Text(
|
||||
"Select ",
|
||||
style: GoogleFonts.poppins(
|
||||
color: Colors.grey,
|
||||
fontSize: 13,
|
||||
),
|
||||
);
|
||||
}
|
||||
return Text(
|
||||
selectedItem['dropdown_value'] ?? '',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
color: Colors.black,
|
||||
),
|
||||
);
|
||||
},
|
||||
onChanged:
|
||||
purposeList.isNotEmpty
|
||||
? (newValue) {
|
||||
setState(() {
|
||||
selectedSpecialType = newValue;
|
||||
});
|
||||
|
||||
print(selectedSpecialType);
|
||||
}
|
||||
: null,
|
||||
items: dropdownItems,
|
||||
purposeList.isNotEmpty
|
||||
? (newValue) {
|
||||
setState(() {
|
||||
selectedSpecialType = newValue as String?;
|
||||
});
|
||||
print(
|
||||
"Updating form data: -> ${newValue ?? ""}",
|
||||
);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import 'package:dropdown_search/dropdown_search.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
@ -362,34 +363,109 @@ class _TaxiScreenState extends State<TaxiScreen> {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
// CustomTextFieldItnerarySubWrapper(
|
||||
// isFocused: _toFocus,
|
||||
// isDesktop: isDesktop,
|
||||
// child: SizedBox(
|
||||
// height: 40,
|
||||
// child: DropdownButtonFormField<String>(
|
||||
// focusNode: _toFocusNode, // Assign the correct focus node
|
||||
// value: selectedCarType,
|
||||
// style: TextStyle(fontSize: 12),
|
||||
// decoration: InputDecoration(
|
||||
// border: InputBorder.none,
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// horizontal: 10,
|
||||
// ), // Proper padding
|
||||
// ),
|
||||
// onChanged:
|
||||
// purposeList.isNotEmpty
|
||||
// ? (newValue) {
|
||||
// setState(() {
|
||||
// selectedCarType = newValue;
|
||||
// });
|
||||
// print(
|
||||
// "Updating form data: Flight -> trip_type -> ${newValue ?? ""}",
|
||||
// );
|
||||
// }
|
||||
// : null,
|
||||
//
|
||||
// items: dropdownItems,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
CustomTextFieldItnerarySubWrapper(
|
||||
isFocused: _toFocus,
|
||||
isDesktop: isDesktop,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: DropdownButtonFormField<String>(
|
||||
focusNode: _toFocusNode, // Assign the correct focus node
|
||||
value: selectedCarType,
|
||||
style: TextStyle(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
), // Proper padding
|
||||
width: double.infinity,
|
||||
child: DropdownSearch<Map<String, dynamic>>(
|
||||
// focusNode: _taxiReqFocusNode,
|
||||
items: purposeList.cast<Map<String, dynamic>>(),
|
||||
selectedItem: purposeList.firstWhere(
|
||||
(item) => item['dropdown_key'] == selectedCarType,
|
||||
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: 5,
|
||||
),
|
||||
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: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
dropdownBuilder: (context, selectedItem) {
|
||||
if (selectedItem == null || selectedItem.isEmpty) {
|
||||
return Text(
|
||||
"Select ",
|
||||
style: GoogleFonts.poppins(
|
||||
color: Colors.grey,
|
||||
fontSize: 13,
|
||||
),
|
||||
);
|
||||
}
|
||||
return Text(
|
||||
selectedItem['dropdown_value'] ?? '',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
color: Colors.black,
|
||||
),
|
||||
);
|
||||
},
|
||||
onChanged:
|
||||
purposeList.isNotEmpty
|
||||
? (newValue) {
|
||||
setState(() {
|
||||
selectedCarType = newValue;
|
||||
});
|
||||
print(
|
||||
"Updating form data: Flight -> trip_type -> ${newValue ?? ""}",
|
||||
);
|
||||
}
|
||||
: null,
|
||||
|
||||
items: dropdownItems,
|
||||
purposeList.isNotEmpty
|
||||
? (newValue) {
|
||||
setState(() {
|
||||
selectedCarType = newValue as String?;
|
||||
});
|
||||
print(
|
||||
"Updating form data: -> ${newValue ?? ""}",
|
||||
);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -429,38 +505,117 @@ class _TaxiScreenState extends State<TaxiScreen> {
|
||||
dropdownItems.isNotEmpty ? dropdownItems.first.value : null;
|
||||
|
||||
return [
|
||||
CustomTextFieldWrapper(
|
||||
// CustomTextFieldWrapper(
|
||||
// isFocused: _taxiReqFocused,
|
||||
// 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: _taxiReqFocusNode, // Assign the correct focus node
|
||||
// value: selectedReqTaxi,
|
||||
// style: TextStyle(fontSize: 12),
|
||||
// decoration: InputDecoration(
|
||||
// border: InputBorder.none,
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// horizontal: 10,
|
||||
// ), // Proper padding
|
||||
// ),
|
||||
// onChanged:
|
||||
// purposeList.isNotEmpty
|
||||
// ? (newValue) {
|
||||
// setState(() {
|
||||
// selectedReqTaxi = newValue;
|
||||
// });
|
||||
// print(
|
||||
// "Updating form data: Flight -> trip_type -> ${newValue ?? ""}",
|
||||
// );
|
||||
// }
|
||||
// : null,
|
||||
//
|
||||
// items: dropdownItems,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
CustomTextFieldItnerarySubWrapper(
|
||||
isFocused: _taxiReqFocused,
|
||||
isDesktop: isDesktop,
|
||||
width:
|
||||
isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.34
|
||||
: MediaQuery.of(context).size.width * 0.66,
|
||||
isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.34
|
||||
: MediaQuery.of(context).size.width * 0.66,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: DropdownButtonFormField<String>(
|
||||
focusNode: _taxiReqFocusNode, // Assign the correct focus node
|
||||
value: selectedReqTaxi,
|
||||
style: TextStyle(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
), // Proper padding
|
||||
width: double.infinity,
|
||||
child: DropdownSearch<Map<String, dynamic>>(
|
||||
// focusNode: _taxiReqFocusNode,
|
||||
items: purposeList.cast<Map<String, dynamic>>(),
|
||||
selectedItem: purposeList.firstWhere(
|
||||
(item) => item['dropdown_key'] == selectedReqTaxi,
|
||||
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: 5,
|
||||
),
|
||||
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: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
dropdownBuilder: (context, selectedItem) {
|
||||
if (selectedItem == null || selectedItem.isEmpty) {
|
||||
return Text(
|
||||
"Select ",
|
||||
style: GoogleFonts.poppins(
|
||||
color: Colors.grey,
|
||||
fontSize: 13,
|
||||
),
|
||||
);
|
||||
}
|
||||
return Text(
|
||||
selectedItem['dropdown_value'] ?? '',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
color: Colors.black,
|
||||
),
|
||||
);
|
||||
},
|
||||
onChanged:
|
||||
purposeList.isNotEmpty
|
||||
? (newValue) {
|
||||
setState(() {
|
||||
selectedReqTaxi = newValue;
|
||||
});
|
||||
print(
|
||||
"Updating form data: Flight -> trip_type -> ${newValue ?? ""}",
|
||||
);
|
||||
}
|
||||
: null,
|
||||
|
||||
items: dropdownItems,
|
||||
purposeList.isNotEmpty
|
||||
? (newValue) {
|
||||
setState(() {
|
||||
selectedReqTaxi = newValue as String?;
|
||||
});
|
||||
print(
|
||||
"Updating form data: -> ${newValue ?? ""}",
|
||||
);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -765,7 +920,7 @@ class _TaxiScreenState extends State<TaxiScreen> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Comments *",
|
||||
"Comments",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
|
||||
@ -592,34 +592,104 @@ class _TrainScreenState extends State<TrainScreen> {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFieldItnerarySubWrapper(
|
||||
// CustomTextFieldItnerarySubWrapper(
|
||||
// isFocused: _isHotelNameFocused,
|
||||
// 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: _hotelNameFocusNode, // Assign the correct focus node
|
||||
// // controller: _hotelNameController,
|
||||
// value: selectedClass,
|
||||
// style: TextStyle(fontSize: 12),
|
||||
// decoration: InputDecoration(
|
||||
// border: InputBorder.none,
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// horizontal: 10,
|
||||
// ), // Proper padding
|
||||
// ),
|
||||
// onChanged:
|
||||
// purposeList.isNotEmpty
|
||||
// ? (newValue) {
|
||||
// setState(() {
|
||||
// selectedClass = newValue;
|
||||
// });
|
||||
// }
|
||||
// : null,
|
||||
// items: dropdownItems,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
CustomTextFieldWrapper(
|
||||
isFocused: _isHotelNameFocused,
|
||||
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.15 : null,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: DropdownButtonFormField<String>(
|
||||
focusNode: _hotelNameFocusNode, // Assign the correct focus node
|
||||
// controller: _hotelNameController,
|
||||
value: selectedClass,
|
||||
style: TextStyle(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
), // Proper padding
|
||||
width: double.infinity,
|
||||
child: DropdownSearch<Map<String, dynamic>>(
|
||||
items: purposeList.cast<Map<String, dynamic>>(),
|
||||
selectedItem: purposeList.firstWhere(
|
||||
(item) => item['dropdown_key'] == selectedClass,
|
||||
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: 5,
|
||||
),
|
||||
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: 10,),
|
||||
),
|
||||
),
|
||||
dropdownBuilder: (context, selectedItem) {
|
||||
if (selectedItem == null || selectedItem.isEmpty) {
|
||||
return Text(
|
||||
"Select ",
|
||||
style: GoogleFonts.poppins(
|
||||
color: Colors.grey,
|
||||
fontSize: 13,
|
||||
),
|
||||
);
|
||||
}
|
||||
return Text(
|
||||
selectedItem['dropdown_value'] ?? '',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
color: Colors.black,
|
||||
),
|
||||
);
|
||||
},
|
||||
onChanged:
|
||||
purposeList.isNotEmpty
|
||||
? (newValue) {
|
||||
setState(() {
|
||||
selectedClass = newValue;
|
||||
});
|
||||
}
|
||||
: null,
|
||||
items: dropdownItems,
|
||||
purposeList.isNotEmpty
|
||||
? (Map<String, dynamic>? newValue) {
|
||||
setState(() {
|
||||
selectedClass= newValue?['dropdown_key'];
|
||||
print("Selected Purpose: ${selectedClass}");
|
||||
});
|
||||
}
|
||||
: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -642,96 +712,158 @@ class _TrainScreenState extends State<TrainScreen> {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
// CustomTextFieldItnerarySubWrapper(
|
||||
// isFocused: _fromFocus,
|
||||
// isDesktop: isDesktop,
|
||||
// child: SizedBox(
|
||||
// height: 40,
|
||||
// child:
|
||||
// isCountryLoading
|
||||
// ? Center(child: CircularProgressIndicator())
|
||||
// : DropdownSearch<String>(
|
||||
// // selectedItem: selectedFrom != null
|
||||
// // ? countryMap[selectedFrom]
|
||||
// // : null,
|
||||
// selectedItem:
|
||||
// selectedFrom != null
|
||||
// ? countryMap[selectedFrom] // get the display value from code
|
||||
// : null,
|
||||
// popupProps: PopupProps.menu(
|
||||
// menuProps: MenuProps(backgroundColor: Colors.white),
|
||||
// constraints: BoxConstraints(maxHeight: 230),
|
||||
// showSearchBox: true,
|
||||
// searchFieldProps: TextFieldProps(
|
||||
// decoration: InputDecoration(
|
||||
// hintText: "Search ...",
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// horizontal: 10,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
//
|
||||
// items: countryMap.values.toList(),
|
||||
//
|
||||
// dropdownDecoratorProps: DropDownDecoratorProps(
|
||||
// dropdownSearchDecoration: InputDecoration(
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// horizontal: 10,
|
||||
// vertical: 5,
|
||||
// ),
|
||||
// border: InputBorder.none,
|
||||
// ),
|
||||
// ),
|
||||
// dropdownBuilder:
|
||||
// (context, selectedItem) => Align(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// child: Text(
|
||||
// selectedItem ?? "Select",
|
||||
// style: TextStyle(fontSize: 12),
|
||||
// ),
|
||||
// ),
|
||||
//
|
||||
// // onChanged: (String? newValue) {
|
||||
// // setState(() {
|
||||
// // // selectedFrom[index] = countryMap.entries
|
||||
// // // .firstWhere((entry) => entry.value == newValue)
|
||||
// // // .key;
|
||||
// //
|
||||
// // selectedFrom = countryMap.entries
|
||||
// // .firstWhere((entry) => entry.value == newValue)
|
||||
// // .key;
|
||||
// //
|
||||
// // print(selectedFrom);
|
||||
// // });
|
||||
// // },
|
||||
// onChanged: (String? newValue) {
|
||||
// setState(() {
|
||||
// selectedFrom =
|
||||
// countryMap.entries
|
||||
// .firstWhere(
|
||||
// (entry) => entry.value == newValue,
|
||||
// )
|
||||
// .key;
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// // child: SizedBox(
|
||||
// // height: 40,
|
||||
// // child: TextField(
|
||||
// // focusNode: _fromFocusNode,
|
||||
// // controller: _fromController,
|
||||
// // style: const TextStyle(fontSize: 12),
|
||||
// // decoration: const InputDecoration(
|
||||
// // labelText: "From",
|
||||
// // labelStyle: TextStyle(fontSize: 12, color: Colors.grey),
|
||||
// // floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
// // border: InputBorder.none,
|
||||
// // contentPadding: EdgeInsets.symmetric(vertical: 16),
|
||||
// // ),
|
||||
// // ),
|
||||
// // ),
|
||||
// ),
|
||||
CustomTextFieldItnerarySubWrapper(
|
||||
isFocused: _fromFocus,
|
||||
isFocused: _fromFocus ?? false,
|
||||
isDesktop: isDesktop,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child:
|
||||
isCountryLoading
|
||||
? Center(child: CircularProgressIndicator())
|
||||
: DropdownSearch<String>(
|
||||
// selectedItem: selectedFrom != null
|
||||
// ? countryMap[selectedFrom]
|
||||
// : null,
|
||||
selectedItem:
|
||||
selectedFrom != null
|
||||
? countryMap[selectedFrom] // get the display value from code
|
||||
: null,
|
||||
popupProps: PopupProps.menu(
|
||||
menuProps: MenuProps(backgroundColor: Colors.white),
|
||||
constraints: BoxConstraints(maxHeight: 230),
|
||||
showSearchBox: true,
|
||||
searchFieldProps: TextFieldProps(
|
||||
decoration: InputDecoration(
|
||||
hintText: "Search ...",
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
items: countryMap.values.toList(),
|
||||
|
||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
||||
dropdownSearchDecoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 5,
|
||||
),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
),
|
||||
dropdownBuilder:
|
||||
(context, selectedItem) => Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
selectedItem ?? "Select",
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
),
|
||||
|
||||
// onChanged: (String? newValue) {
|
||||
// setState(() {
|
||||
// // selectedFrom[index] = countryMap.entries
|
||||
// // .firstWhere((entry) => entry.value == newValue)
|
||||
// // .key;
|
||||
//
|
||||
// selectedFrom = countryMap.entries
|
||||
// .firstWhere((entry) => entry.value == newValue)
|
||||
// .key;
|
||||
//
|
||||
// print(selectedFrom);
|
||||
// });
|
||||
// },
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
selectedFrom =
|
||||
countryMap.entries
|
||||
.firstWhere(
|
||||
(entry) => entry.value == newValue,
|
||||
)
|
||||
.key;
|
||||
});
|
||||
},
|
||||
),
|
||||
child: DropdownSearch<String>(
|
||||
selectedItem: countryMap[selectedFrom],
|
||||
popupProps: PopupProps.menu(
|
||||
showSearchBox: true,
|
||||
fit: FlexFit.loose,
|
||||
constraints: BoxConstraints(maxHeight: 250),
|
||||
menuProps: const MenuProps(backgroundColor: Colors.white),
|
||||
itemBuilder:
|
||||
(context, item, isSelected) => Container(
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 6,
|
||||
),
|
||||
child: Text(
|
||||
item,
|
||||
style: GoogleFonts.poppins(fontSize: 11.5),
|
||||
),
|
||||
),
|
||||
searchFieldProps: TextFieldProps(
|
||||
decoration: InputDecoration(
|
||||
hintText: "Search Role...",
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 10),
|
||||
),
|
||||
),
|
||||
),
|
||||
items: countryMap.values.toList(),
|
||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
||||
dropdownSearchDecoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 1),
|
||||
),
|
||||
),
|
||||
dropdownBuilder:
|
||||
(context, selectedItem) => Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
selectedItem ?? "Select ...",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
selectedFrom =
|
||||
countryMap.entries
|
||||
.firstWhere(
|
||||
(entry) => entry.value == newValue,
|
||||
)
|
||||
.key;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
// child: SizedBox(
|
||||
// height: 40,
|
||||
// child: TextField(
|
||||
// focusNode: _fromFocusNode,
|
||||
// controller: _fromController,
|
||||
// style: const TextStyle(fontSize: 12),
|
||||
// decoration: const InputDecoration(
|
||||
// labelText: "From",
|
||||
// labelStyle: TextStyle(fontSize: 12, color: Colors.grey),
|
||||
// floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
// border: InputBorder.none,
|
||||
// contentPadding: EdgeInsets.symmetric(vertical: 16),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
if (errorMessages["from_station"] != null) ...[
|
||||
SizedBox(height: 5), // Space before error message
|
||||
@ -752,58 +884,120 @@ class _TrainScreenState extends State<TrainScreen> {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
// CustomTextFieldItnerarySubWrapper(
|
||||
// isFocused: _toFocus,
|
||||
// isDesktop: isDesktop,
|
||||
// child: SizedBox(
|
||||
// height: 40,
|
||||
// child:
|
||||
// isCountryLoading
|
||||
// ? Center(child: CircularProgressIndicator())
|
||||
// : DropdownSearch<String>(
|
||||
// selectedItem:
|
||||
// selectedTo != null
|
||||
// ? countryMap[selectedTo] // get the display value from code
|
||||
// : null,
|
||||
// popupProps: PopupProps.menu(
|
||||
// menuProps: MenuProps(backgroundColor: Colors.white),
|
||||
// constraints: BoxConstraints(maxHeight: 230),
|
||||
// showSearchBox: true,
|
||||
// searchFieldProps: TextFieldProps(
|
||||
// decoration: InputDecoration(
|
||||
// hintText: "Search ...",
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// horizontal: 10,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// items: countryMap.values.toList(),
|
||||
// dropdownDecoratorProps: DropDownDecoratorProps(
|
||||
// dropdownSearchDecoration: InputDecoration(
|
||||
// border: InputBorder.none,
|
||||
// contentPadding: EdgeInsets.symmetric(horizontal: 1),
|
||||
// ),
|
||||
// ),
|
||||
// dropdownBuilder:
|
||||
// (context, selectedItem) => Align(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// child: Text(
|
||||
// selectedItem ?? "Select",
|
||||
// style: TextStyle(fontSize: 12),
|
||||
// ),
|
||||
// ),
|
||||
// onChanged: (String? newValue) {
|
||||
// setState(() {
|
||||
// selectedTo =
|
||||
// countryMap.entries
|
||||
// .firstWhere(
|
||||
// (entry) => entry.value == newValue,
|
||||
// )
|
||||
// .key;
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
CustomTextFieldItnerarySubWrapper(
|
||||
isFocused: _toFocus,
|
||||
isFocused: _toFocus ?? false,
|
||||
isDesktop: isDesktop,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child:
|
||||
isCountryLoading
|
||||
? Center(child: CircularProgressIndicator())
|
||||
: DropdownSearch<String>(
|
||||
selectedItem:
|
||||
selectedTo != null
|
||||
? countryMap[selectedTo] // get the display value from code
|
||||
: null,
|
||||
popupProps: PopupProps.menu(
|
||||
menuProps: MenuProps(backgroundColor: Colors.white),
|
||||
constraints: BoxConstraints(maxHeight: 230),
|
||||
showSearchBox: true,
|
||||
searchFieldProps: TextFieldProps(
|
||||
decoration: InputDecoration(
|
||||
hintText: "Search ...",
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
items: countryMap.values.toList(),
|
||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
||||
dropdownSearchDecoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 1),
|
||||
),
|
||||
),
|
||||
dropdownBuilder:
|
||||
(context, selectedItem) => Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
selectedItem ?? "Select",
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
selectedTo =
|
||||
countryMap.entries
|
||||
.firstWhere(
|
||||
(entry) => entry.value == newValue,
|
||||
)
|
||||
.key;
|
||||
});
|
||||
},
|
||||
),
|
||||
child: DropdownSearch<String>(
|
||||
selectedItem: countryMap[selectedTo],
|
||||
popupProps: PopupProps.menu(
|
||||
showSearchBox: true,
|
||||
fit: FlexFit.loose,
|
||||
constraints: BoxConstraints(maxHeight: 250),
|
||||
menuProps: const MenuProps(backgroundColor: Colors.white),
|
||||
itemBuilder:
|
||||
(context, item, isSelected) => Container(
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 6,
|
||||
),
|
||||
child: Text(
|
||||
item,
|
||||
style: GoogleFonts.poppins(fontSize: 11.5),
|
||||
),
|
||||
),
|
||||
searchFieldProps: TextFieldProps(
|
||||
decoration: InputDecoration(
|
||||
hintText: "Search ...",
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 10),
|
||||
),
|
||||
),
|
||||
),
|
||||
items: countryMap.values.toList(),
|
||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
||||
dropdownSearchDecoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 1),
|
||||
),
|
||||
),
|
||||
dropdownBuilder:
|
||||
(context, selectedItem) => Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
selectedItem ?? "Select ",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
selectedTo =
|
||||
countryMap.entries
|
||||
.firstWhere(
|
||||
(entry) => entry.value == newValue,
|
||||
)
|
||||
.key;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
if (errorMessages["to_station"] != null) ...[
|
||||
|
||||
@ -457,26 +457,86 @@ class _VisaScreenState extends State<VisaScreen> {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFieldWrapper(
|
||||
// CustomTextFieldWrapper(
|
||||
// isFocused: _isHotelNameFocused,
|
||||
// isDesktop: isDesktop,
|
||||
// // width: isDesktop ? MediaQuery.of(context).size.width * 0.15 : null,
|
||||
// width:
|
||||
// isDesktop
|
||||
// ? MediaQuery.of(context).size.width * 0.34
|
||||
// : MediaQuery.of(context).size.width * 0.66,
|
||||
// child: SizedBox(
|
||||
// height: 40,
|
||||
// child: DropdownSearch<String>(
|
||||
// selectedItem: countryMap[selectedCountry],
|
||||
// popupProps: PopupProps.menu(
|
||||
// showSearchBox: true, // Enables search functionality
|
||||
// searchFieldProps: TextFieldProps(
|
||||
// decoration: InputDecoration(
|
||||
// hintText: "Search ...",
|
||||
// contentPadding: EdgeInsets.symmetric(horizontal: 10),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// items: countryMap.values.toList(),
|
||||
// dropdownDecoratorProps: DropDownDecoratorProps(
|
||||
// dropdownSearchDecoration: InputDecoration(
|
||||
// border: InputBorder.none,
|
||||
// contentPadding: EdgeInsets.symmetric(horizontal: 1),
|
||||
// ),
|
||||
// ),
|
||||
// dropdownBuilder:
|
||||
// (context, selectedItem) => Align(
|
||||
// // Center-align selected item
|
||||
// alignment: Alignment.centerLeft,
|
||||
// child: Text(
|
||||
// selectedItem ?? "Select ",
|
||||
// style: TextStyle(fontSize: 12),
|
||||
// ),
|
||||
// ),
|
||||
// onChanged: (String? newValue) {
|
||||
// setState(() {
|
||||
// // Find the country_code based on selected country_name
|
||||
// selectedCountry =
|
||||
// countryMap.entries
|
||||
// .firstWhere((entry) => entry.value == newValue)
|
||||
// .key;
|
||||
//
|
||||
// if (selectedCountry!.isNotEmpty) {
|
||||
// errorMessages.remove("country_code");
|
||||
// }
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
CustomTextFieldItnerarySubWrapper(
|
||||
isFocused: _isHotelNameFocused,
|
||||
isDesktop: isDesktop,
|
||||
// width: isDesktop ? MediaQuery.of(context).size.width * 0.15 : null,
|
||||
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: DropdownSearch<String>(
|
||||
selectedItem: countryMap[selectedCountry],
|
||||
popupProps: PopupProps.menu(
|
||||
showSearchBox: true, // Enables search functionality
|
||||
showSearchBox: true,
|
||||
searchFieldProps: TextFieldProps(
|
||||
decoration: InputDecoration(
|
||||
hintText: "Search ...",
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 10),
|
||||
),
|
||||
),
|
||||
itemBuilder: (context, item, isSelected) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
child: Text(
|
||||
item,
|
||||
style: TextStyle(fontSize: 12,color: Colors.black,),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
items: countryMap.values.toList(),
|
||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
||||
@ -485,26 +545,19 @@ class _VisaScreenState extends State<VisaScreen> {
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 1),
|
||||
),
|
||||
),
|
||||
dropdownBuilder:
|
||||
(context, selectedItem) => Align(
|
||||
// Center-align selected item
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
selectedItem ?? "Select ",
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
),
|
||||
dropdownBuilder: (context, selectedItem) => Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
selectedItem ?? "Select",
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
// Find the country_code based on selected country_name
|
||||
selectedCountry =
|
||||
countryMap.entries
|
||||
.firstWhere((entry) => entry.value == newValue)
|
||||
.key;
|
||||
selectedCountry = countryMap.entries
|
||||
.firstWhere((entry) => entry.value == newValue)
|
||||
.key;
|
||||
|
||||
if (selectedCountry!.isNotEmpty) {
|
||||
errorMessages.remove("country_code");
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
@ -530,38 +583,116 @@ class _VisaScreenState extends State<VisaScreen> {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
// CustomTextFieldWrapper(
|
||||
// isFocused: _tripTypeFocused,
|
||||
// isDesktop: isDesktop,
|
||||
// width: isDesktop ? MediaQuery.of(context).size.width * 0.15 : null,
|
||||
// // 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
|
||||
// value: selectedPurpose,
|
||||
// style: TextStyle(fontSize: 12),
|
||||
// decoration: InputDecoration(
|
||||
// border: InputBorder.none,
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// horizontal: 10,
|
||||
// ), // Proper padding
|
||||
// ),
|
||||
// onChanged:
|
||||
// purposeList.isNotEmpty
|
||||
// ? (newValue) {
|
||||
// setState(() {
|
||||
// selectedPurpose = newValue;
|
||||
// });
|
||||
// print(
|
||||
// "Updating form data: Flight -> trip_type -> ${newValue ?? ""}",
|
||||
// );
|
||||
// }
|
||||
// : null,
|
||||
//
|
||||
// items: dropdownItems,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
CustomTextFieldWrapper(
|
||||
isFocused: _tripTypeFocused,
|
||||
isDesktop: isDesktop,
|
||||
width: isDesktop ? MediaQuery.of(context).size.width * 0.15 : null,
|
||||
// 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
|
||||
value: selectedPurpose,
|
||||
style: TextStyle(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
), // Proper padding
|
||||
width: double.infinity,
|
||||
child: DropdownSearch<Map<String, dynamic>>(
|
||||
items: purposeList.cast<Map<String, dynamic>>(),
|
||||
selectedItem: purposeList.firstWhere(
|
||||
(item) => item['dropdown_key'] == selectedPurpose,
|
||||
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: 5,
|
||||
),
|
||||
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: 10,),
|
||||
),
|
||||
),
|
||||
dropdownBuilder: (context, selectedItem) {
|
||||
if (selectedItem == null || selectedItem.isEmpty) {
|
||||
return Text(
|
||||
"Select ",
|
||||
style: GoogleFonts.poppins(
|
||||
color: Colors.grey,
|
||||
fontSize: 13,
|
||||
),
|
||||
);
|
||||
}
|
||||
return Text(
|
||||
selectedItem['dropdown_value'] ?? '',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
color: Colors.black,
|
||||
),
|
||||
);
|
||||
},
|
||||
// focusNode: _tripTypeFocusNode, // Assign the correct focus node
|
||||
// value: selectedPurpose,
|
||||
// style: TextStyle(fontSize: 12),
|
||||
// decoration: InputDecoration(
|
||||
// border: InputBorder.none,
|
||||
// contentPadding:
|
||||
// EdgeInsets.symmetric(horizontal: 10), // Proper padding
|
||||
// ),
|
||||
onChanged:
|
||||
purposeList.isNotEmpty
|
||||
? (newValue) {
|
||||
setState(() {
|
||||
selectedPurpose = newValue;
|
||||
});
|
||||
print(
|
||||
"Updating form data: Flight -> trip_type -> ${newValue ?? ""}",
|
||||
);
|
||||
}
|
||||
: null,
|
||||
|
||||
items: dropdownItems,
|
||||
purposeList.isNotEmpty
|
||||
? (Map<String, dynamic>? newValue) {
|
||||
setState(() {
|
||||
selectedPurpose= newValue?['dropdown_key'];
|
||||
print("Selected Purpose: ${selectedPurpose}");
|
||||
});
|
||||
}
|
||||
: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -1494,7 +1494,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
||||
if (pickedDate != null) {
|
||||
_selectedDateOfExpiry = pickedDate;
|
||||
controllers["dateOfExpiry"]?.text = DateFormat(
|
||||
"yyyy-MM-dd",
|
||||
"dd-MM-yyyy",
|
||||
).format(pickedDate);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user