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