From 99b8ae5b21b4b4ed8410f1fe5ae7e9159eaf81d6 Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Sat, 7 Jun 2025 18:03:57 +0530 Subject: [PATCH] itnerary files --- lib/Screens/itnerary/accomodations.dart | 2 +- lib/Screens/itnerary/bus.dart | 5 +- lib/Screens/itnerary/insurance.dart | 212 ++++++++++++++++++++---- lib/Screens/plans/list_plans.dart | 4 +- lib/widgets/popup_userList_action.dart | 4 +- 5 files changed, 192 insertions(+), 35 deletions(-) diff --git a/lib/Screens/itnerary/accomodations.dart b/lib/Screens/itnerary/accomodations.dart index 8493ff7..061f1bb 100644 --- a/lib/Screens/itnerary/accomodations.dart +++ b/lib/Screens/itnerary/accomodations.dart @@ -817,7 +817,7 @@ class _AccomodationScreenState extends State { child: TextField( focusNode: _checkOutFocusNode, controller: _checkOutController, - style: const TextStyle(fontSize: 12), + style: const TextStyle(fontSize: 12, color: Colors.black), decoration: const InputDecoration( labelText: "Select Date", labelStyle: TextStyle(fontSize: 12, color: Colors.grey), diff --git a/lib/Screens/itnerary/bus.dart b/lib/Screens/itnerary/bus.dart index a8990d8..56c39b4 100644 --- a/lib/Screens/itnerary/bus.dart +++ b/lib/Screens/itnerary/bus.dart @@ -327,7 +327,8 @@ class _BusScreenState extends State { child: DropdownButtonFormField( focusNode: _tripTypeFocusNode, // Assign the correct focus node value: selectedPurpose, - style: TextStyle(fontSize: 12), + // style: TextStyle(fontSize: 12), + style: GoogleFonts.poppins(fontSize: 12, color: Colors.black), decoration: InputDecoration( border: InputBorder.none, contentPadding: @@ -561,7 +562,7 @@ class _BusScreenState extends State { child: TextField( focusNode: _timeFocusNode, controller: _timeController, - style: const TextStyle(fontSize: 12), + style: const TextStyle(fontSize: 12, color: Colors.black), decoration: const InputDecoration( labelText: "Select Time", labelStyle: TextStyle(fontSize: 12, color: Colors.grey), diff --git a/lib/Screens/itnerary/insurance.dart b/lib/Screens/itnerary/insurance.dart index 5998146..0a23644 100644 --- a/lib/Screens/itnerary/insurance.dart +++ b/lib/Screens/itnerary/insurance.dart @@ -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'; @@ -39,16 +40,18 @@ class _InsuranceScreenState extends State { final FocusNode _fromFocusNode = FocusNode(); final FocusNode _dateFocusNode = FocusNode(); final FocusNode _commentsFocusNode = FocusNode(); + final FocusNode _nomineeFocusNode = FocusNode(); late TextEditingController _tripTypeController = TextEditingController(); late TextEditingController _startdateController = TextEditingController(); late TextEditingController _endDateController = TextEditingController(); - late TextEditingController _insuranceCommentsController = - TextEditingController(); + late TextEditingController _insuranceCommentsController = TextEditingController(); + late TextEditingController _nomineeController = TextEditingController(); bool _isHotelNameFocused = false; bool _dateFocus = false; bool _commentsFocus = false; + bool _nomineeFocus = false; String? selectedTripType; String? selectedInsuranceType; @@ -61,6 +64,7 @@ class _InsuranceScreenState extends State { "start_date": _startdateController.text, "end_date": _endDateController.text, "comments": _insuranceCommentsController.text, + "nominee_name" : _nomineeController.text, "created_by": widget.loginUser, "updated_by": widget.loginUser, }; @@ -98,12 +102,20 @@ class _InsuranceScreenState extends State { }); }); + _nomineeFocusNode.addListener(() { + setState(() { + _nomineeFocus = _nomineeFocusNode.hasFocus; + }); + }); + _insuranceCommentsController = TextEditingController(text: widget.selectedItem?["comments"] ?? ""); _startdateController = TextEditingController(text: widget.selectedItem?["start_date"] ?? ""); _endDateController = TextEditingController(text: widget.selectedItem?['end_date'] ?? ""); + _nomineeController = + TextEditingController(text: widget.selectedItem?['nominee_name'] ?? ""); // Set the selected value if available if (widget.selectedItem != null && @@ -249,6 +261,7 @@ class _InsuranceScreenState extends State { _tripTypeController.dispose(); _startdateController.dispose(); _insuranceCommentsController.dispose(); + _nomineeController.dispose(); super.dispose(); } @@ -311,7 +324,7 @@ class _InsuranceScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Insurance Type", + "Insurance Type", // not in use style: GoogleFonts.poppins( fontSize: 12, fontWeight: FontWeight.w500, @@ -370,7 +383,7 @@ class _InsuranceScreenState extends State { child: DropdownButtonFormField( focusNode: _tripTypeFocusNode, // Assign the correct focus node value: selectedInsuranceType, - style: TextStyle(fontSize: 12), + style: GoogleFonts.poppins(fontSize: 12, color: Colors.black), decoration: InputDecoration( border: InputBorder.none, contentPadding: @@ -396,6 +409,93 @@ class _InsuranceScreenState extends State { ]; } + + List _buildInsuranceTypeDropdown(bool isDesktop) { + // List purposeList = widget.apiData?['insurance_type_of_insurance'] ?? []; + List> purposeList = (widget.apiData?['insurance_type_of_insurance'] as List?) + ?.map((e) => Map.from(e as Map)) + .toList() ?? []; + + // Find selected item object based on key + Map? selectedItem = purposeList.firstWhere( + (item) => item['dropdown_key'] == selectedInsuranceType, + orElse: () => {}, + ); + + return [ + CustomTextFieldWrapper( + isFocused: false, + isDesktop: isDesktop, + child: SizedBox( + height: 35, + width: double.infinity, + child: DropdownSearch>( + popupProps: PopupProps.menu( + showSearchBox: false, + fit: FlexFit.loose, + constraints: BoxConstraints(maxHeight: 10), + menuProps: const MenuProps(backgroundColor: Colors.white), + itemBuilder: (context, item, isSelected) { + return Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 8, + ), + child: Text( + item['dropdown_value'] ?? '', + style: GoogleFonts.poppins( + fontSize: 12, // 👈 Smaller font size + color: Colors.black, + ), + ), + ); + }, + ), + dropdownDecoratorProps: const DropDownDecoratorProps( + dropdownSearchDecoration: InputDecoration( + border: InputBorder.none, // No underline + + contentPadding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, + ), + ), + ), + + dropdownBuilder: (context, selectedItem) { + if (selectedItem == null || selectedItem.isEmpty) { + return Text( + "Select Insurance Type", + style: GoogleFonts.poppins(color: Colors.grey, fontSize: 13), + ); + } + return Text( + selectedItem['dropdown_value'] ?? '', + style: GoogleFonts.poppins(fontSize: 12, color: Colors.black), + ); + }, + selectedItem: selectedItem!.isNotEmpty ? selectedItem : null, + itemAsString: (item) => item['dropdown_value'] ?? '', + onChanged: purposeList.isNotEmpty + ? (Map? newItem) { + if (newItem != null) { + setState(() { + selectedInsuranceType = newItem['dropdown_key']; + errorMessages.remove("type_of_insurance"); + }); + print("Selected Insurance Type: $selectedInsuranceType"); + } + } + : null, + items: purposeList, + ), + ), + ), + ]; + } + + + List _buildSecondRow(bool isDesktop) { List purposeList = widget.apiData?['insurance_type_of_insurance'] ?? []; @@ -524,47 +624,103 @@ class _InsuranceScreenState extends State { } } + return [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "Insurance Type *", + style: GoogleFonts.poppins( + fontSize: 12, + fontWeight: FontWeight.w500, + color: const Color(0xFF575A74), + ), + ), + const SizedBox(height: 5), + + // ▼ Dropdown Wrapper ▼ + CustomTextFieldWrapper( + isFocused: _isHotelNameFocused, + isDesktop: isDesktop, + width: isDesktop ? MediaQuery.of(context).size.width * 0.17 : null, + child: SizedBox( + height: 35, + width: double.infinity, + child: DropdownButtonFormField( + 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>((item) { + return DropdownMenuItem( + 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, + ), + ), + ), + ], + ), + + if (isDesktop) + Spacer() + else + SizedBox( + height: 8, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Nominee", style: GoogleFonts.poppins( fontSize: 12, - fontWeight: FontWeight.w500, + fontWeight: FontWeight.w600, color: Color(0xFF575A74)), ), SizedBox(height: 5), CustomTextFieldWrapper( - isFocused: _isHotelNameFocused, + isFocused: _nomineeFocus, isDesktop: isDesktop, - width: isDesktop ? MediaQuery.of(context).size.width * 0.34 : null, + width: isDesktop ? MediaQuery.of(context).size.width * 0.15 : null, + // width: isDesktop ? MediaQuery.of(context).size.width * 0.34 : null, child: SizedBox( height: 40, - child: DropdownButtonFormField( - focusNode: _tripTypeFocusNode, // Assign the correct focus node - value: selectedInsuranceType, + child: TextField( + focusNode: _nomineeFocusNode, + controller: _nomineeController, style: TextStyle(fontSize: 12), decoration: InputDecoration( + labelText: "Nominee", + labelStyle: TextStyle(fontSize: 12, color: Colors.grey), + floatingLabelBehavior: FloatingLabelBehavior.never, border: InputBorder.none, - contentPadding: - EdgeInsets.symmetric(horizontal: 10), // Proper padding + contentPadding: EdgeInsets.symmetric(vertical: 16), + // contentPadding: EdgeInsets.symmetric(horizontal: 1,vertical: 1), ), - onChanged: purposeList.isNotEmpty - ? (newValue) { - setState(() { - selectedInsuranceType = newValue; - if (selectedInsuranceType!.isNotEmpty) { - errorMessages.remove("type_of_insurance"); - } - }); - - print(selectedInsuranceType); - } - : null, - - items: dropdownItems, ), ), ), @@ -609,7 +765,7 @@ class _InsuranceScreenState extends State { controller: _startdateController, style: const TextStyle(fontSize: 12), decoration: const InputDecoration( - labelText: "Select Date", + labelText: "Select ", labelStyle: TextStyle(fontSize: 12, color: Colors.grey), floatingLabelBehavior: FloatingLabelBehavior.never, border: InputBorder.none, @@ -682,7 +838,7 @@ class _InsuranceScreenState extends State { controller: _endDateController, style: const TextStyle(fontSize: 12), decoration: const InputDecoration( - labelText: "Select Date", + labelText: "Select ", labelStyle: TextStyle(fontSize: 12, color: Colors.grey), floatingLabelBehavior: FloatingLabelBehavior.never, border: InputBorder.none, diff --git a/lib/Screens/plans/list_plans.dart b/lib/Screens/plans/list_plans.dart index 39b3e23..1ffebbf 100644 --- a/lib/Screens/plans/list_plans.dart +++ b/lib/Screens/plans/list_plans.dart @@ -968,7 +968,7 @@ class _ListPlansState extends State { height: 15, ), tooltip: - 'Edit Trip/Plans Details', + 'Edit Trip Details', onPressed: () { Navigator.pop( context, @@ -1222,7 +1222,7 @@ class _ListPlansState extends State { height: 15, ), tooltip: - 'Edit Trip/plan Details', + 'Edit Trip Details', onPressed: () { Navigator.pop( context, diff --git a/lib/widgets/popup_userList_action.dart b/lib/widgets/popup_userList_action.dart index aa66b34..5ff7a85 100644 --- a/lib/widgets/popup_userList_action.dart +++ b/lib/widgets/popup_userList_action.dart @@ -42,7 +42,7 @@ class UserActionsMenu extends StatelessWidget { children: [ GestureDetector( child: Tooltip( - message: 'View User Details', + message: 'View Details', child: Icon(Icons.remove_red_eye, color: Color(0xFF475569), size: 18) ), @@ -61,7 +61,7 @@ class UserActionsMenu extends StatelessWidget { SizedBox(width: 8), GestureDetector( child: Tooltip( - message: 'Edit User Details', + message: 'Edit Details', child: Image.asset( 'assets/images/IconsImg/edit.png', width: 20,