From 7527838cf5937a79a67dbe52e8e7549df5bf5c8d Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Tue, 10 Jun 2025 17:14:28 +0530 Subject: [PATCH] date validation --- lib/Screens/itnerary/forex.dart | 26 +- .../create_user/create_user.dart | 39 +- .../create_user/personal_details.dart | 3 +- .../create_user/traveller_details.dart | 572 ++++++++++++++++-- 4 files changed, 576 insertions(+), 64 deletions(-) diff --git a/lib/Screens/itnerary/forex.dart b/lib/Screens/itnerary/forex.dart index efc0c04..7edad8a 100644 --- a/lib/Screens/itnerary/forex.dart +++ b/lib/Screens/itnerary/forex.dart @@ -248,6 +248,30 @@ class _ForexScreenState extends State { } } + // Additional validation starts + final start_Date = data["start_date"]; + final end_Date = data["end_date"]; + + if (start_Date != null && + end_Date != null && + start_Date.toString().isNotEmpty && + end_Date.toString().isNotEmpty) { + try { + final format = DateFormat("dd-MM-yyyy"); + + final checkStartDate = format.parse("$start_Date"); + final checkEndDate = format.parse("$end_Date"); + + if (checkEndDate.isBefore(checkStartDate)) { + errorMessages["end_date"] = + "End date cannot be earlier than start date";; + } + } catch (e) { + errorMessages["end_date"] = "Invalid date format"; + } + return errorMessages.isEmpty; + } + // Additional validation ends return errorMessages.values.every((msg) => msg.trim().isEmpty); // if (hasErrors) { @@ -290,7 +314,7 @@ class _ForexScreenState extends State { Map data = forexData; - if (!isValidForexData(data) && errorMessages.isNotEmpty) { + if (!isValidForexData(data)) { // && errorMessages.isNotEmpty) { print("Validation Failed: Required fields are missing."); setState(() {}); return; // Stop execution if validation fails diff --git a/lib/Screens/userManagement/create_user/create_user.dart b/lib/Screens/userManagement/create_user/create_user.dart index 8a1b59f..67c4b1c 100644 --- a/lib/Screens/userManagement/create_user/create_user.dart +++ b/lib/Screens/userManagement/create_user/create_user.dart @@ -654,6 +654,7 @@ class _CreateUserFormDetialsState extends State { void handleSubmit() async { print("USR Detail Submit"); + // printFormData(); bool isValid = travellerDetailsKey.currentState?.boolValidation() ?? false; @@ -668,10 +669,44 @@ class _CreateUserFormDetialsState extends State { travelDetailsData = travellerDetailsKey.currentState?.travel_Detials; + // Additional validation starts - travelDetailsData passport + String start_Date = travelDetailsData?['date_of_issue']; + String end_Date = travelDetailsData?['date_of_expiry']; - print("travelDetailsData - $travelDetailsData"); + if (start_Date != null && end_Date != null && start_Date.toString().isNotEmpty && end_Date.toString().isNotEmpty) { + try { + final format = DateFormat("dd-MM-yyyy"); + final checkStartDate = format.parse("$start_Date"); + final checkEndDate = format.parse("$end_Date"); - print("travelDetailsData - $travelDetailsData"); + if (checkEndDate.isBefore(checkStartDate)) { + // return "End date cannot be earlier than start date";; + return ; + } + } catch (e) { // return "End date cannot be earlier than start date"; + return ; + // errorMessages["end_date"] = "Invalid date format"; + } + } + + // String valid_from = travelDetailsData?['valid_from']; + // String valid_upto = travelDetailsData?['valid_upto']; + // + // if (valid_from != null && valid_upto != null && valid_from.toString().isNotEmpty && valid_upto.toString().isNotEmpty) { + // try { + // final format = DateFormat("dd-MM-yyyy"); + // final checkValidFrom = format.parse("$valid_from"); + // final checkValidUpto = format.parse("$valid_upto"); + // + // if (checkValidUpto.isBefore(checkValidFrom)) { + // // return "End date cannot be earlier than start date"; + // return ; + // } + // } catch (e) { // return "End date cannot be earlier than start date"; + // return ; + // // errorMessages["end_date"] = "Invalid date format"; + // } + // } // errorMessagesTravel = travellerDetailsKey.currentState!.errorMessages; print("TRAVEL DETAILS FROM CHILD"); diff --git a/lib/Screens/userManagement/create_user/personal_details.dart b/lib/Screens/userManagement/create_user/personal_details.dart index 81f6c01..a9c7213 100644 --- a/lib/Screens/userManagement/create_user/personal_details.dart +++ b/lib/Screens/userManagement/create_user/personal_details.dart @@ -1047,7 +1047,8 @@ class PersonalDetailsState extends State { ? _selectedDateOfBirth! : today, firstDate: DateTime(1900), - lastDate: DateTime(2100), + // lastDate: DateTime(2100), + lastDate: today, initialEntryMode: DatePickerEntryMode.calendarOnly, ); diff --git a/lib/Screens/userManagement/create_user/traveller_details.dart b/lib/Screens/userManagement/create_user/traveller_details.dart index 4832258..e86dceb 100644 --- a/lib/Screens/userManagement/create_user/traveller_details.dart +++ b/lib/Screens/userManagement/create_user/traveller_details.dart @@ -1351,8 +1351,10 @@ class TravellerDetailsState extends State { ); } + DateTime? _selectedDateOfIssue; + DateTime? _selectedDateOfExpiry; + Widget buildDateOfIssue() { - DateTime? _selectedDateOfIssue; Future _selectCheckDateOfIssue(BuildContext context) async { DateTime now = DateTime.now(); @@ -1360,11 +1362,9 @@ class TravellerDetailsState extends State { DateTime? pickedDate = await showDatePicker( context: context, - initialDate: - _selectedDateOfIssue != null && _selectedDateOfIssue!.isAfter(today) - ? _selectedDateOfIssue! - : today, - // firstDate: today, + initialDate: _selectedDateOfIssue != null && _selectedDateOfIssue!.isAfter(today) + ? _selectedDateOfIssue! + : today, firstDate: DateTime(1900), lastDate: DateTime(2100), initialEntryMode: DatePickerEntryMode.calendarOnly, @@ -1373,9 +1373,15 @@ class TravellerDetailsState extends State { if (pickedDate != null && pickedDate != _selectedDateOfIssue) { setState(() { _selectedDateOfIssue = pickedDate; - controllers["dateOfIssue"]?.text = DateFormat( - 'dd-MM-yyyy', - ).format(pickedDate); + controllers["dateOfIssue"]?.text = DateFormat('dd-MM-yyyy').format(pickedDate); + + // Revalidate expiry + if (_selectedDateOfExpiry != null && + _selectedDateOfExpiry!.isBefore(_selectedDateOfIssue!)) { + errorMessages["date_of_expiry"] = "Expiry date cannot be earlier than Issue date"; + } else { + errorMessages.remove("date_of_expiry"); + } }); } } @@ -1394,25 +1400,25 @@ class TravellerDetailsState extends State { SizedBox(height: 5), CustomTextFieldUserTravellerWrapper( width: - widget.isDesktop - ? MediaQuery.of(context).size.width * 0.13 - : null, + widget.isDesktop + ? MediaQuery.of(context).size.width * 0.13 + : null, isFocused: false, isDesktop: widget.isDesktop, child: SizedBox( height: 40, child: GestureDetector( onTap: - widget.isViewMode - ? null - : () async { - await _selectCheckDateOfIssue(context); - if (controllers["dateOfIssue"]!.text.isNotEmpty) { - setState(() { - // errorMessages.remove("start_date"); - }); - } - }, + widget.isViewMode + ? null + : () async { + await _selectCheckDateOfIssue(context); + if (controllers["dateOfIssue"]!.text.isNotEmpty) { + setState(() { + // errorMessages.remove("start_date"); + }); + } + }, child: AbsorbPointer( child: TextField( controller: controllers["dateOfIssue"], @@ -1442,19 +1448,18 @@ class TravellerDetailsState extends State { } Widget buildDateOfExpiry() { - DateTime? _selectedDateOfExpiry; Future _selectCheckDateOfExpiry(BuildContext context) async { + DateTime now = DateTime.now(); DateTime today = DateTime(now.year, now.month, now.day); - // DateTime today = DateTime(now.year now.day, now.month,); - + // DateTime firstDate = today; DateTime? validFromDate; try { String? fromDateText = controllers["dateOfIssue"]?.text.trim(); print("dateOfIssue From Text: $fromDateText"); - if (fromDateText!.isNotEmpty) { + if (fromDateText != null && fromDateText.isNotEmpty) { validFromDate = DateFormat('dd-MM-yyyy').parseStrict(fromDateText); print("dateOfIssue Valid From: $validFromDate"); } @@ -1492,10 +1497,17 @@ class TravellerDetailsState extends State { ); if (pickedDate != null) { - _selectedDateOfExpiry = pickedDate; - controllers["dateOfExpiry"]?.text = DateFormat( - "dd-MM-yyyy", - ).format(pickedDate); + setState(() { + _selectedDateOfExpiry = pickedDate; + controllers["dateOfExpiry"]?.text = DateFormat("dd-MM-yyyy").format(pickedDate); + + if (_selectedDateOfIssue != null && + _selectedDateOfExpiry!.isBefore(_selectedDateOfIssue!)) { + errorMessages["date_of_expiry"] = "Expiry date cannot be earlier than Issue date"; + } else { + errorMessages.remove("date_of_expiry"); + } + }); } // if (pickedDate != null && pickedDate != _selectedDateOfExpiry) { @@ -1527,23 +1539,23 @@ class TravellerDetailsState extends State { isFocused: false, isDesktop: widget.isDesktop, width: - widget.isDesktop - ? MediaQuery.of(context).size.width * 0.13 - : null, + widget.isDesktop + ? MediaQuery.of(context).size.width * 0.13 + : null, child: SizedBox( height: 40, child: GestureDetector( onTap: - widget.isViewMode - ? null - : () async { - await _selectCheckDateOfExpiry(context); - if (controllers["dateOfExpiry"]!.text.isNotEmpty) { - setState(() { - // errorMessages.remove("start_date"); - }); - } - }, + widget.isViewMode + ? null + : () async { + await _selectCheckDateOfExpiry(context); + if (controllers["dateOfExpiry"]!.text.isNotEmpty) { + setState(() { + // errorMessages.remove("start_date"); + }); + } + }, child: AbsorbPointer( child: TextField( controller: controllers["dateOfExpiry"], @@ -1568,9 +1580,236 @@ class TravellerDetailsState extends State { ), ), ), + if (errorMessages["date_of_expiry"] != null) ...[ + SizedBox(height: 5), // Space before error message + Text( + errorMessages["date_of_expiry"]!, + style: TextStyle(color: Colors.red, fontSize: 12), + ), + ], ], ); } + // Widget buildDateOfIssue() { + // DateTime? _selectedDateOfIssue; + // + // Future _selectCheckDateOfIssue(BuildContext context) async { + // DateTime now = DateTime.now(); + // DateTime today = DateTime(now.year, now.month, now.day); + // + // DateTime? pickedDate = await showDatePicker( + // context: context, + // initialDate: + // _selectedDateOfIssue != null && _selectedDateOfIssue!.isAfter(today) + // ? _selectedDateOfIssue! + // : today, + // // firstDate: today, + // firstDate: DateTime(1900), + // lastDate: DateTime(2100), + // initialEntryMode: DatePickerEntryMode.calendarOnly, + // ); + // + // if (pickedDate != null && pickedDate != _selectedDateOfIssue) { + // setState(() { + // _selectedDateOfIssue = pickedDate; + // controllers["dateOfIssue"]?.text = DateFormat( + // 'dd-MM-yyyy', + // ).format(pickedDate); + // }); + // } + // } + // + // return Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text( + // "Date of Issue", + // style: GoogleFonts.poppins( + // fontSize: 12, + // fontWeight: FontWeight.w600, + // color: Color(0xFF575A74), + // ), + // ), + // SizedBox(height: 5), + // CustomTextFieldUserTravellerWrapper( + // width: + // widget.isDesktop + // ? MediaQuery.of(context).size.width * 0.13 + // : null, + // isFocused: false, + // isDesktop: widget.isDesktop, + // child: SizedBox( + // height: 40, + // child: GestureDetector( + // onTap: + // widget.isViewMode + // ? null + // : () async { + // await _selectCheckDateOfIssue(context); + // if (controllers["dateOfIssue"]!.text.isNotEmpty) { + // setState(() { + // // errorMessages.remove("start_date"); + // }); + // } + // }, + // child: AbsorbPointer( + // child: TextField( + // controller: controllers["dateOfIssue"], + // style: GoogleFonts.poppins(fontSize: 12, color: Colors.black), + // decoration: InputDecoration( + // labelText: "Select Date", + // labelStyle: GoogleFonts.poppins( + // fontSize: 12, + // color: Colors.grey, + // ), + // floatingLabelBehavior: FloatingLabelBehavior.never, + // border: InputBorder.none, + // contentPadding: const EdgeInsets.symmetric(vertical: 16), + // suffixIcon: const Icon( + // Icons.calendar_today, + // size: 16, + // color: Color(0xFF8B8FB2), + // ), + // ), + // ), + // ), + // ), + // ), + // ), + // ], + // ); + // } + // + // Widget buildDateOfExpiry() { + // DateTime? _selectedDateOfExpiry; + // + // Future _selectCheckDateOfExpiry(BuildContext context) async { + // DateTime now = DateTime.now(); + // DateTime today = DateTime(now.year, now.month, now.day); + // // DateTime today = DateTime(now.year now.day, now.month,); + // + // DateTime? validFromDate; + // + // try { + // String? fromDateText = controllers["dateOfIssue"]?.text.trim(); + // print("dateOfIssue From Text: $fromDateText"); + // if (fromDateText!.isNotEmpty) { + // validFromDate = DateFormat('dd-MM-yyyy').parseStrict(fromDateText); + // print("dateOfIssue Valid From: $validFromDate"); + // } + // } catch (e) { + // print("Error parsing valid from date: $e"); + // } + // + // // Use max(today, validFromDate) as firstDate + // // DateTime firstDate = today; + // DateTime firstDate = validFromDate ?? today; + // + // // Parse dateOfIssue safely + // // DateTime firstDate; + // // try { + // // firstDate = DateFormat( + // // "yyyy-MM-dd", + // // ).parse(controllers["dateOfIssue"]!.text); + // // } catch (e) { + // // firstDate = today; // fallback if parsing fails + // // } + // + // DateTime? pickedDate = await showDatePicker( + // context: context, + // + // // initialDate: + // // _selectedDateOfExpiry != null && + // // _selectedDateOfExpiry!.isAfter(firstDate) + // // ? _selectedDateOfExpiry! + // // : today, + // initialDate: firstDate, + // firstDate: firstDate, + // // firstDate: DateTime(1900), + // lastDate: DateTime(2100), + // initialEntryMode: DatePickerEntryMode.calendarOnly, + // ); + // + // if (pickedDate != null) { + // _selectedDateOfExpiry = pickedDate; + // controllers["dateOfExpiry"]?.text = DateFormat( + // "dd-MM-yyyy", + // ).format(pickedDate); + // } + // + // // if (pickedDate != null && pickedDate != _selectedDateOfExpiry) { + // // setState(() { + // // _selectedDateOfExpiry = pickedDate; + // // controllers["dateOfExpiry"]?.text = DateFormat( + // // 'dd-MM-yyyy', + // // ).format(pickedDate); + // // + // // // controllers["dateOfExpiry"]?.text = + // // // DateFormat('dd-MM-yyyy').format(pickedDate); + // // }); + // // } + // } + // + // return Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text( + // "Date of Expiry", + // style: GoogleFonts.poppins( + // fontSize: 12, + // fontWeight: FontWeight.w600, + // color: Color(0xFF575A74), + // ), + // ), + // SizedBox(height: 5), + // CustomTextFieldUserTravellerWrapper( + // isFocused: false, + // isDesktop: widget.isDesktop, + // width: + // widget.isDesktop + // ? MediaQuery.of(context).size.width * 0.13 + // : null, + // child: SizedBox( + // height: 40, + // child: GestureDetector( + // onTap: + // widget.isViewMode + // ? null + // : () async { + // await _selectCheckDateOfExpiry(context); + // if (controllers["dateOfExpiry"]!.text.isNotEmpty) { + // setState(() { + // // errorMessages.remove("start_date"); + // }); + // } + // }, + // child: AbsorbPointer( + // child: TextField( + // controller: controllers["dateOfExpiry"], + // style: GoogleFonts.poppins(fontSize: 12, color: Colors.black), + // decoration: InputDecoration( + // labelText: "Select Date", + // labelStyle: GoogleFonts.poppins( + // fontSize: 12, + // color: Colors.grey, + // ), + // floatingLabelBehavior: FloatingLabelBehavior.never, + // border: InputBorder.none, + // contentPadding: const EdgeInsets.symmetric(vertical: 16), + // suffixIcon: const Icon( + // Icons.calendar_today, + // size: 16, + // color: Color(0xFF8B8FB2), + // ), + // ), + // ), + // ), + // ), + // ), + // ), + // ], + // ); + // } Widget buildPassportDocument() { void pickPDFWeb() { @@ -3767,8 +4006,11 @@ class TravellerDetailsState extends State { ); } + DateTime? _selectedCheckOutDate; + DateTime? _selectedCheckInDate; + Widget buildVisaValidFrom(Map entry) { - DateTime? _selectedCheckOutDate; + TimeOfDay? _selectedCheckOutTime; Future _selectValidFromDate(BuildContext context) async { @@ -3795,12 +4037,16 @@ class TravellerDetailsState extends State { if (pickedDate != null && pickedDate != _selectedCheckOutDate) { setState(() { - _selectedCheckOutDate = pickedDate; - // _dateController.text = DateFormat('yyyy-MM-dd').format(pickedDate); + _selectedCheckInDate = pickedDate; + entry["controller_valid_from"]?.text = DateFormat('dd-MM-yyyy').format(pickedDate); - entry["controller_valid_from"].text = DateFormat( - 'dd-MM-yyyy', - ).format(pickedDate); + // Revalidate expiry + if (_selectedCheckOutDate != null && + _selectedCheckOutDate!.isBefore(_selectedCheckInDate!)) { + errorMessages["valid_upto"] = "end date cannot be earlier than from date"; + } else { + errorMessages.remove("valid_upto"); + } }); } } @@ -3819,9 +4065,9 @@ class TravellerDetailsState extends State { SizedBox(height: 5), CustomTextFieldUserTravellerWrapper( width: - widget.isDesktop - ? MediaQuery.of(context).size.width * 0.15 - : null, + widget.isDesktop + ? MediaQuery.of(context).size.width * 0.15 + : null, isFocused: false, isDesktop: widget.isDesktop, child: SizedBox( @@ -3858,7 +4104,7 @@ class TravellerDetailsState extends State { } Widget buildVisaValidUpTo(Map entry) { - DateTime? _selectedCheckOutDate; + TimeOfDay? _selectedCheckOutTime; Future _selectValidUpToDate(BuildContext context) async { @@ -3909,11 +4155,14 @@ class TravellerDetailsState extends State { if (pickedDate != null && pickedDate != _selectedCheckOutDate) { setState(() { _selectedCheckOutDate = pickedDate; - // _dateController.text = DateFormat('yyyy-MM-dd').format(pickedDate); + entry["controller_valid_upto"].text = DateFormat("dd-MM-yyyy").format(pickedDate); - entry["controller_valid_upto"].text = DateFormat( - 'dd-MM-yyyy', - ).format(pickedDate); + if (_selectedCheckInDate != null && + _selectedCheckOutDate!.isBefore(_selectedCheckInDate!)) { + errorMessages["valid_upto"] = "end date cannot be earlier than from date"; + } else { + errorMessages.remove("valid_upto"); + } }); } } @@ -3932,9 +4181,9 @@ class TravellerDetailsState extends State { SizedBox(height: 5), CustomTextFieldUserTravellerWrapper( width: - widget.isDesktop - ? MediaQuery.of(context).size.width * 0.15 - : null, + widget.isDesktop + ? MediaQuery.of(context).size.width * 0.15 + : null, isFocused: false, isDesktop: widget.isDesktop, child: SizedBox( @@ -3970,6 +4219,209 @@ class TravellerDetailsState extends State { ); } + // Widget buildVisaValidFrom(Map entry) { + // DateTime? _selectedCheckOutDate; + // TimeOfDay? _selectedCheckOutTime; + // + // Future _selectValidFromDate(BuildContext context) async { + // DateTime now = DateTime.now(); + // DateTime today = DateTime(now.year, now.month, now.day); + // + // // Parse date from notifier if available, else use today + // DateTime initialDate = today; + // + // // Use previously selected date if valid + // if (_selectedCheckOutDate != null && + // _selectedCheckOutDate!.isAfter(today)) { + // initialDate = _selectedCheckOutDate!; + // } + // + // final pickedDate = await showDatePicker( + // context: context, + // // initialDate: initialDate, + // // firstDate: initialDate, + // firstDate: DateTime(1900), + // lastDate: DateTime(2100), + // initialEntryMode: DatePickerEntryMode.calendarOnly, + // ); + // + // if (pickedDate != null && pickedDate != _selectedCheckOutDate) { + // setState(() { + // _selectedCheckOutDate = pickedDate; + // // _dateController.text = DateFormat('yyyy-MM-dd').format(pickedDate); + // + // entry["controller_valid_from"].text = DateFormat( + // 'dd-MM-yyyy', + // ).format(pickedDate); + // }); + // } + // } + // + // return Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text( + // "Valid From", + // style: GoogleFonts.poppins( + // fontSize: 12, + // fontWeight: FontWeight.w600, + // color: Color(0xFF575A74), + // ), + // ), + // SizedBox(height: 5), + // CustomTextFieldUserTravellerWrapper( + // width: + // widget.isDesktop + // ? MediaQuery.of(context).size.width * 0.15 + // : null, + // isFocused: false, + // isDesktop: widget.isDesktop, + // child: SizedBox( + // height: 40, + // child: GestureDetector( + // onTap: () async { + // await _selectValidFromDate(context); + // }, + // child: AbsorbPointer( + // child: TextField( + // // focusNode: _dateFocusNode, + // controller: entry["controller_valid_from"], + // + // style: const TextStyle(fontSize: 12), + // decoration: const InputDecoration( + // labelText: "Select Date", + // labelStyle: TextStyle(fontSize: 12, color: Colors.grey), + // floatingLabelBehavior: FloatingLabelBehavior.never, + // border: InputBorder.none, + // contentPadding: EdgeInsets.symmetric(vertical: 16), + // suffixIcon: Icon( + // Icons.calendar_today, + // size: 16, + // color: Colors.grey, + // ), + // ), + // ), + // ), + // ), + // ), + // ), + // ], + // ); + // } + // + // Widget buildVisaValidUpTo(Map entry) { + // DateTime? _selectedCheckOutDate; + // TimeOfDay? _selectedCheckOutTime; + // + // Future _selectValidUpToDate(BuildContext context) async { + // DateTime now = DateTime.now(); + // DateTime today = DateTime(now.year, now.month, now.day); + // print("buildVisaValidUpTo "); + // print("buildVisaValidUpTo - ${entry["controller_valid_from"].text}"); + // + // // Parse date from notifier if available, else use today + // DateTime initialDate = today; + // + // // Use previously selected date if valid + // // if (_selectedCheckOutDate != null && + // // _selectedCheckOutDate!.isAfter(today)) { + // // initialDate = _selectedCheckOutDate!; + // // } + // + // DateTime? validFromDate; + // + // try { + // String fromDateText = entry["controller_valid_from"].text.trim(); + // print("Valid From Text: $fromDateText"); + // if (fromDateText.isNotEmpty) { + // validFromDate = DateFormat('dd-MM-yyyy').parseStrict(fromDateText); + // print("Parsed Valid From: $validFromDate"); + // } + // } catch (e) { + // print("Error parsing valid from date: $e"); + // } + // + // // Use max(today, validFromDate) as firstDate + // // DateTime firstDate = today; + // DateTime firstDate = validFromDate ?? today; + // if (validFromDate != null && validFromDate.isAfter(today)) { + // firstDate = validFromDate; + // } + // final pickedDate = await showDatePicker( + // context: context, + // // initialDate: initialDate, + // // firstDate: initialDate, + // // firstDate: DateTime(1900), + // initialDate: firstDate, + // firstDate: firstDate, + // lastDate: DateTime(2100), + // initialEntryMode: DatePickerEntryMode.calendarOnly, + // ); + // + // if (pickedDate != null && pickedDate != _selectedCheckOutDate) { + // setState(() { + // _selectedCheckOutDate = pickedDate; + // // _dateController.text = DateFormat('yyyy-MM-dd').format(pickedDate); + // + // entry["controller_valid_upto"].text = DateFormat( + // 'dd-MM-yyyy', + // ).format(pickedDate); + // }); + // } + // } + // + // return Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text( + // "Valid To", + // style: GoogleFonts.poppins( + // fontSize: 12, + // fontWeight: FontWeight.w600, + // color: Color(0xFF575A74), + // ), + // ), + // SizedBox(height: 5), + // CustomTextFieldUserTravellerWrapper( + // width: + // widget.isDesktop + // ? MediaQuery.of(context).size.width * 0.15 + // : null, + // isFocused: false, + // isDesktop: widget.isDesktop, + // child: SizedBox( + // height: 40, + // child: GestureDetector( + // onTap: () async { + // await _selectValidUpToDate(context); + // }, + // child: AbsorbPointer( + // child: TextField( + // // focusNode: _dateFocusNode, + // // controller: _dateController, + // controller: entry["controller_valid_upto"], + // style: const TextStyle(fontSize: 12), + // decoration: const InputDecoration( + // labelText: "Select Date", + // labelStyle: TextStyle(fontSize: 12, color: Colors.grey), + // floatingLabelBehavior: FloatingLabelBehavior.never, + // border: InputBorder.none, + // contentPadding: EdgeInsets.symmetric(vertical: 16), + // suffixIcon: Icon( + // Icons.calendar_today, + // size: 16, + // color: Colors.grey, + // ), + // ), + // ), + // ), + // ), + // ), + // ), + // ], + // ); + // } + Widget IconForVisa() { return Container( height: 60, // must define height