From b24215272f044dfa31bfd40f049592029410c60a Mon Sep 17 00:00:00 2001 From: venbaittech Date: Fri, 1 Aug 2025 16:48:08 +0530 Subject: [PATCH] FOREX DWNLD --- lib/Screens/allTrips/list_all_plans.dart | 42 +- lib/Screens/allTrips/travel_agent_list.dart | 40 +- lib/Screens/approvals/approval_list.dart | 40 +- lib/Screens/dashboard/status_dashboard.dart | 4 +- lib/Screens/itnerary/forex.dart | 45 +- .../itnerary_list/accomodation_list.dart | 49 +- lib/Screens/itnerary_list/bus_list.dart | 2 +- lib/Screens/itnerary_list/forex_list.dart | 30 +- lib/Screens/itnerary_list/insurance_list.dart | 1 + .../itnerary_list/miscellaneous_list.dart | 3 +- lib/Screens/itnerary_list/taxi_list.dart | 3 +- lib/Screens/itnerary_list/train_list.dart | 2 +- lib/Screens/itnerary_list/visa_list.dart | 1 + lib/Screens/organization/themeColor.dart | 17 +- lib/Screens/plans/create_plans.dart | 14 +- lib/Screens/plans/list_plans.dart | 314 +-- lib/Screens/policy/policy.dart | 839 +++--- lib/Screens/policy/policyCriteria.dart | 2258 ++++++++++------- 18 files changed, 2047 insertions(+), 1657 deletions(-) diff --git a/lib/Screens/allTrips/list_all_plans.dart b/lib/Screens/allTrips/list_all_plans.dart index d9586e7..cedf96b 100644 --- a/lib/Screens/allTrips/list_all_plans.dart +++ b/lib/Screens/allTrips/list_all_plans.dart @@ -540,23 +540,29 @@ class _ListAllPlansState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - children: [ - Text( - 'All Trips', - style: GoogleFonts.poppins( - fontSize: isDesktop ? 16 : 14, - fontWeight: FontWeight.w600, - color: Colors.black, - ), + Padding( + padding: + isDesktop + ? const EdgeInsets.all(0) + : const EdgeInsets.only(left: 14.0), + child: Row( + children: [ + Text( + 'All Trips', + style: GoogleFonts.poppins( + fontSize: isDesktop ? 16 : 14, + fontWeight: FontWeight.w600, + color: Colors.black, + ), - // style: TextStyle( - // fontFamily: "Inter", - // fontSize: isDesktop ? 16 : 14, - // fontWeight: FontWeight.w600, - // color: const Color(0xFF212121) ) - ), - ], + // style: TextStyle( + // fontFamily: "Inter", + // fontSize: isDesktop ? 16 : 14, + // fontWeight: FontWeight.w600, + // color: const Color(0xFF212121) ) + ), + ], + ), ), SizedBox(width: 1), @@ -1153,7 +1159,7 @@ class _ListAllPlansState extends State { context, ); apiService - .getPdfDownload( + .getForexPdfDownload( plan.forexId, ); }, @@ -1445,7 +1451,7 @@ class _ListAllPlansState extends State { context, ); apiService - .getPdfDownload( + .getForexPdfDownload( plan.forexId, ); }, diff --git a/lib/Screens/allTrips/travel_agent_list.dart b/lib/Screens/allTrips/travel_agent_list.dart index c5a6d9a..acfb6f0 100644 --- a/lib/Screens/allTrips/travel_agent_list.dart +++ b/lib/Screens/allTrips/travel_agent_list.dart @@ -395,22 +395,28 @@ class _TravelAgentListPlansState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - children: [ - Text( - 'Trips', - style: GoogleFonts.poppins( - fontSize: isDesktop ? 16 : 14, - fontWeight: FontWeight.w600, - color: Colors.black, + Padding( + padding: + isDesktop + ? const EdgeInsets.all(0) + : const EdgeInsets.only(left: 14.0), + child: Row( + children: [ + Text( + 'Trips', + style: GoogleFonts.poppins( + fontSize: isDesktop ? 16 : 14, + fontWeight: FontWeight.w600, + color: Colors.black, + ), + // style: TextStyle( + // fontFamily: "Inter", + // fontSize: isDesktop ? 16 : 14, + // fontWeight: FontWeight.w600, + // color: Color(0xFF212121)) ), - // style: TextStyle( - // fontFamily: "Inter", - // fontSize: isDesktop ? 16 : 14, - // fontWeight: FontWeight.w600, - // color: Color(0xFF212121)) - ), - ], + ], + ), ), Spacer(), @@ -455,7 +461,7 @@ class _TravelAgentListPlansState extends State { ), // SizedBox(width: 16), - Spacer(), + // Spacer(), // ElevatedButton( // style: ElevatedButton.styleFrom( // foregroundColor: Colors.white, @@ -905,7 +911,7 @@ class _TravelAgentListPlansState extends State { context, ); apiService - .getPdfDownload( + .getForexPdfDownload( plan.forexId, ); }, diff --git a/lib/Screens/approvals/approval_list.dart b/lib/Screens/approvals/approval_list.dart index f1c714c..09e509b 100644 --- a/lib/Screens/approvals/approval_list.dart +++ b/lib/Screens/approvals/approval_list.dart @@ -755,22 +755,28 @@ class _ApprovalListState extends State { // ), Row( children: [ - Row( - children: [ - Text( - 'My Approvals', - style: GoogleFonts.poppins( - fontSize: isDesktop ? 16 : 14, - fontWeight: FontWeight.w600, - color: Colors.black, + Padding( + padding: + isDesktop + ? const EdgeInsets.all(0) + : const EdgeInsets.only(left: 14.0), + child: Row( + children: [ + Text( + 'My Approvals', + style: GoogleFonts.poppins( + fontSize: isDesktop ? 16 : 14, + fontWeight: FontWeight.w600, + color: Colors.black, + ), + // style: TextStyle( + // fontFamily: "Inter", + // fontSize: isDesktop ? 16 : 14, + // fontWeight: FontWeight.w600, + // ) ), - // style: TextStyle( - // fontFamily: "Inter", - // fontSize: isDesktop ? 16 : 14, - // fontWeight: FontWeight.w600, - // ) - ), - ], + ], + ), ), if (isDesktop) SizedBox(width: MediaQuery.of(context).size.width * 0.23), @@ -1356,7 +1362,7 @@ class _ApprovalListState extends State { context, ); apiService - .getPdfDownload( + .getForexPdfDownload( plan.forexId, ); }, @@ -1665,7 +1671,7 @@ class _ApprovalListState extends State { context, ); apiService - .getPdfDownload( + .getForexPdfDownload( plan.forexId, ); }, diff --git a/lib/Screens/dashboard/status_dashboard.dart b/lib/Screens/dashboard/status_dashboard.dart index 3fd38dd..7e26f2d 100644 --- a/lib/Screens/dashboard/status_dashboard.dart +++ b/lib/Screens/dashboard/status_dashboard.dart @@ -480,10 +480,10 @@ class StatusDashboardState extends State { child: Text( label, style: GoogleFonts.poppins( - fontSize: 10, + fontSize: 12, color: color, // color: const Color(0xFFEAF3FB), - fontWeight: FontWeight.w700, + fontWeight: FontWeight.w500, ), ), ), diff --git a/lib/Screens/itnerary/forex.dart b/lib/Screens/itnerary/forex.dart index dc31c7c..05e1ca1 100644 --- a/lib/Screens/itnerary/forex.dart +++ b/lib/Screens/itnerary/forex.dart @@ -1530,7 +1530,8 @@ class _ForexScreenState extends State { else SizedBox(height: 8), Column( - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: + isDesktop ? CrossAxisAlignment.center : CrossAxisAlignment.start, children: [ Text( "Currency *", @@ -1552,19 +1553,24 @@ class _ForexScreenState extends State { height: 40, child: Padding( padding: const EdgeInsets.all(8.0), - child: Center( - child: Text( - // "cur", - // "${selectedCurrency}", - selectedCurrency ?? "Currency", - // selectedCurrency?.isNotEmpty == true ? selectedCurrency! : "Currency", - style: const TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: Color(0xFF575A74), - ), - ), - ), + child: + isDesktop + ? Center(child: currencyText()) + : Container(child: currencyText()), + // child: Center + // ( + // child: Text( + // // "cur", + // // "${selectedCurrency}", + // selectedCurrency ?? "Currency", + // // selectedCurrency?.isNotEmpty == true ? selectedCurrency! : "Currency", + // style: const TextStyle( + // fontSize: 12, + // fontWeight: FontWeight.w600, + // color: Color(0xFF575A74), + // ), + // ), + // ), ), ), ), @@ -1632,6 +1638,14 @@ class _ForexScreenState extends State { ]; } + Widget currencyText() => Text( + selectedCurrency ?? "Currency", + style: const TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xFF575A74), + ), + ); List _buildSecondRow(bool isDesktop) { return [ if (isDesktop) Spacer(), @@ -2344,7 +2358,8 @@ class _ForexScreenState extends State { children: [ Row( crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: isDesktop ? MainAxisAlignment.center : MainAxisAlignment.start, + mainAxisAlignment: + isDesktop ? MainAxisAlignment.center : MainAxisAlignment.start, children: [ Container( alignment: Alignment.bottomLeft, diff --git a/lib/Screens/itnerary_list/accomodation_list.dart b/lib/Screens/itnerary_list/accomodation_list.dart index f4cd400..03eb333 100644 --- a/lib/Screens/itnerary_list/accomodation_list.dart +++ b/lib/Screens/itnerary_list/accomodation_list.dart @@ -313,7 +313,7 @@ class _AccomodationListWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - mainAxisAlignment: MainAxisAlignment.end, + // mainAxisAlignment: MainAxisAlignment.end, children: [ Text( item["hotel_name"]!, @@ -388,6 +388,7 @@ class _AccomodationListWidgetState extends State { ], ) : SizedBox.shrink(), + SizedBox(height: 8), isDesktop ? Row( children: [ @@ -640,29 +641,29 @@ class _AccomodationListWidgetState extends State { ), ), SizedBox(width: 5), - Expanded(child: Text(value, style: TextStyle(fontSize: 12))), - // Expanded( - // child: - // exceedsLimit - // ? Tooltip( - // message: wrapText(value, 50), - // decoration: BoxDecoration( - // color: Colors.grey.shade200, // Black background - // borderRadius: BorderRadius.circular(6), - // ), - // textStyle: TextStyle( - // color: Colors.black, - // ), // Tooltip text color - // padding: EdgeInsets.all(8), - // preferBelow: false, - // child: Text( - // value.substring(0, limit) + "...", - // style: TextStyle(fontSize: 12), - // overflow: TextOverflow.ellipsis, - // ), - // ) - // : Text(value, style: TextStyle(fontSize: 12)), - // ), + // Expanded(child: Text(value, style: TextStyle(fontSize: 12))), + Expanded( + child: + exceedsLimit + ? Tooltip( + message: wrapText(value, 50), + decoration: BoxDecoration( + color: Colors.grey.shade200, // Black background + borderRadius: BorderRadius.circular(6), + ), + textStyle: TextStyle( + color: Colors.black, + ), // Tooltip text color + padding: EdgeInsets.all(8), + preferBelow: false, + child: Text( + value.substring(0, limit) + "...", + style: TextStyle(fontSize: 12), + overflow: TextOverflow.ellipsis, + ), + ) + : Text(value, style: TextStyle(fontSize: 12)), + ), ], ); } diff --git a/lib/Screens/itnerary_list/bus_list.dart b/lib/Screens/itnerary_list/bus_list.dart index a182b52..5b5b380 100644 --- a/lib/Screens/itnerary_list/bus_list.dart +++ b/lib/Screens/itnerary_list/bus_list.dart @@ -363,7 +363,7 @@ class _BusListWidgetState extends State { ], ) : SizedBox.shrink(), - SizedBox(height: 4), + SizedBox(height: 8), isDesktop ? Row( children: [ diff --git a/lib/Screens/itnerary_list/forex_list.dart b/lib/Screens/itnerary_list/forex_list.dart index a31e233..07ad3c1 100644 --- a/lib/Screens/itnerary_list/forex_list.dart +++ b/lib/Screens/itnerary_list/forex_list.dart @@ -319,7 +319,7 @@ class _ForexListWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - mainAxisAlignment: MainAxisAlignment.end, + // mainAxisAlignment: MainAxisAlignment.end, children: [ Text( getRequestForCountry(item["country_code"]!.toString()), @@ -344,19 +344,20 @@ class _ForexListWidgetState extends State { ), ), ), - // SizedBox(width: 10), - // GestureDetector( - // onTap: () => onDeleteForex(item), - // child: Tooltip( - // message: 'Delete Forex Details', - // child: Image.asset( - // 'assets/images/IconsImg/delete.png', - // width: 20, - // height: 15, - // color: Colors.red, - // ), - // ), - // ), + SizedBox(width: 10), + GestureDetector( + onTap: () => widget.onDeleteForex(item), + child: Tooltip( + message: 'Delete Forex Details', + child: Image.asset( + 'assets/images/IconsImg/delete.png', + width: 20, + height: 15, + color: Colors.red, + ), + ), + ), + SizedBox(width: 10), item['forex_id'] != null ? IconButton( icon: Icon( @@ -457,6 +458,7 @@ class _ForexListWidgetState extends State { ], ) : SizedBox.shrink(), + SizedBox(height: 8), isDesktop ? Row( children: [ diff --git a/lib/Screens/itnerary_list/insurance_list.dart b/lib/Screens/itnerary_list/insurance_list.dart index dd7a459..f5f9b37 100644 --- a/lib/Screens/itnerary_list/insurance_list.dart +++ b/lib/Screens/itnerary_list/insurance_list.dart @@ -324,6 +324,7 @@ class _InsuranceListWidgetState extends State { ], ) : SizedBox.shrink(), + SizedBox(height: 8), isDesktop ? Row( children: [ diff --git a/lib/Screens/itnerary_list/miscellaneous_list.dart b/lib/Screens/itnerary_list/miscellaneous_list.dart index 72261fc..50277f4 100644 --- a/lib/Screens/itnerary_list/miscellaneous_list.dart +++ b/lib/Screens/itnerary_list/miscellaneous_list.dart @@ -273,7 +273,7 @@ class _MiscellaneousListWidgetState extends State { ], ), // Divider(color: Colors.blueGrey.shade50), - // SizedBox(height: 4), + SizedBox(height: 4), isDesktop ? Row( children: [ @@ -294,6 +294,7 @@ class _MiscellaneousListWidgetState extends State { ], ) : SizedBox.shrink(), + SizedBox(height: 8), isDesktop ? Row( children: [ diff --git a/lib/Screens/itnerary_list/taxi_list.dart b/lib/Screens/itnerary_list/taxi_list.dart index 90032b4..a306df9 100644 --- a/lib/Screens/itnerary_list/taxi_list.dart +++ b/lib/Screens/itnerary_list/taxi_list.dart @@ -378,7 +378,8 @@ class _TaxiListWidgetState extends State { ], ) : SizedBox.shrink(), - SizedBox(height: 4), + SizedBox(height: 8), + isDesktop ? Row( children: [ diff --git a/lib/Screens/itnerary_list/train_list.dart b/lib/Screens/itnerary_list/train_list.dart index 6e6e5ba..5c422ee 100644 --- a/lib/Screens/itnerary_list/train_list.dart +++ b/lib/Screens/itnerary_list/train_list.dart @@ -450,7 +450,7 @@ class _TrainListWidgetState extends State { ], ) : SizedBox.shrink(), - SizedBox(height: 4), + SizedBox(height: 8), isDesktop ? Row( children: [ diff --git a/lib/Screens/itnerary_list/visa_list.dart b/lib/Screens/itnerary_list/visa_list.dart index e8b91f3..d575628 100644 --- a/lib/Screens/itnerary_list/visa_list.dart +++ b/lib/Screens/itnerary_list/visa_list.dart @@ -427,6 +427,7 @@ class _VisaListWidgetState extends State { ], ) : SizedBox.shrink(), + SizedBox(height: 8), isDesktop ? Row( children: [ diff --git a/lib/Screens/organization/themeColor.dart b/lib/Screens/organization/themeColor.dart index 524ce0f..6317ae9 100644 --- a/lib/Screens/organization/themeColor.dart +++ b/lib/Screens/organization/themeColor.dart @@ -58,6 +58,21 @@ class _ColorThemePickerWidgetState extends State { ]; final List layoutTertiaryColors = [ + Color(0xFFE5EFFF), // Very Light Blue + Color(0xFFE6FDFF), // Very Light Teal + Color(0xFFE8FDEF), // Mint Green + Color(0xFFFFE7E6), // Light Coral/Red + Color(0xFFFDE9E7), // Peach + Color(0xFFFFF5E5), // Lightest Orange + Color(0xFFECEEF8), // Very Light Rose + Color(0xFFE5FFFC), // Pastel Pink + Color(0xFFFEE6F3), // Light Lavender + Color(0xFFF9EBF3), // Soft Purple Grey + Color(0xFFF8EAFA), // Near-white Neutral + Color(0xFFF4EDF7), // Near-white Neutral + ]; + + final List layoutTertiaryColors1 = [ Color(0xFFE3F2FD), // Very Light Blue Color(0xFFE0F7FA), // Very Light Teal Color(0xFFC8E6C9), // Mint Green @@ -67,7 +82,7 @@ class _ColorThemePickerWidgetState extends State { Color(0xFFFFEBEE), // Very Light Rose Color(0xFFFCE4EC), // Pastel Pink Color(0xFFF3E5F5), // Light Lavender - Color(0xFFEDE7F6), // Soft Purple Grey + Color(0xFFF9EBF3), // Soft Purple Grey Color(0xFFF8F9FA), // Near-white Neutral ]; diff --git a/lib/Screens/plans/create_plans.dart b/lib/Screens/plans/create_plans.dart index e545f60..35b6cb5 100644 --- a/lib/Screens/plans/create_plans.dart +++ b/lib/Screens/plans/create_plans.dart @@ -446,6 +446,7 @@ class CreateNewPlansState extends State { String? _selectedIsBillable; String? selectedFuncDept; String? selectedPurpose; + bool hasUpdateVal = false; Map validationErrors = {}; @@ -563,6 +564,10 @@ class CreateNewPlansState extends State { loadInitialData(); }); + // if (widget.selectedPlanData != null) { + // hasUpdateVal = true; + // } + if (widget.approverStatus == "Approval pending") { print("Status approver - Approval Pending"); } @@ -657,6 +662,8 @@ class CreateNewPlansState extends State { planTravlrId = travellerId; _selectedOption = "Option 3"; otherUserName = travellerName; + + hasUpdateVal = true; } else if (userId.isNotEmpty && userId != "0") { print("TestplanUsrId : $userId"); print("TestplanUsrIdSelf : $selfId"); @@ -664,6 +671,7 @@ class CreateNewPlansState extends State { print("TestplanUsrId2 : $planUsrId"); _selectedOption = (selfId != userId) ? "Option 2" : "Option 1"; otherUserName = userName; + hasUpdateVal = true; } }); } @@ -2039,6 +2047,7 @@ class CreateNewPlansState extends State { } return true; }, + enabled: !hasUpdateVal, popupProps: PopupProps.menu( showSearchBox: false, // Optionally enable search fit: FlexFit.loose, @@ -3172,6 +3181,7 @@ class CreateNewPlansState extends State { {"title": "Others (Non Employee)", "value": "Option 3"}, ]; + print("isViewModeYY: ${widget.isViewMode}, hasUpdateVal: $hasUpdateVal"); return [ CustomTextFieldWrapper( // isFocused: focusStates["trip_plannedFocused"] ?? false, @@ -3198,12 +3208,14 @@ class CreateNewPlansState extends State { // Request focus when user taps focusNodes["trip_plannedFocusNode"]?.requestFocus(); }, + child: DropdownSearch( selectedItem: options.firstWhere( (opt) => opt['value'] == _selectedOption, )['title'], - enabled: !widget.isViewMode, + enabled: !hasUpdateVal, + // enabled: || !hasUpdateVal, items: options.map((opt) => opt['title']!).toList(), popupProps: PopupProps.menu( showSearchBox: false, diff --git a/lib/Screens/plans/list_plans.dart b/lib/Screens/plans/list_plans.dart index 6f930ae..f537169 100644 --- a/lib/Screens/plans/list_plans.dart +++ b/lib/Screens/plans/list_plans.dart @@ -679,165 +679,171 @@ class _ListPlansState extends State { // thickness: 0.2, // how "thick" the line is // color: Colors.grey, // optional // ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Text( - 'My Trips', - style: GoogleFonts.poppins( - fontSize: isDesktop ? 16 : 14, - fontWeight: FontWeight.w600, - color: Colors.black, - ), - // style: TextStyle( - // fontFamily: "Inter", - // fontSize: isDesktop ? 16 : 14, - // fontWeight: FontWeight.w600, - // color: Color(0xFF212121)) - ), - ], - ), - - // Spacer(), - SizedBox(width: MediaQuery.of(context).size.width * 0.23), - if (isDesktop) - Container( - width: MediaQuery.of(context).size.width * 0.2, - height: 40, - child: TextField( - controller: searchController, - onChanged: filterPlans, - decoration: InputDecoration( - hintText: "Search...", - hintStyle: TextStyle( - fontSize: 12, - color: Color(0xFF9E9DBD), - ), - prefixIcon: Icon( - Icons.search, - color: Color(0xFF9E9DBD), - size: 18, - ), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(12), - ), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(12), - borderSide: BorderSide( - color: Colors.grey.shade200, - width: 0.5, - ), - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(12), - borderSide: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - ), - ), - style: GoogleFonts.poppins(fontSize: 12), - ), - ), - - // SizedBox(width: 16), - if (isDesktop) Spacer(), - - // ElevatedButton( - // style: ElevatedButton.styleFrom( - // foregroundColor: Colors.white, - // backgroundColor: Colors.blueAccent, - // ), - // onPressed: () { - // context.go('/createPlan', extra: { - // 'orgId': orgId, - // }); - // if (!isDesktop) Navigator.pop(context); - // }, - // child: Row( - // children: [ - // Icon(Icons.add_circle, color: Colors.white), - // SizedBox(width: 5), - // Text('NewPlan'), - // - // ], - // ), - // ), - ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: Color(0xFF114D8B), - foregroundColor: Colors.white, - disabledBackgroundColor: Color(0xFF114D8B), - disabledForegroundColor: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - side: BorderSide(color: Color(0xFF114D8B), width: 2), - ), - padding: - isDesktop - ? EdgeInsets.symmetric( - horizontal: 20, - vertical: 12, - ) - : EdgeInsets.symmetric( - horizontal: 15, - vertical: 10, - ), - ), - onPressed: () { - if (TripPlanAction == "Plan Creation Not Allowed") { - showDialog( - context: context, - builder: - (context) => AlertDialog( - title: Text( - "Action Not Allowed", - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - content: Text( - "Plan Creation Not Allowed For This User.", - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(context), - child: Text( - "OK", - style: TextStyle(color: layoutColor), - ), - ), - ], - ), - ); - } else { - context.go('/createPlan', extra: {'orgId': orgId}); - if (!isDesktop) Navigator.pop(context); - } - }, - child: Row( - mainAxisSize: - MainAxisSize.min, // Ensures content fits nicely + Padding( + padding: + isDesktop + ? const EdgeInsets.all(8.0) + : const EdgeInsets.symmetric(horizontal: 14.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( children: [ Text( - "Add New Trip", + 'My Trips', style: GoogleFonts.poppins( - fontSize: isDesktop ? 13 : 11, + fontSize: isDesktop ? 16 : 14, + fontWeight: FontWeight.w600, + color: Colors.black, ), - ), - SizedBox(width: 8), // spacing between icon and text - Icon( - Icons.add_circle_outline_rounded, - size: 15, - color: Colors.white, + // style: TextStyle( + // fontFamily: "Inter", + // fontSize: isDesktop ? 16 : 14, + // fontWeight: FontWeight.w600, + // color: Color(0xFF212121)) ), ], ), - ), - ], + + // Spacer(), + SizedBox(width: MediaQuery.of(context).size.width * 0.23), + if (isDesktop) + Container( + width: MediaQuery.of(context).size.width * 0.2, + height: 40, + child: TextField( + controller: searchController, + onChanged: filterPlans, + decoration: InputDecoration( + hintText: "Search...", + hintStyle: TextStyle( + fontSize: 12, + color: Color(0xFF9E9DBD), + ), + prefixIcon: Icon( + Icons.search, + color: Color(0xFF9E9DBD), + size: 18, + ), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(12), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(12), + borderSide: BorderSide( + color: Colors.grey.shade200, + width: 0.5, + ), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(12), + borderSide: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + ), + ), + style: GoogleFonts.poppins(fontSize: 12), + ), + ), + + // SizedBox(width: 16), + if (isDesktop) Spacer(), + + // ElevatedButton( + // style: ElevatedButton.styleFrom( + // foregroundColor: Colors.white, + // backgroundColor: Colors.blueAccent, + // ), + // onPressed: () { + // context.go('/createPlan', extra: { + // 'orgId': orgId, + // }); + // if (!isDesktop) Navigator.pop(context); + // }, + // child: Row( + // children: [ + // Icon(Icons.add_circle, color: Colors.white), + // SizedBox(width: 5), + // Text('NewPlan'), + // + // ], + // ), + // ), + ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: Color(0xFF114D8B), + foregroundColor: Colors.white, + disabledBackgroundColor: Color(0xFF114D8B), + disabledForegroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + side: BorderSide(color: Color(0xFF114D8B), width: 2), + ), + padding: + isDesktop + ? EdgeInsets.symmetric( + horizontal: 20, + vertical: 12, + ) + : EdgeInsets.symmetric( + horizontal: 15, + vertical: 10, + ), + ), + onPressed: () { + if (TripPlanAction == "Plan Creation Not Allowed") { + showDialog( + context: context, + builder: + (context) => AlertDialog( + title: Text( + "Action Not Allowed", + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + ), + ), + content: Text( + "Plan Creation Not Allowed For This User.", + ), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: Text( + "OK", + style: TextStyle(color: layoutColor), + ), + ), + ], + ), + ); + } else { + context.go('/createPlan', extra: {'orgId': orgId}); + if (!isDesktop) Navigator.pop(context); + } + }, + child: Row( + mainAxisSize: + MainAxisSize.min, // Ensures content fits nicely + children: [ + Text( + "Add New Trip", + style: GoogleFonts.poppins( + fontSize: isDesktop ? 13 : 11, + ), + ), + SizedBox(width: 8), // spacing between icon and text + Icon( + Icons.add_circle_outline_rounded, + size: 15, + color: Colors.white, + ), + ], + ), + ), + ], + ), ), if (!isDesktop) const SizedBox(height: 10), if (!isDesktop) @@ -1316,7 +1322,7 @@ class _ListPlansState extends State { context, ); apiService - .getPdfDownload( + .getForexPdfDownload( plan.forexId, ); }, @@ -1633,7 +1639,7 @@ class _ListPlansState extends State { context, ); apiService - .getPdfDownload( + .getForexPdfDownload( plan.forexId, ); }, diff --git a/lib/Screens/policy/policy.dart b/lib/Screens/policy/policy.dart index bfff630..ca3524d 100644 --- a/lib/Screens/policy/policy.dart +++ b/lib/Screens/policy/policy.dart @@ -40,7 +40,7 @@ class Policy extends StatefulWidget { class _PolicyState extends State { final GlobalKey policyCriteriaKey = - GlobalKey(); + GlobalKey(); final ApiService apiService = ApiService(); @@ -86,23 +86,22 @@ class _PolicyState extends State { Map get policyData { List> policyDetails = - policy_details!.where((service) { - // Only check these specific fields for emptiness - final fieldsToCheck = [ - 'cost', - 'class', - 'a1_action', - 'a2_action', - 'a3_action', - ]; - - // If any of the important fields has a value, keep it - return fieldsToCheck.any((field) { - final value = service[field]; - return value != null && value.toString().trim().isNotEmpty; - }); - }).toList(); + policy_details!.where((service) { + // Only check these specific fields for emptiness + final fieldsToCheck = [ + 'cost', + 'class', + 'a1_action', + 'a2_action', + 'a3_action', + ]; + // If any of the important fields has a value, keep it + return fieldsToCheck.any((field) { + final value = service[field]; + return value != null && value.toString().trim().isNotEmpty; + }); + }).toList(); Map data = { "name": _policyController.text, @@ -155,6 +154,7 @@ class _PolicyState extends State { // } // }); } + void _addFocusListener(FocusNode node, Function(bool) updateState) { node.addListener(() { setState(() { @@ -162,6 +162,7 @@ class _PolicyState extends State { }); }); } + void _checkAuthAndLoadData() async { final String? token = await getToken(); // Your async function to get token @@ -181,9 +182,6 @@ class _PolicyState extends State { loadInitialData(); - - - WidgetsBinding.instance.addPostFrameCallback((_) { if (widget.policy != null) { final details = List>.from( @@ -193,7 +191,6 @@ class _PolicyState extends State { } }); - // if (widget.policy != null) { // print("185"); // final details = List>.from( @@ -214,14 +211,14 @@ class _PolicyState extends State { setState(() { layoutColor = - layoutString != null - ? Color(int.parse(layoutString)) - : Colors.redAccent; + layoutString != null + ? Color(int.parse(layoutString)) + : Colors.redAccent; bodyColor = - bodyStringColor != null - ? Color(int.parse(bodyStringColor)) - : Colors.white; + bodyStringColor != null + ? Color(int.parse(bodyStringColor)) + : Colors.white; }); } @@ -253,9 +250,9 @@ class _PolicyState extends State { try { List decoded = json.decode(rawServices); List> formatted = - decoded - .map((e) => {"service_id": e['service_id'].toString()}) - .toList(); + decoded + .map((e) => {"service_id": e['service_id'].toString()}) + .toList(); setState(() { selectedOrgServiceIds = formatted; @@ -281,7 +278,7 @@ class _PolicyState extends State { await loadOrgSelectedAlServices(); print("III-end"); final selectedIds = - selectedOrgServiceIds.map((e) => e['service_id']).toSet(); + selectedOrgServiceIds.map((e) => e['service_id']).toSet(); if (widget.policy != null) { print("inside if"); @@ -301,42 +298,41 @@ class _PolicyState extends State { print("exisitingService ${exisitingService}"); final filtered = - exisitingService! - .where( - (service) => - selectedIds.contains(service['service_id'].toString()), - ) - .toList(); + exisitingService! + .where( + (service) => + selectedIds.contains(service['service_id'].toString()), + ) + .toList(); setState(() { ServicesChoosed = filtered; }); print("298 ServicesChoosed ${ServicesChoosed}"); - - if (ServicesChoosed!.isNotEmpty) { print("Filtered Selected Services ChooesedIpfa1: $ServicesChoosed"); - ServicesChoosed!.sort( - (a, b) => (a['order'] ?? 0).compareTo(b['order'] ?? 0), + (a, b) => (a['order'] ?? 0).compareTo(b['order'] ?? 0), ); String firstServiceName = ServicesChoosed?.first['name']; String firstServiceId = ServicesChoosed?.first['service_id']; - print("✅ 306 First service name selected for filter: $firstServiceName - $firstServiceId"); + print( + "✅ 306 First service name selected for filter: $firstServiceName - $firstServiceId", + ); selectedService = firstServiceName; if (selectedServiceDBValue.value == "0") { setState(() { selectedServiceDBValue.value = firstServiceId.toString(); }); } - List serviceDBvalue = ServicesChoosed! - .map((item) => int.parse(item['service_id'].toString())) - .toList(); + List serviceDBvalue = + ServicesChoosed! + .map((item) => int.parse(item['service_id'].toString())) + .toList(); serviceDBValueList = serviceDBvalue; - } print(widget.policy); // updateData(); @@ -348,30 +344,26 @@ class _PolicyState extends State { List>.from(decoded) .map( (service) => { - 'service_id': service['service_id'].toString(), - 'name': service['name'].toString(), - 'order': service['order'].toString(), - }, - ) + 'service_id': service['service_id'].toString(), + 'name': service['name'].toString(), + 'order': service['order'].toString(), + }, + ) .toList(); }); print("✅ Loaded services from policy (decoded): $services"); - - } print("Filtered Selected Services Added to Policy: $ServicesChoosed"); - - } - else { + } else { final filtered = - selectedAllServices! - .where( - (service) => - selectedIds.contains(service['service_id'].toString()), - ) - .toList(); + selectedAllServices! + .where( + (service) => + selectedIds.contains(service['service_id'].toString()), + ) + .toList(); print("ServicesChoosedYY: $ServicesChoosed"); setState(() { @@ -386,12 +378,12 @@ class _PolicyState extends State { ServicesChoosed! .map( (service) => { - 'service_id': service['service_id'].toString(), - 'name': - service['name'].toString(), // ✅ no space before 'name' - 'order': service['order'].toString(), - }, - ) + 'service_id': service['service_id'].toString(), + 'name': + service['name'].toString(), // ✅ no space before 'name' + 'order': service['order'].toString(), + }, + ) .toList(); }); @@ -400,11 +392,13 @@ class _PolicyState extends State { if (ServicesChoosed!.isNotEmpty) { policyCriteriaKey.currentState?.fetchTrainFlightClass(); ServicesChoosed!.sort( - (a, b) => (a['order'] ?? 0).compareTo(b['order'] ?? 0), + (a, b) => (a['order'] ?? 0).compareTo(b['order'] ?? 0), ); String firstServiceName = ServicesChoosed?.first['name']; String firstServiceId = ServicesChoosed?.first['service_id']; - print("✅ 363 First service name selected for filter: $firstServiceName - $firstServiceId"); + print( + "✅ 363 First service name selected for filter: $firstServiceName - $firstServiceId", + ); selectedService = firstServiceName; if (selectedServiceDBValue.value == "0") { setState(() { @@ -412,12 +406,11 @@ class _PolicyState extends State { }); } - List serviceDBvalue = ServicesChoosed! - .map((item) => int.parse(item['service_id'].toString())) - .toList(); + List serviceDBvalue = + ServicesChoosed! + .map((item) => int.parse(item['service_id'].toString())) + .toList(); serviceDBValueList = serviceDBvalue; - - } } } @@ -525,7 +518,6 @@ class _PolicyState extends State { }); } - bool isValidData(Map data) { errorMessages.clear(); // Reset previous errors @@ -544,7 +536,7 @@ class _PolicyState extends State { if (domestic != "1" && international != "1") { errorMessages["trip_type"] = - "Required"; // "Please select Domestic or International."; + "Required"; // "Please select Domestic or International."; } // Validate at least one policy_detail with valid content @@ -566,7 +558,7 @@ class _PolicyState extends State { if (!hasAtLeastOneDetail) { errorMessages["policy_details"] = - "Required"; // "At least one valid policy detail is required."; + "Required"; // "At least one valid policy detail is required."; } return errorMessages.isEmpty; @@ -635,16 +627,16 @@ class _PolicyState extends State { drawer: CustomDrawer(isDesktop: false), body: Padding( padding: - isDesktop - ? EdgeInsets.symmetric( - horizontal: - MediaQuery.of(context).size.width * - 0.1, // 30% of screen width as horizontal padding - vertical: - MediaQuery.of(context).size.height * - 0, // 5% of screen height as vertical padding - ) - : EdgeInsets.all(8), + isDesktop + ? EdgeInsets.symmetric( + horizontal: + MediaQuery.of(context).size.width * + 0.1, // 30% of screen width as horizontal padding + vertical: + MediaQuery.of(context).size.height * + 0, // 5% of screen height as vertical padding + ) + : EdgeInsets.all(8), child: Column( children: [ Expanded( @@ -730,15 +722,15 @@ class _PolicyState extends State { color: Colors.white, padding: const EdgeInsets.all(8.0), child: - isDesktop - ? Row( - mainAxisAlignment: MainAxisAlignment.end, - children: _buildSubmit(isDesktop), - ) - : Row( - mainAxisAlignment: MainAxisAlignment.center, - children: _buildSubmit(isDesktop), - ), + isDesktop + ? Row( + mainAxisAlignment: MainAxisAlignment.end, + children: _buildSubmit(isDesktop), + ) + : Row( + mainAxisAlignment: MainAxisAlignment.center, + children: _buildSubmit(isDesktop), + ), ), ], ), @@ -751,9 +743,9 @@ class _PolicyState extends State { // ? EdgeInsets.all(10.0) // : EdgeInsets.only(left: 20.0, bottom: 20.0, top: 10.0, right: 20.0), height: - isDesktop - ? MediaQuery.of(context).size.height * 0.98 - : MediaQuery.of(context).size.height, + isDesktop + ? MediaQuery.of(context).size.height * 0.98 + : MediaQuery.of(context).size.height, // decoration: BoxDecoration( // border: isDesktop // ? Border.all( @@ -802,23 +794,23 @@ class _PolicyState extends State { Container( padding: isDesktop ? const EdgeInsets.only(left: 35) : null, child: - isDesktop - ? Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded(child: _buildPolicyNameField(isDesktop)), - Spacer(), - Expanded(child: _buildPolicyTypeField(isDesktop)), - ], - ) - : Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildPolicyNameField(isDesktop), - SizedBox(height: 20), - _buildPolicyTypeField(isDesktop), - ], - ), + isDesktop + ? Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded(child: _buildPolicyNameField(isDesktop)), + Spacer(), + Expanded(child: _buildPolicyTypeField(isDesktop)), + ], + ) + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildPolicyNameField(isDesktop), + SizedBox(height: 20), + _buildPolicyTypeField(isDesktop), + ], + ), ), SizedBox(height: 10), Divider(thickness: 0.1, color: Colors.grey), @@ -831,66 +823,66 @@ class _PolicyState extends State { ], isDesktop ? Padding( - padding: const EdgeInsets.only(left: 30.0, right: 98.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "Approval Criteria", - style: GoogleFonts.poppins( - fontSize: 12, - fontWeight: FontWeight.w600, - color: Color(0xFF575A74), - ), + padding: const EdgeInsets.only(left: 30.0, right: 98.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Approval Criteria", + style: GoogleFonts.poppins( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xFF575A74), + ), + ), + Text( + "Service Priority", + style: GoogleFonts.poppins( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xFF575A74), + ), + ), + ], ), - Text( - "Service Priority", - style: GoogleFonts.poppins( - fontSize: 12, - fontWeight: FontWeight.w600, - color: Color(0xFF575A74), - ), - ), - ], - ), - ) + ) : SizedBox.shrink(), isDesktop ? Container( - // color: Colors.yellow.shade50, - height: MediaQuery.of(context).size.height * 0.54, - child: SingleChildScrollView( - scrollDirection: Axis.vertical, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( + // color: Colors.yellow.shade50, + height: MediaQuery.of(context).size.height * 0.56, + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - _buildPolicyOrdering(isDesktop), - _buildPolicyCategory(isDesktop), + Column( + children: [ + _buildPolicyOrdering(isDesktop), + _buildPolicyCategory(isDesktop), + ], + ), + Column(children: [_buildPolicyCategoryList(isDesktop)]), ], ), - Column(children: [_buildPolicyCategoryList(isDesktop)]), - ], - ), - ), - ) + ), + ) : Expanded( - child: Container( - child: SingleChildScrollView( - scrollDirection: Axis.vertical, - child: Column( - children: [ - _buildPolicyCategoryList(isDesktop), - _buildPolicyOrdering(isDesktop), - _buildPolicyCategory(isDesktop), - ], + child: Container( + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Column( + children: [ + _buildPolicyCategoryList(isDesktop), + _buildPolicyOrdering(isDesktop), + _buildPolicyCategory(isDesktop), + ], + ), + ), ), ), - ), - ), // isDesktop // ? Expanded( // child: Row( @@ -1004,28 +996,28 @@ class _PolicyState extends State { border: Border.all(color: Colors.blueGrey.shade100, width: 0.35), ), child: - isDesktop - ? Padding( - padding: const EdgeInsets.all(10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - children: [_buildPolicySubCategoryList(isDesktop)], - ), - ) - : Column( - children: [ - Container( - // color: Colors.amber, - child: _buildPolicySubCategoryList(isDesktop), - // child: Text("FAta"), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.start, - // children: [_buildPolicySubCategoryList(isDesktop)], - // ), - ), - ], - ), + isDesktop + ? Padding( + padding: const EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [_buildPolicySubCategoryList(isDesktop)], + ), + ) + : Column( + children: [ + Container( + // color: Colors.amber, + child: _buildPolicySubCategoryList(isDesktop), + // child: Text("FAta"), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.start, + // children: [_buildPolicySubCategoryList(isDesktop)], + // ), + ), + ], + ), ); } @@ -1182,21 +1174,21 @@ class _PolicyState extends State { width: isDesktop ? MediaQuery.of(context).size.width * 0.62 : null, // width: isDesktop ? MediaQuery.of(context).size.width * 0.75 : null, child: - isDesktop - ? Container( - // color: Colors.amber, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [_buildPolicyServiceOrdering(isDesktop)], - ), - ) - : Container( - // color: Colors.amber, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [_buildPolicyServiceOrdering(isDesktop)], - ), - ), + isDesktop + ? Container( + // color: Colors.amber, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [_buildPolicyServiceOrdering(isDesktop)], + ), + ) + : Container( + // color: Colors.amber, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [_buildPolicyServiceOrdering(isDesktop)], + ), + ), ); } @@ -1207,18 +1199,18 @@ class _PolicyState extends State { // Sort services by 'order' ServicesChoosed!.sort( - (a, b) => (a['order'] ?? 0).compareTo(b['order'] ?? 0), + (a, b) => (a['order'] ?? 0).compareTo(b['order'] ?? 0), ); List services = - ServicesChoosed!.map((service) => service['name'].toString()).toList(); + ServicesChoosed!.map((service) => service['name'].toString()).toList(); // List serviceDBvalue = // ServicesChoosed!.map((service) => int.parse(service['service_id'].toString())).toList(); - List serviceDBvalue = ServicesChoosed! - .map((item) => int.parse(item['service_id'].toString())) - .toList(); - + List serviceDBvalue = + ServicesChoosed! + .map((item) => int.parse(item['service_id'].toString())) + .toList(); print("1093"); print(services); @@ -1230,109 +1222,111 @@ class _PolicyState extends State { child: Flex( direction: Axis.horizontal, children: - services.asMap().entries.map((entry) { - print("1182 ${entry}"); - int i = entry.key; - int index = i + 1; - String service = entry.value; - int serviceId = serviceDBvalue[i]; + services.asMap().entries.map((entry) { + print("1182 ${entry}"); + int i = entry.key; + int index = i + 1; + String service = entry.value; + int serviceId = serviceDBvalue[i]; - bool isSelected = - selectedServiceIndex.value == index.toString(); + bool isSelected = + selectedServiceIndex.value == index.toString(); - return SizedBox( - // width: isDesktop ? 40 : null, - height: - isDesktop - ? max( - (MediaQuery.of(context).size.height * 0.075), - 10, - ) - : 45, + return SizedBox( + // width: isDesktop ? 40 : null, + height: + isDesktop + ? max( + (MediaQuery.of(context).size.height * 0.075), + 10, + ) + : 45, - // max((MediaQuery.of(context).size.height * 0.09), 10) - child: GestureDetector( - onTap: () { - print("1201 Selected Services - $service - Tab Index - $index Service Id- $serviceId"); - setState(() { - selectedServiceIndex.value = index.toString(); - selectedServiceDBValue.value = serviceId.toString(); - selectedService = service; + // max((MediaQuery.of(context).size.height * 0.09), 10) + child: GestureDetector( + onTap: () { + print( + "1201 Selected Services - $service - Tab Index - $index Service Id- $serviceId", + ); + setState(() { + selectedServiceIndex.value = index.toString(); + selectedServiceDBValue.value = serviceId.toString(); + selectedService = service; - print( - " selectedServiceIndex.value - ${selectedServiceIndex.value}", - ); + print( + " selectedServiceIndex.value - ${selectedServiceIndex.value}", + ); - - // policyCriteriaKey.currentState?.fieldForPolicy(); - // policyCriteriaKey.currentState - // ?.addOrUpdatePolicy(selectedServiceIndex.value); - print("policyselectedService - $selectedService"); - if (selectedService == "Flight" || - selectedService == "Train" || selectedService == "Accomodation") { - showClass = true; - showCost = false; - // int serviceCode = selectedService == "Flight" ? 1 : 2; - print("policyselectedService1 - $selectedService"); - policyCriteriaKey.currentState - ?.fetchTrainFlightClass(); - } - // else if (selectedService == "Accommodation") { - // showClass = true; - // showCost = false; - // } - else { - showClass = false; - showCost = false; - } - }); - }, - child: Container( - margin: const EdgeInsets.all(5), - padding: - isDesktop - ? const EdgeInsets.all(8) - : const EdgeInsets.symmetric( - horizontal: 8, - vertical: 3, - ), - alignment: Alignment.center, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - service, - style: GoogleFonts.poppins( - color: - isSelected - ? const Color(0xFF114D8B) - : Colors.black87, - fontSize: 13, - fontWeight: - isSelected - ? FontWeight.bold - : FontWeight.w500, - decoration: - TextDecoration - .none, // remove built-in underline - ), + // policyCriteriaKey.currentState?.fieldForPolicy(); + // policyCriteriaKey.currentState + // ?.addOrUpdatePolicy(selectedServiceIndex.value); + print("policyselectedService - $selectedService"); + if (selectedService == "Flight" || + selectedService == "Train" || + selectedService == "Accomodation") { + showClass = true; + showCost = false; + // int serviceCode = selectedService == "Flight" ? 1 : 2; + print("policyselectedService1 - $selectedService"); + policyCriteriaKey.currentState + ?.fetchTrainFlightClass(); + } + // else if (selectedService == "Accommodation") { + // showClass = true; + // showCost = false; + // } + else { + showClass = false; + showCost = false; + } + }); + }, + child: Container( + margin: const EdgeInsets.all(5), + padding: + isDesktop + ? const EdgeInsets.all(8) + : const EdgeInsets.symmetric( + horizontal: 8, + vertical: 3, + ), + alignment: Alignment.center, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + service, + style: GoogleFonts.poppins( + color: + isSelected + ? const Color(0xFF114D8B) + : Colors.black87, + fontSize: 13, + fontWeight: + isSelected + ? FontWeight.bold + : FontWeight.w500, + decoration: + TextDecoration + .none, // remove built-in underline + ), + ), + if (isSelected) + const SizedBox( + height: 1, + ), // spacing between text and underline + if (isSelected) + Container( + height: 2, + width: 30, // or based on text width + color: const Color(0xFF114D8B), + ), + ], ), - if (isSelected) - const SizedBox( - height: 1, - ), // spacing between text and underline - if (isSelected) - Container( - height: 2, - width: 30, // or based on text width - color: const Color(0xFF114D8B), - ), - ], + ), ), - ), - ), - ); - }).toList(), + ); + }).toList(), ), ), ); @@ -1356,7 +1350,7 @@ class _PolicyState extends State { } List services = - ServicesChoosed!.map((service) => service['name'].toString()).toList(); + ServicesChoosed!.map((service) => service['name'].toString()).toList(); return Expanded( child: SingleChildScrollView( @@ -1364,88 +1358,88 @@ class _PolicyState extends State { child: Flex( direction: isDesktop ? Axis.vertical : Axis.horizontal, children: - services.asMap().entries.map((entry) { - int index = entry.key + 1; - String service = entry.value; - bool isSelected = - selectedServiceIndex.value == index.toString(); + services.asMap().entries.map((entry) { + int index = entry.key + 1; + String service = entry.value; + bool isSelected = + selectedServiceIndex.value == index.toString(); - return SizedBox( - width: isDesktop ? 180 : null, - height: - isDesktop - ? max( - (MediaQuery.of(context).size.height * 0.075), - 10, - ) - : 45, + return SizedBox( + width: isDesktop ? 180 : null, + height: + isDesktop + ? max( + (MediaQuery.of(context).size.height * 0.075), + 10, + ) + : 45, - // max((MediaQuery.of(context).size.height * 0.09), 10) - child: GestureDetector( - onTap: () { - print("Selected Services - $service - $index"); - setState(() { - // selectedServiceIndex.value = index.toString(); - // selectedService = service; - // - // if (selectedService == "Flight" || - // selectedService == "Train") { - // showClass = true; - // showCost = true; - // int serviceCode = selectedService == "Flight" ? 1 : 2; - // policyCriteriaKey.currentState?.fetchTrainFlightClass(); - // } else if (selectedService == "Accommodation") { - // showClass = true; - // showCost = false; - // } else { - // showClass = false; - // showCost = false; - // } - }); - }, - child: Container( - margin: EdgeInsets.all(5), - padding: - isDesktop - ? EdgeInsets.all(8) - : EdgeInsets.only( - top: 3, - bottom: 3, - left: 8, - right: 8, - ), - decoration: BoxDecoration( - // color: Colors.blue, - color: isSelected ? Color(0xFF114D8B) : Colors.white, - // : Color(0xFFEBEBF7), - borderRadius: BorderRadius.circular(8), - border: Border.all( - color: Colors.white, // Light grey border - width: 1, - ), - boxShadow: [ - BoxShadow( - color: Colors.grey.withAlpha(90), // Shadow color - blurRadius: 1, // Blur radius - spreadRadius: 1, // Spread radius - offset: Offset(0, 1), // Shadow position + // max((MediaQuery.of(context).size.height * 0.09), 10) + child: GestureDetector( + onTap: () { + print("Selected Services - $service - $index"); + setState(() { + // selectedServiceIndex.value = index.toString(); + // selectedService = service; + // + // if (selectedService == "Flight" || + // selectedService == "Train") { + // showClass = true; + // showCost = true; + // int serviceCode = selectedService == "Flight" ? 1 : 2; + // policyCriteriaKey.currentState?.fetchTrainFlightClass(); + // } else if (selectedService == "Accommodation") { + // showClass = true; + // showCost = false; + // } else { + // showClass = false; + // showCost = false; + // } + }); + }, + child: Container( + margin: EdgeInsets.all(5), + padding: + isDesktop + ? EdgeInsets.all(8) + : EdgeInsets.only( + top: 3, + bottom: 3, + left: 8, + right: 8, + ), + decoration: BoxDecoration( + // color: Colors.blue, + color: isSelected ? Color(0xFF114D8B) : Colors.white, + // : Color(0xFFEBEBF7), + borderRadius: BorderRadius.circular(8), + border: Border.all( + color: Colors.white, // Light grey border + width: 1, + ), + boxShadow: [ + BoxShadow( + color: Colors.grey.withAlpha(90), // Shadow color + blurRadius: 1, // Blur radius + spreadRadius: 1, // Spread radius + offset: Offset(0, 1), // Shadow position + ), + ], + ), + alignment: Alignment.center, + child: Text( + service, + style: GoogleFonts.poppins( + color: isSelected ? Colors.white : Colors.black87, + fontSize: 13, + fontWeight: + isSelected ? FontWeight.bold : FontWeight.w100, + ), ), - ], - ), - alignment: Alignment.center, - child: Text( - service, - style: GoogleFonts.poppins( - color: isSelected ? Colors.white : Colors.black87, - fontSize: 13, - fontWeight: - isSelected ? FontWeight.bold : FontWeight.w100, ), ), - ), - ), - ); - }).toList(), + ); + }).toList(), ), ), ); @@ -1460,28 +1454,31 @@ class _PolicyState extends State { // color: Colors.brown.shade100, // child: Text("data"), // color: Colors.white60, - child: (selectedService != null && selectedServiceDBValue.value != "0") - ? PolicyCriteria( - key: policyCriteriaKey, - isDesktop: isDesktop, - isClass: showClass, - isCost: showCost, - selectedTabNotifier: selectedServiceIndex, - selectedIdNotifier: selectedServiceDBValue, - selectedService: selectedService!, - serviceDBValueList: serviceDBValueList, // 👈 Pass the array here - userId: userId, - onPolicyDataChanged: (List>? policyData) { - print("🟢 policyData received from child: $policyData"); + child: + (selectedService != null && selectedServiceDBValue.value != "0") + ? PolicyCriteria( + key: policyCriteriaKey, + isDesktop: isDesktop, + isClass: showClass, + isCost: showCost, + selectedTabNotifier: selectedServiceIndex, + selectedIdNotifier: selectedServiceDBValue, + selectedService: selectedService!, + serviceDBValueList: + serviceDBValueList, // 👈 Pass the array here + userId: userId, + onPolicyDataChanged: (List>? policyData) { + print("🟢 policyData received from child: $policyData"); - WidgetsBinding.instance.addPostFrameCallback((_) { - setState(() { - policy_details = policyData; - _clearError("policy_details"); - }); - }); - }, - ) : const Center(child: CircularProgressIndicator()), + WidgetsBinding.instance.addPostFrameCallback((_) { + setState(() { + policy_details = policyData; + _clearError("policy_details"); + }); + }); + }, + ) + : const Center(child: CircularProgressIndicator()), ); } @@ -1528,14 +1525,14 @@ class _PolicyState extends State { borderRadius: BorderRadius.circular(4), // Rounded rectangle border: Border.all( color: - _selectedTripType == "1" ? Colors.green : Colors.black, + _selectedTripType == "1" ? Colors.green : Colors.black, width: _selectedTripType == "1" ? 2 : 1, ), ), child: - _selectedTripType == "1" - ? Icon(Icons.rectangle, size: 8, color: Colors.green) - : null, // Add checkmark if selected + _selectedTripType == "1" + ? Icon(Icons.rectangle, size: 8, color: Colors.green) + : null, // Add checkmark if selected ), ), ], @@ -1584,14 +1581,14 @@ class _PolicyState extends State { borderRadius: BorderRadius.circular(4), // Rounded rectangle border: Border.all( color: - _selectedTripType == "2" ? Colors.green : Colors.black, + _selectedTripType == "2" ? Colors.green : Colors.black, width: _selectedTripType == "2" ? 2 : 1, ), ), child: - _selectedTripType == "2" - ? Icon(Icons.rectangle, size: 8, color: Colors.green) - : null, // Add checkmark if selected + _selectedTripType == "2" + ? Icon(Icons.rectangle, size: 8, color: Colors.green) + : null, // Add checkmark if selected ), ), ], @@ -1636,17 +1633,17 @@ class _PolicyState extends State { SizedBox(width: 20), MouseRegion( cursor: - isViewMode - ? SystemMouseCursors.forbidden - : SystemMouseCursors.click, + isViewMode + ? SystemMouseCursors.forbidden + : SystemMouseCursors.click, child: ElevatedButton( style: ElevatedButton.styleFrom( backgroundColor: - isViewMode ? layoutColor : layoutColor, // Keep original color + isViewMode ? layoutColor : layoutColor, // Keep original color foregroundColor: - isViewMode ? Colors.white : Colors.white, // Keep original color + isViewMode ? Colors.white : Colors.white, // Keep original color disabledBackgroundColor: - layoutColor, // Ensure color remains when disabled + layoutColor, // Ensure color remains when disabled disabledForegroundColor: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), @@ -1655,8 +1652,8 @@ class _PolicyState extends State { padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12), ), onPressed: - // isViewMode ? null : handleSubmit, // Disable when in view mode - isViewMode || isDisable ? null : handleSubmit, + // isViewMode ? null : handleSubmit, // Disable when in view mode + isViewMode || isDisable ? null : handleSubmit, child: Text("Submit", style: GoogleFonts.poppins(fontSize: 10)), ), ), @@ -1728,4 +1725,4 @@ class _PolicyState extends State { ), ]; } -} \ No newline at end of file +} diff --git a/lib/Screens/policy/policyCriteria.dart b/lib/Screens/policy/policyCriteria.dart index 8bec508..440eb43 100644 --- a/lib/Screens/policy/policyCriteria.dart +++ b/lib/Screens/policy/policyCriteria.dart @@ -40,7 +40,7 @@ class PolicyCriteria extends StatefulWidget { } class PolicyCriteriaState extends State { - String? ServiceId;// = "1"; + String? ServiceId; // = "1"; String? ServiceIndxId = "1"; String? orgId; @@ -103,7 +103,6 @@ class PolicyCriteriaState extends State { @override void initState() { - super.initState(); fetchTrainFlightClass(); @@ -156,7 +155,7 @@ class PolicyCriteriaState extends State { // Step 2: Collect existing service_ids from policyData final existingServiceIds = - policyData?.map((e) => e['service_id'].toString()).toSet(); + policyData?.map((e) => e['service_id'].toString()).toSet(); // Step 3: Loop through all service definitions for (var service in services) { @@ -200,7 +199,7 @@ class PolicyCriteriaState extends State { "a3_exceptional_action": ThirdExceptionalApproverAction[id], "a4_exceptional_action": FourthExceptionalApproverAction[id], "exceptional_parallel_process_from": - SelectedParallelExceptionalProcess[id], + SelectedParallelExceptionalProcess[id], "a1_amendment_action": FirstAmendApproverAction[id], "a2_amendment_action": SecondAmendApproverAction[id], "a3_amendment_action": ThirdAmendApproverAction[id], @@ -216,7 +215,6 @@ class PolicyCriteriaState extends State { // To set the data (update) void loadPolicyDetails(List> details) { - print("loadPolicyDetails"); for (var item in details) { final serviceId = item['service_id'].toString(); @@ -284,7 +282,7 @@ class PolicyCriteriaState extends State { print("addOrUpdatePolicyserviceId - $serviceId"); // 1. First, find existing item if any final existingIndex = policyData!.indexWhere( - (item) => item["service_id"] == serviceId, + (item) => item["service_id"] == serviceId, ); print(FirstApproverAction); @@ -302,13 +300,13 @@ class PolicyCriteriaState extends State { "a3_exceptional_action": ThirdExceptionalApproverAction[serviceId], "a4_exceptional_action": FourthExceptionalApproverAction[serviceId], "exceptional_parallel_process_from": - SelectedParallelExceptionalProcess[serviceId], + SelectedParallelExceptionalProcess[serviceId], "a1_amendment_action": FirstAmendApproverAction[serviceId], "a2_amendment_action": SecondAmendApproverAction[serviceId], "a3_amendment_action": ThirdAmendApproverAction[serviceId], "a4_amendment_action": FourthAmendApproverAction[serviceId], "amendment_parallel_process_from": - SelectedParallelAmendProcess[serviceId], + SelectedParallelAmendProcess[serviceId], "created_by": widget.userId, }; @@ -337,17 +335,19 @@ class PolicyCriteriaState extends State { bool allActionsNull = a1 == null && a2 == null && a3 == null; bool someActionsMissing = [a1, a2, a3].where((a) => a != null).length > 0 && - [a1, a2, a3].where((a) => a == null).length > 0; + [a1, a2, a3].where((a) => a == null).length > 0; - bool allExceptionalActionsNull = ae1 == null && ae2 == null && ae3 == null && ae4 == null; + bool allExceptionalActionsNull = + ae1 == null && ae2 == null && ae3 == null && ae4 == null; bool someExceptionalActionsMissing = [ae1, ae2, ae3, ae4].where((a) => a != null).length > 0 && - [ae1, ae2, ae3, ae4].where((a) => a == null).length > 0; + [ae1, ae2, ae3, ae4].where((a) => a == null).length > 0; - bool allAmendActionsNull = aa1 == null && aa2 == null && aa3 == null && aa4 == null; + bool allAmendActionsNull = + aa1 == null && aa2 == null && aa3 == null && aa4 == null; bool someAmendActionsMissing = [aa1, aa2, aa3, aa4].where((a) => a != null).length > 0 && - [aa1, aa2, aa3, aa4].where((a) => a == null).length > 0; + [aa1, aa2, aa3, aa4].where((a) => a == null).length > 0; if (someActionsMissing) { validationErrors[serviceId] = "All 3 approver actions must be selected."; @@ -355,12 +355,12 @@ class PolicyCriteriaState extends State { } if (someExceptionalActionsMissing) { validationErrors[serviceId] = - "All 4 exceptional approver actions must be selected."; + "All 4 exceptional approver actions must be selected."; return; } if (someAmendActionsMissing) { validationErrors[serviceId] = - "All 4 amendment approver actions must be selected."; + "All 4 amendment approver actions must be selected."; return; } @@ -477,7 +477,6 @@ class PolicyCriteriaState extends State { void fieldForPolicy() { print("fieldForPolicy - ${widget.selectedTabNotifier.value}"); - // Save current input to policyData before switching if (ServiceId != null) { print("Calling addOrUpdatePolicy"); @@ -495,11 +494,12 @@ class PolicyCriteriaState extends State { print(" db - ${widget.serviceDBValueList.length}"); print(" db list - ${widget.serviceDBValueList}"); - if (tabIndex != null && tabIndex >= 0 && tabIndex <= widget.serviceDBValueList.length) { - ServiceId = widget.serviceDBValueList[tabIndex-1].toString(); + if (tabIndex != null && + tabIndex >= 0 && + tabIndex <= widget.serviceDBValueList.length) { + ServiceId = widget.serviceDBValueList[tabIndex - 1].toString(); print('✅ 484 Selected ServiceId: $ServiceId'); - } - else { + } else { print('❌ Invalid tab index or out of range'); } print("502 ServiceId $ServiceId"); @@ -560,9 +560,9 @@ class PolicyCriteriaState extends State { widget.isDesktop ? SizedBox(height: 1) : SizedBox(height: 1), Padding( padding: - widget.isDesktop - ? const EdgeInsets.only(left: 0.0) - : const EdgeInsets.only(left: 0), + widget.isDesktop + ? const EdgeInsets.only(left: 0.0) + : const EdgeInsets.only(left: 0), child: Row( children: [ Container( @@ -574,27 +574,27 @@ class PolicyCriteriaState extends State { right: 5, ), child: - widget.isDesktop - ? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - if (widget.isClass) - buildClassWidget(widget.isDesktop), - SizedBox(width: 45), - if (widget.isCost!) - buildCostWidget(widget.isDesktop), - ], - ) - : Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (widget.isClass!) - buildClassWidget(widget.isDesktop), - SizedBox(height: 10), - if (widget.isCost!) - buildCostWidget(widget.isDesktop), - ], - ), + widget.isDesktop + ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + if (widget.isClass) + buildClassWidget(widget.isDesktop), + SizedBox(width: 45), + if (widget.isCost!) + buildCostWidget(widget.isDesktop), + ], + ) + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (widget.isClass!) + buildClassWidget(widget.isDesktop), + SizedBox(height: 10), + if (widget.isCost!) + buildCostWidget(widget.isDesktop), + ], + ), ), ], ), @@ -632,13 +632,13 @@ class PolicyCriteriaState extends State { Container( // color: Colors.yellow, width: - widget.isDesktop - ? MediaQuery.of(context).size.width * 0.18 - : 600, + widget.isDesktop + ? MediaQuery.of(context).size.width * 0.18 + : 600, height: - widget.isDesktop - ? MediaQuery.of(context).size.height * 0.56 - : null, + widget.isDesktop + ? MediaQuery.of(context).size.height * 0.56 + : null, child: Column( children: [ Container( @@ -657,9 +657,9 @@ class PolicyCriteriaState extends State { ), child: Row( mainAxisAlignment: - widget.isDesktop - ? MainAxisAlignment.spaceAround - : MainAxisAlignment.spaceBetween, + widget.isDesktop + ? MainAxisAlignment.spaceAround + : MainAxisAlignment.spaceBetween, children: [ Expanded( flex: 3, @@ -707,11 +707,11 @@ class PolicyCriteriaState extends State { border: Border( right: BorderSide( color: - Colors - .blueGrey - .shade50, // Change this to your desired color + Colors + .blueGrey + .shade50, // Change this to your desired color width: - 1.0, // Change this to your desired width + 1.0, // Change this to your desired width ), ), ), @@ -735,9 +735,9 @@ class PolicyCriteriaState extends State { Spacer(), CustomTextFieldUserWrapper( width: - MediaQuery.of( - context, - ).size.width * + MediaQuery.of( + context, + ).size.width * 0.12, isFocused: false, isDesktop: widget.isDesktop, @@ -745,38 +745,38 @@ class PolicyCriteriaState extends State { height: 35, child: DropdownSearch( selectedItem: - FirstApproverAction[ServiceId], + FirstApproverAction[ServiceId], // enabled: !isViewMode, popupProps: PopupProps.menu( // showSearchBox: true, fit: - FlexFit - .loose, // Allows flexible height + FlexFit + .loose, // Allows flexible height constraints: BoxConstraints( maxHeight: 250, ), itemBuilder: ( - context, - item, - isSelected, + context, + item, + isSelected, ) => Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0, - ), - child: Text( - item, - style: GoogleFonts.poppins( - fontSize: - 12, // 👈 Smaller text size here - color: - Colors - .black, // You can customize this + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: GoogleFonts.poppins( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), ), - ), - ), ), items: [ "Approval", @@ -784,29 +784,29 @@ class PolicyCriteriaState extends State { "None", ], dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: - InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5, + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), ), - ), - ), dropdownBuilder: ( - context, - selectedItem, + context, + selectedItem, ) => Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B), - ), - ), + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), onChanged: (String? newValue) { setState(() { @@ -829,42 +829,74 @@ class PolicyCriteriaState extends State { onTap: () { setState(() { SelectedParallelProcess[ServiceId!] = - "1"; + "1"; }); print( "SelectedParallelProcess - $SelectedParallelProcess", ); }, - child: Container( - height: 25, - width: 25, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: - (SelectedParallelProcess[ServiceId] == - "1") - ? Colors.green - : Colors.grey, - width: 2, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + // Circle icon + Container( + height: 25, + width: 25, + child: Icon( + Icons.circle, + size: 15, + color: + (SelectedParallelProcess[ServiceId] == + "1") + ? Colors.green + : Colors.grey, + ), ), - ), - child: Icon( - Icons.check_circle, - size: 20, - color: - (SelectedParallelProcess[ServiceId] == - "1") - ? Colors.green - : Colors.grey, - // color: Colors.grey, - ), + Icon( + Icons.arrow_downward, + size: 16, + color: + (SelectedParallelProcess[ServiceId] == + "1") + ? Colors.green + : Colors.grey, + ), + + // Bottom line + ], ), + + // child: Container( + // height: 25, + // width: 25, + // // decoration: BoxDecoration( + // // shape: BoxShape.circle, + // // border: Border.all( + // // color: + // // (SelectedParallelProcess[ServiceId] == + // // "1") + // // ? Colors.green + // // : Colors.grey, + // // width: 2, + // // ), + // // ), + // child: Icon( + // Icons.circle, + // size: 20, + // color: + // (SelectedParallelProcess[ServiceId] == + // "1") + // ? Colors.green + // : Colors.grey, + // // color: Colors.grey, + // ), + // ), ), ], ), ), + Container( padding: const EdgeInsets.all(10), child: Row( @@ -880,9 +912,9 @@ class PolicyCriteriaState extends State { Spacer(), CustomTextFieldUserWrapper( width: - MediaQuery.of( - context, - ).size.width * + MediaQuery.of( + context, + ).size.width * 0.12, isFocused: false, isDesktop: widget.isDesktop, @@ -890,38 +922,38 @@ class PolicyCriteriaState extends State { height: 35, child: DropdownSearch( selectedItem: - SecondApproverAction[ServiceId], + SecondApproverAction[ServiceId], // enabled: !isViewMode, popupProps: PopupProps.menu( // showSearchBox: true, fit: - FlexFit - .loose, // Allows flexible height + FlexFit + .loose, // Allows flexible height constraints: BoxConstraints( maxHeight: 250, ), itemBuilder: ( - context, - item, - isSelected, + context, + item, + isSelected, ) => Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0, - ), - child: Text( - item, - style: TextStyle( - fontSize: - 12, // 👈 Smaller text size here - color: - Colors - .black, // You can customize this + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: TextStyle( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), ), - ), - ), ), items: [ "Approval", @@ -929,29 +961,29 @@ class PolicyCriteriaState extends State { "None", ], dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: - InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5, + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), ), - ), - ), dropdownBuilder: ( - context, - selectedItem, + context, + selectedItem, ) => Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B), - ), - ), + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), onChanged: (String? newValue) { setState(() { @@ -974,42 +1006,77 @@ class PolicyCriteriaState extends State { onTap: () { setState(() { SelectedParallelProcess[ServiceId!] = - "2"; + "2"; }); print( "SelectedParallelProcess - $SelectedParallelProcess", ); }, - child: Container( - height: 25, - width: 25, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: - ((SelectedParallelProcess[ServiceId] == - "1") || - (SelectedParallelProcess[ServiceId] == - "2")) - ? Colors.green - : Colors.grey, - width: 2, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + // Circle icon + Container( + height: 25, + width: 25, + child: Icon( + Icons.circle, + size: 15, + color: + ((SelectedParallelProcess[ServiceId] == + "1") || + (SelectedParallelProcess[ServiceId] == + "2")) + ? Colors.green + : Colors.grey, + ), ), - ), - child: Icon( - Icons.check_circle, - size: 20, - color: - ((SelectedParallelProcess[ServiceId] == - "1") || - (SelectedParallelProcess[ServiceId] == - "2")) - ? Colors.green - : Colors.grey, - // color: Colors.grey, - ), + Icon( + Icons.arrow_downward_sharp, + size: 16, + color: + ((SelectedParallelProcess[ServiceId] == + "1") || + (SelectedParallelProcess[ServiceId] == + "2")) + ? Colors.green + : Colors.grey, + ), + + // Bottom line + ], ), + + // child: Container( + // height: 25, + // width: 25, + // // decoration: BoxDecoration( + // // shape: BoxShape.circle, + // // border: Border.all( + // // color: + // // ((SelectedParallelProcess[ServiceId] == + // // "1") || + // // (SelectedParallelProcess[ServiceId] == + // // "2")) + // // ? Colors.green + // // : Colors.grey, + // // width: 2, + // // ), + // // ), + // child: Icon( + // Icons.circle, + // size: 20, + // color: + // ((SelectedParallelProcess[ServiceId] == + // "1") || + // (SelectedParallelProcess[ServiceId] == + // "2")) + // ? Colors.green + // : Colors.grey, + // // color: Colors.grey, + // ), + // ), ), ], ), @@ -1028,9 +1095,9 @@ class PolicyCriteriaState extends State { Spacer(), CustomTextFieldUserWrapper( width: - MediaQuery.of( - context, - ).size.width * + MediaQuery.of( + context, + ).size.width * 0.12, isFocused: false, isDesktop: widget.isDesktop, @@ -1038,38 +1105,38 @@ class PolicyCriteriaState extends State { height: 35, child: DropdownSearch( selectedItem: - ThirdApproverAction[ServiceId], + ThirdApproverAction[ServiceId], // enabled: !isViewMode, popupProps: PopupProps.menu( // showSearchBox: true, fit: - FlexFit - .loose, // Allows flexible height + FlexFit + .loose, // Allows flexible height constraints: BoxConstraints( maxHeight: 250, ), itemBuilder: ( - context, - item, - isSelected, + context, + item, + isSelected, ) => Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0, - ), - child: Text( - item, - style: GoogleFonts.poppins( - fontSize: - 12, // 👈 Smaller text size here - color: - Colors - .black, // You can customize this + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: GoogleFonts.poppins( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), ), - ), - ), ), items: [ "Approval", @@ -1077,28 +1144,28 @@ class PolicyCriteriaState extends State { "None", ], dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: - InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5, + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), ), - ), - ), dropdownBuilder: (context, selectedItem) => - // Center-align selected item - Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B), - ), - ), + // Center-align selected item + Text( + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), onChanged: (String? newValue) { setState(() { @@ -1121,45 +1188,69 @@ class PolicyCriteriaState extends State { onTap: () { setState(() { SelectedParallelProcess[ServiceId!] = - "3"; + "3"; }); print( "SelectedParallelProcess - $SelectedParallelProcess[ServiceId]", ); }, - child: Container( - height: 25, - width: 25, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: - ((SelectedParallelProcess[ServiceId] == - "1") || - (SelectedParallelProcess[ServiceId] == - "2") || - (SelectedParallelProcess[ServiceId] == - "3")) - ? Colors.green - : Colors.grey, - width: 2, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + // Top lin + // Circle icon + Container( + height: 25, + width: 25, + child: Icon( + Icons.circle, + size: 15, + color: + ((SelectedParallelProcess[ServiceId] == + "1") || + (SelectedParallelProcess[ServiceId] == + "2") || + (SelectedParallelProcess[ServiceId] == + "3")) + ? Colors.green + : Colors.grey, + ), ), - ), - child: Icon( - Icons.check_circle, - size: 20, - color: - ((SelectedParallelProcess[ServiceId] == - "1") || - (SelectedParallelProcess[ServiceId] == - "2") || - (SelectedParallelProcess[ServiceId] == - "3")) - ? Colors.green - : Colors.grey, - // color: Colors.grey, - ), + ], ), + // child: Container( + // height: 25, + // width: 25, + // // decoration: BoxDecoration( + // // shape: BoxShape.circle, + // // border: Border.all( + // // color: + // // ((SelectedParallelProcess[ServiceId] == + // // "1") || + // // (SelectedParallelProcess[ServiceId] == + // // "2") || + // // (SelectedParallelProcess[ServiceId] == + // // "3")) + // // ? Colors.green + // // : Colors.grey, + // // width: 2, + // // ), + // // ), + // child: Icon( + // Icons.circle, + // size: 20, + // color: + // ((SelectedParallelProcess[ServiceId] == + // "1") || + // (SelectedParallelProcess[ServiceId] == + // "2") || + // (SelectedParallelProcess[ServiceId] == + // "3")) + // ? Colors.green + // : Colors.grey, + // // color: Colors.grey, + // ), + // ), ), ], ), @@ -1179,13 +1270,13 @@ class PolicyCriteriaState extends State { children: [ Container( width: - widget.isDesktop - ? MediaQuery.of(context).size.width * 0.18 - : 600, + widget.isDesktop + ? MediaQuery.of(context).size.width * 0.18 + : 600, height: - widget.isDesktop - ? MediaQuery.of(context).size.height * 0.56 - : null, + widget.isDesktop + ? MediaQuery.of(context).size.height * 0.56 + : null, child: Column( children: [ Container( @@ -1204,9 +1295,9 @@ class PolicyCriteriaState extends State { ), child: Row( mainAxisAlignment: - widget.isDesktop - ? MainAxisAlignment.spaceAround - : MainAxisAlignment.spaceBetween, + widget.isDesktop + ? MainAxisAlignment.spaceAround + : MainAxisAlignment.spaceBetween, children: [ Expanded( flex: 3, @@ -1254,11 +1345,11 @@ class PolicyCriteriaState extends State { border: Border( right: BorderSide( color: - Colors - .blueGrey - .shade50, // Change this to your desired color + Colors + .blueGrey + .shade50, // Change this to your desired color width: - 1.0, // Change this to your desired width + 1.0, // Change this to your desired width ), ), ), @@ -1268,7 +1359,10 @@ class PolicyCriteriaState extends State { children: [ Container( // padding: const EdgeInsets.all(10), - padding: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0), + padding: const EdgeInsets.symmetric( + horizontal: 4.0, + vertical: 4.0, + ), child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -1282,9 +1376,9 @@ class PolicyCriteriaState extends State { Spacer(), CustomTextFieldUserWrapper( width: - MediaQuery.of( - context, - ).size.width * + MediaQuery.of( + context, + ).size.width * 0.12, isFocused: false, isDesktop: widget.isDesktop, @@ -1292,38 +1386,38 @@ class PolicyCriteriaState extends State { height: 35, child: DropdownSearch( selectedItem: - FirstExceptionalApproverAction[ServiceId], + FirstExceptionalApproverAction[ServiceId], // enabled: !isViewMode, popupProps: PopupProps.menu( // showSearchBox: true, fit: - FlexFit - .loose, // Allows flexible height + FlexFit + .loose, // Allows flexible height constraints: BoxConstraints( maxHeight: 250, ), itemBuilder: ( - context, - item, - isSelected, + context, + item, + isSelected, ) => Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0, - ), - child: Text( - item, - style: GoogleFonts.poppins( - fontSize: - 12, // 👈 Smaller text size here - color: - Colors - .black, // You can customize this + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: GoogleFonts.poppins( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), ), - ), - ), ), items: [ "Approval", @@ -1331,29 +1425,29 @@ class PolicyCriteriaState extends State { "None", ], dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: - InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5, + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), ), - ), - ), dropdownBuilder: ( - context, - selectedItem, + context, + selectedItem, ) => Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B), - ), - ), + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), onChanged: (String? newValue) { setState(() { @@ -1376,45 +1470,78 @@ class PolicyCriteriaState extends State { onTap: () { setState(() { SelectedParallelExceptionalProcess[ServiceId!] = - "1"; + "1"; }); print( "SelectedParallelExceptionalProcess - $SelectedParallelExceptionalProcess", ); }, - child: Container( - height: 25, - width: 25, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: - (SelectedParallelExceptionalProcess[ServiceId] == - "1") - ? Colors.green - : Colors.grey, - width: 2, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + // Circle icon + Container( + height: 25, + width: 25, + child: Icon( + Icons.circle, + size: 15, + color: + (SelectedParallelExceptionalProcess[ServiceId] == + "1") + ? Colors.green + : Colors.grey, + ), ), - ), - child: Icon( - Icons.check_circle, - size: 20, - color: - (SelectedParallelExceptionalProcess[ServiceId] == - "1") - ? Colors.green - : Colors.grey, - // color: Colors.grey, - ), + Icon( + Icons.arrow_downward_sharp, + size: 16, + color: + (SelectedParallelExceptionalProcess[ServiceId] == + "1") + ? Colors.green + : Colors.grey, + ), + + // Bottom line + ], ), + // child: Container( + // height: 25, + // width: 25, + // // decoration: BoxDecoration( + // // shape: BoxShape.circle, + // // border: Border.all( + // // color: + // // (SelectedParallelExceptionalProcess[ServiceId] == + // // "1") + // // ? Colors.green + // // : Colors.grey, + // // width: 2, + // // ), + // // ), + // child: Icon( + // Icons.circle, + // size: 20, + // color: + // (SelectedParallelExceptionalProcess[ServiceId] == + // "1") + // ? Colors.green + // : Colors.grey, + // // color: Colors.grey, + // ), + // ), ), ], ), ), Container( // padding: const EdgeInsets.all(10), - padding: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0), + padding: const EdgeInsets.symmetric( + horizontal: 4.0, + vertical: 4.0, + ), child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -1428,9 +1555,9 @@ class PolicyCriteriaState extends State { Spacer(), CustomTextFieldUserWrapper( width: - MediaQuery.of( - context, - ).size.width * + MediaQuery.of( + context, + ).size.width * 0.12, isFocused: false, isDesktop: widget.isDesktop, @@ -1438,38 +1565,38 @@ class PolicyCriteriaState extends State { height: 35, child: DropdownSearch( selectedItem: - SecondExceptionalApproverAction[ServiceId], + SecondExceptionalApproverAction[ServiceId], // enabled: !isViewMode, popupProps: PopupProps.menu( // showSearchBox: true, fit: - FlexFit - .loose, // Allows flexible height + FlexFit + .loose, // Allows flexible height constraints: BoxConstraints( maxHeight: 250, ), itemBuilder: ( - context, - item, - isSelected, + context, + item, + isSelected, ) => Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0, - ), - child: Text( - item, - style: TextStyle( - fontSize: - 12, // 👈 Smaller text size here - color: - Colors - .black, // You can customize this + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: TextStyle( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), ), - ), - ), ), items: [ "Approval", @@ -1477,29 +1604,29 @@ class PolicyCriteriaState extends State { "None", ], dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: - InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5, + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), ), - ), - ), dropdownBuilder: ( - context, - selectedItem, + context, + selectedItem, ) => Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B), - ), - ), + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), onChanged: (String? newValue) { setState(() { @@ -1522,49 +1649,86 @@ class PolicyCriteriaState extends State { onTap: () { setState(() { SelectedParallelExceptionalProcess[ServiceId!] = - "2"; + "2"; }); print( "SelectedParallelExceptionalProcess - $SelectedParallelExceptionalProcess", ); }, - child: Container( - height: 25, - width: 25, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: - ((SelectedParallelExceptionalProcess[ServiceId] == - "1") || - (SelectedParallelExceptionalProcess[ServiceId] == - "2")) - ? Colors.green - : Colors.grey, - width: 2, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + // Circle icon + Container( + height: 25, + width: 25, + child: Icon( + Icons.circle, + size: 15, + color: + ((SelectedParallelExceptionalProcess[ServiceId] == + "1") || + (SelectedParallelExceptionalProcess[ServiceId] == + "2")) + ? Colors.green + : Colors.grey, + ), ), - ), - child: Icon( - Icons.check_circle, - size: 20, - color: - ((SelectedParallelExceptionalProcess[ServiceId] == - "1") || - (SelectedParallelExceptionalProcess[ServiceId] == - "2")) - ? Colors.green - : Colors.grey, - // color: Colors.grey, - ), + Icon( + Icons.arrow_downward_sharp, + size: 16, + color: + ((SelectedParallelExceptionalProcess[ServiceId] == + "1") || + (SelectedParallelExceptionalProcess[ServiceId] == + "2")) + ? Colors.green + : Colors.grey, + ), + + // Bottom line + ], ), + // child: Container( + // height: 25, + // width: 25, + // // decoration: BoxDecoration( + // // shape: BoxShape.circle, + // // border: Border.all( + // // color: + // // ((SelectedParallelExceptionalProcess[ServiceId] == + // // "1") || + // // (SelectedParallelExceptionalProcess[ServiceId] == + // // "2")) + // // ? Colors.green + // // : Colors.grey, + // // width: 2, + // // ), + // // ), + // child: Icon( + // Icons.circle, + // size: 20, + // color: + // ((SelectedParallelExceptionalProcess[ServiceId] == + // "1") || + // (SelectedParallelExceptionalProcess[ServiceId] == + // "2")) + // ? Colors.green + // : Colors.grey, + // // color: Colors.grey, + // ), + // ), ), ], ), ), Container( // padding: const EdgeInsets.all(10), - padding: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0), + padding: const EdgeInsets.symmetric( + horizontal: 4.0, + vertical: 4.0, + ), child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -1577,9 +1741,9 @@ class PolicyCriteriaState extends State { Spacer(), CustomTextFieldUserWrapper( width: - MediaQuery.of( - context, - ).size.width * + MediaQuery.of( + context, + ).size.width * 0.12, isFocused: false, isDesktop: widget.isDesktop, @@ -1587,38 +1751,38 @@ class PolicyCriteriaState extends State { height: 35, child: DropdownSearch( selectedItem: - ThirdExceptionalApproverAction[ServiceId], + ThirdExceptionalApproverAction[ServiceId], // enabled: !isViewMode, popupProps: PopupProps.menu( // showSearchBox: true, fit: - FlexFit - .loose, // Allows flexible height + FlexFit + .loose, // Allows flexible height constraints: BoxConstraints( maxHeight: 250, ), itemBuilder: ( - context, - item, - isSelected, + context, + item, + isSelected, ) => Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0, - ), - child: Text( - item, - style: GoogleFonts.poppins( - fontSize: - 12, // 👈 Smaller text size here - color: - Colors - .black, // You can customize this + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: GoogleFonts.poppins( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), ), - ), - ), ), items: [ "Approval", @@ -1626,28 +1790,28 @@ class PolicyCriteriaState extends State { "None", ], dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: - InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5, + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), ), - ), - ), dropdownBuilder: (context, selectedItem) => - // Center-align selected item - Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B), - ), - ), + // Center-align selected item + Text( + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), onChanged: (String? newValue) { setState(() { @@ -1670,52 +1834,93 @@ class PolicyCriteriaState extends State { onTap: () { setState(() { SelectedParallelExceptionalProcess[ServiceId!] = - "3"; + "3"; }); print( "SelectedParallelExceptionalProcess - $SelectedParallelExceptionalProcess[ServiceId]", ); }, - child: Container( - height: 25, - width: 25, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: - ((SelectedParallelExceptionalProcess[ServiceId] == - "1") || - (SelectedParallelExceptionalProcess[ServiceId] == - "2") || - (SelectedParallelExceptionalProcess[ServiceId] == - "3")) - ? Colors.green - : Colors.grey, - width: 2, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + // Circle icon + Container( + height: 25, + width: 25, + child: Icon( + Icons.circle, + size: 15, + color: + ((SelectedParallelExceptionalProcess[ServiceId] == + "1") || + (SelectedParallelExceptionalProcess[ServiceId] == + "2") || + (SelectedParallelExceptionalProcess[ServiceId] == + "3")) + ? Colors.green + : Colors.grey, + ), ), - ), - child: Icon( - Icons.check_circle, - size: 20, - color: - ((SelectedParallelExceptionalProcess[ServiceId] == - "1") || - (SelectedParallelExceptionalProcess[ServiceId] == - "2") || - (SelectedParallelExceptionalProcess[ServiceId] == - "3")) - ? Colors.green - : Colors.grey, - // color: Colors.grey, - ), + Icon( + Icons.arrow_downward_sharp, + size: 16, + color: + ((SelectedParallelExceptionalProcess[ServiceId] == + "1") || + (SelectedParallelExceptionalProcess[ServiceId] == + "2") || + (SelectedParallelExceptionalProcess[ServiceId] == + "3")) + ? Colors.green + : Colors.grey, + ), + + // Bottom line + ], ), + // child: Container( + // height: 25, + // width: 25, + // // decoration: BoxDecoration( + // // shape: BoxShape.circle, + // // border: Border.all( + // // color: + // // ((SelectedParallelExceptionalProcess[ServiceId] == + // // "1") || + // // (SelectedParallelExceptionalProcess[ServiceId] == + // // "2") || + // // (SelectedParallelExceptionalProcess[ServiceId] == + // // "3")) + // // ? Colors.green + // // : Colors.grey, + // // width: 2, + // // ), + // // ), + // child: Icon( + // Icons.circle, + // size: 20, + // color: + // ((SelectedParallelExceptionalProcess[ServiceId] == + // "1") || + // (SelectedParallelExceptionalProcess[ServiceId] == + // "2") || + // (SelectedParallelExceptionalProcess[ServiceId] == + // "3")) + // ? Colors.green + // : Colors.grey, + // // color: Colors.grey, + // ), + // ), ), ], ), ), Container( // padding: const EdgeInsets.all(10), - padding: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0), + padding: const EdgeInsets.symmetric( + horizontal: 4.0, + vertical: 4.0, + ), child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -1728,9 +1933,9 @@ class PolicyCriteriaState extends State { Spacer(), CustomTextFieldUserWrapper( width: - MediaQuery.of( - context, - ).size.width * + MediaQuery.of( + context, + ).size.width * 0.12, isFocused: false, isDesktop: widget.isDesktop, @@ -1738,38 +1943,38 @@ class PolicyCriteriaState extends State { height: 35, child: DropdownSearch( selectedItem: - FourthExceptionalApproverAction[ServiceId], + FourthExceptionalApproverAction[ServiceId], // enabled: !isViewMode, popupProps: PopupProps.menu( // showSearchBox: true, fit: - FlexFit - .loose, // Allows flexible height + FlexFit + .loose, // Allows flexible height constraints: BoxConstraints( maxHeight: 250, ), itemBuilder: ( - context, - item, - isSelected, + context, + item, + isSelected, ) => Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0, - ), - child: Text( - item, - style: GoogleFonts.poppins( - fontSize: - 12, // 👈 Smaller text size here - color: - Colors - .black, // You can customize this + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: GoogleFonts.poppins( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), ), - ), - ), ), items: [ "Approval", @@ -1777,28 +1982,28 @@ class PolicyCriteriaState extends State { "None", ], dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: - InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5, + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), ), - ), - ), dropdownBuilder: (context, selectedItem) => - // Center-align selected item - Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B), - ), - ), + // Center-align selected item + Text( + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), onChanged: (String? newValue) { setState(() { @@ -1821,7 +2026,7 @@ class PolicyCriteriaState extends State { onTap: () { setState(() { SelectedParallelExceptionalProcess[ServiceId!] = - "4"; + "4"; }); print( "SelectedParallelExceptionalProcess - $SelectedParallelExceptionalProcess[ServiceId]", @@ -1830,37 +2035,38 @@ class PolicyCriteriaState extends State { child: Container( height: 25, width: 25, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: - ((SelectedParallelExceptionalProcess[ServiceId] == - "1") || - (SelectedParallelExceptionalProcess[ServiceId] == - "2") || - (SelectedParallelExceptionalProcess[ServiceId] == - "3") || - (SelectedParallelExceptionalProcess[ServiceId] == - "4")) - ? Colors.green - : Colors.grey, - width: 2, - ), - ), + // decoration: BoxDecoration( + // shape: BoxShape.circle, + // border: Border.all( + // color: + // ((SelectedParallelExceptionalProcess[ServiceId] == + // "1") || + // (SelectedParallelExceptionalProcess[ServiceId] == + // "2") || + // (SelectedParallelExceptionalProcess[ServiceId] == + // "3") || + // (SelectedParallelExceptionalProcess[ServiceId] == + // "4")) + // ? Colors.green + // : Colors.grey, + // width: 2, + // ), + // ), child: Icon( - Icons.check_circle, - size: 20, + Icons.circle, + size: 15, + color: - ((SelectedParallelExceptionalProcess[ServiceId] == - "1") || - (SelectedParallelExceptionalProcess[ServiceId] == - "2") || - (SelectedParallelExceptionalProcess[ServiceId] == - "3") || - (SelectedParallelExceptionalProcess[ServiceId] == - "4")) - ? Colors.green - : Colors.grey, + ((SelectedParallelExceptionalProcess[ServiceId] == + "1") || + (SelectedParallelExceptionalProcess[ServiceId] == + "2") || + (SelectedParallelExceptionalProcess[ServiceId] == + "3") || + (SelectedParallelExceptionalProcess[ServiceId] == + "4")) + ? Colors.green + : Colors.grey, // color: Colors.grey, ), ), @@ -1883,13 +2089,13 @@ class PolicyCriteriaState extends State { Container( //color: Colors.grey.shade100, width: - widget.isDesktop - ? MediaQuery.of(context).size.width * 0.18 - : 600, + widget.isDesktop + ? MediaQuery.of(context).size.width * 0.18 + : 600, height: - widget.isDesktop - ? MediaQuery.of(context).size.height * 0.56 - : null, + widget.isDesktop + ? MediaQuery.of(context).size.height * 0.56 + : null, child: Column( children: [ Container( @@ -1908,9 +2114,9 @@ class PolicyCriteriaState extends State { ), child: Row( mainAxisAlignment: - widget.isDesktop - ? MainAxisAlignment.spaceAround - : MainAxisAlignment.spaceBetween, + widget.isDesktop + ? MainAxisAlignment.spaceAround + : MainAxisAlignment.spaceBetween, children: [ Expanded( flex: 3, @@ -1960,7 +2166,10 @@ class PolicyCriteriaState extends State { children: [ Container( // padding: const EdgeInsets.all(10), - padding: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0), + padding: const EdgeInsets.symmetric( + horizontal: 4.0, + vertical: 4.0, + ), child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -1974,9 +2183,9 @@ class PolicyCriteriaState extends State { Spacer(), CustomTextFieldUserWrapper( width: - MediaQuery.of( - context, - ).size.width * + MediaQuery.of( + context, + ).size.width * 0.12, isFocused: false, isDesktop: widget.isDesktop, @@ -1984,38 +2193,38 @@ class PolicyCriteriaState extends State { height: 35, child: DropdownSearch( selectedItem: - FirstAmendApproverAction[ServiceId], + FirstAmendApproverAction[ServiceId], // enabled: !isViewMode, popupProps: PopupProps.menu( // showSearchBox: true, fit: - FlexFit - .loose, // Allows flexible height + FlexFit + .loose, // Allows flexible height constraints: BoxConstraints( maxHeight: 250, ), itemBuilder: ( - context, - item, - isSelected, + context, + item, + isSelected, ) => Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0, - ), - child: Text( - item, - style: GoogleFonts.poppins( - fontSize: - 12, // 👈 Smaller text size here - color: - Colors - .black, // You can customize this + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: GoogleFonts.poppins( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), ), - ), - ), ), items: [ "Approval", @@ -2023,29 +2232,29 @@ class PolicyCriteriaState extends State { "None", ], dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: - InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5, + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), ), - ), - ), dropdownBuilder: ( - context, - selectedItem, + context, + selectedItem, ) => Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B), - ), - ), + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), onChanged: (String? newValue) { setState(() { @@ -2068,45 +2277,78 @@ class PolicyCriteriaState extends State { onTap: () { setState(() { SelectedParallelAmendProcess[ServiceId!] = - "1"; + "1"; }); print( "SelectedParallelAmendProcess - $SelectedParallelAmendProcess", ); }, - child: Container( - height: 25, - width: 25, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: - (SelectedParallelAmendProcess[ServiceId] == - "1") - ? Colors.green - : Colors.grey, - width: 2, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + // Circle icon + Container( + height: 25, + width: 25, + child: Icon( + Icons.circle, + size: 15, + color: + (SelectedParallelAmendProcess[ServiceId] == + "1") + ? Colors.green + : Colors.grey, + ), ), - ), - child: Icon( - Icons.check_circle, - size: 20, - color: - (SelectedParallelAmendProcess[ServiceId] == - "1") - ? Colors.green - : Colors.grey, - // color: Colors.grey, - ), + Icon( + Icons.arrow_downward_sharp, + size: 16, + color: + (SelectedParallelAmendProcess[ServiceId] == + "1") + ? Colors.green + : Colors.grey, + ), + + // Bottom line + ], ), + // child: Container( + // height: 25, + // width: 25, + // // decoration: BoxDecoration( + // // shape: BoxShape.circle, + // // border: Border.all( + // // color: + // // (SelectedParallelAmendProcess[ServiceId] == + // // "1") + // // ? Colors.green + // // : Colors.grey, + // // width: 2, + // // ), + // // ), + // child: Icon( + // Icons.circle, + // size: 20, + // color: + // (SelectedParallelAmendProcess[ServiceId] == + // "1") + // ? Colors.green + // : Colors.grey, + // // color: Colors.grey, + // ), + // ), ), ], ), ), Container( // padding: const EdgeInsets.all(10), - padding: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0), + padding: const EdgeInsets.symmetric( + horizontal: 4.0, + vertical: 4.0, + ), child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -2120,9 +2362,9 @@ class PolicyCriteriaState extends State { Spacer(), CustomTextFieldUserWrapper( width: - MediaQuery.of( - context, - ).size.width * + MediaQuery.of( + context, + ).size.width * 0.12, isFocused: false, isDesktop: widget.isDesktop, @@ -2130,38 +2372,38 @@ class PolicyCriteriaState extends State { height: 35, child: DropdownSearch( selectedItem: - SecondAmendApproverAction[ServiceId], + SecondAmendApproverAction[ServiceId], // enabled: !isViewMode, popupProps: PopupProps.menu( // showSearchBox: true, fit: - FlexFit - .loose, // Allows flexible height + FlexFit + .loose, // Allows flexible height constraints: BoxConstraints( maxHeight: 250, ), itemBuilder: ( - context, - item, - isSelected, + context, + item, + isSelected, ) => Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0, - ), - child: Text( - item, - style: TextStyle( - fontSize: - 12, // 👈 Smaller text size here - color: - Colors - .black, // You can customize this + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: TextStyle( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), ), - ), - ), ), items: [ "Approval", @@ -2169,29 +2411,29 @@ class PolicyCriteriaState extends State { "None", ], dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: - InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5, + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), ), - ), - ), dropdownBuilder: ( - context, - selectedItem, + context, + selectedItem, ) => Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B), - ), - ), + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), onChanged: (String? newValue) { setState(() { @@ -2214,49 +2456,87 @@ class PolicyCriteriaState extends State { onTap: () { setState(() { SelectedParallelAmendProcess[ServiceId!] = - "2"; + "2"; }); print( "SelectedParallelAmendProcess - $SelectedParallelAmendProcess", ); }, - child: Container( - height: 25, - width: 25, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: - ((SelectedParallelAmendProcess[ServiceId] == - "1") || - (SelectedParallelAmendProcess[ServiceId] == - "2")) - ? Colors.green - : Colors.grey, - width: 2, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + // Circle icon + Container( + height: 25, + width: 25, + child: Icon( + Icons.circle, + size: 15, + color: + ((SelectedParallelAmendProcess[ServiceId] == + "1") || + (SelectedParallelAmendProcess[ServiceId] == + "2")) + ? Colors.green + : Colors.grey, + ), ), - ), - child: Icon( - Icons.check_circle, - size: 20, - color: - ((SelectedParallelAmendProcess[ServiceId] == - "1") || - (SelectedParallelAmendProcess[ServiceId] == - "2")) - ? Colors.green - : Colors.grey, - // color: Colors.grey, - ), + Icon( + Icons.arrow_downward_sharp, + size: 16, + color: + ((SelectedParallelAmendProcess[ServiceId] == + "1") || + (SelectedParallelAmendProcess[ServiceId] == + "2")) + ? Colors.green + : Colors.grey, + ), + + // Bottom line + ], ), + + // child: Container( + // height: 25, + // width: 25, + // // decoration: BoxDecoration( + // // shape: BoxShape.circle, + // // border: Border.all( + // // color: + // // ((SelectedParallelAmendProcess[ServiceId] == + // // "1") || + // // (SelectedParallelAmendProcess[ServiceId] == + // // "2")) + // // ? Colors.green + // // : Colors.grey, + // // width: 2, + // // ), + // // ), + // child: Icon( + // Icons.circle, + // size: 20, + // color: + // ((SelectedParallelAmendProcess[ServiceId] == + // "1") || + // (SelectedParallelAmendProcess[ServiceId] == + // "2")) + // ? Colors.green + // : Colors.grey, + // // color: Colors.grey, + // ), + // ), ), ], ), ), Container( // padding: const EdgeInsets.all(10), - padding: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0), + padding: const EdgeInsets.symmetric( + horizontal: 4.0, + vertical: 4.0, + ), child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -2269,9 +2549,9 @@ class PolicyCriteriaState extends State { Spacer(), CustomTextFieldUserWrapper( width: - MediaQuery.of( - context, - ).size.width * + MediaQuery.of( + context, + ).size.width * 0.12, isFocused: false, isDesktop: widget.isDesktop, @@ -2279,38 +2559,38 @@ class PolicyCriteriaState extends State { height: 35, child: DropdownSearch( selectedItem: - ThirdAmendApproverAction[ServiceId], + ThirdAmendApproverAction[ServiceId], // enabled: !isViewMode, popupProps: PopupProps.menu( // showSearchBox: true, fit: - FlexFit - .loose, // Allows flexible height + FlexFit + .loose, // Allows flexible height constraints: BoxConstraints( maxHeight: 250, ), itemBuilder: ( - context, - item, - isSelected, + context, + item, + isSelected, ) => Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0, - ), - child: Text( - item, - style: GoogleFonts.poppins( - fontSize: - 12, // 👈 Smaller text size here - color: - Colors - .black, // You can customize this + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: GoogleFonts.poppins( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), ), - ), - ), ), items: [ "Approval", @@ -2318,28 +2598,28 @@ class PolicyCriteriaState extends State { "None", ], dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: - InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5, + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), ), - ), - ), dropdownBuilder: (context, selectedItem) => - // Center-align selected item - Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B), - ), - ), + // Center-align selected item + Text( + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), onChanged: (String? newValue) { setState(() { @@ -2362,52 +2642,93 @@ class PolicyCriteriaState extends State { onTap: () { setState(() { SelectedParallelAmendProcess[ServiceId!] = - "3"; + "3"; }); print( "SelectedParallelAmendProcess - $SelectedParallelAmendProcess[ServiceId]", ); }, - child: Container( - height: 25, - width: 25, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: - ((SelectedParallelAmendProcess[ServiceId] == - "1") || - (SelectedParallelAmendProcess[ServiceId] == - "2") || - (SelectedParallelAmendProcess[ServiceId] == - "3")) - ? Colors.green - : Colors.grey, - width: 2, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + // Circle icon + Container( + height: 25, + width: 25, + child: Icon( + Icons.circle, + size: 15, + color: + ((SelectedParallelAmendProcess[ServiceId] == + "1") || + (SelectedParallelAmendProcess[ServiceId] == + "2") || + (SelectedParallelAmendProcess[ServiceId] == + "3")) + ? Colors.green + : Colors.grey, + ), ), - ), - child: Icon( - Icons.check_circle, - size: 20, - color: - ((SelectedParallelAmendProcess[ServiceId] == - "1") || - (SelectedParallelAmendProcess[ServiceId] == - "2") || - (SelectedParallelAmendProcess[ServiceId] == - "3")) - ? Colors.green - : Colors.grey, - // color: Colors.grey, - ), + Icon( + Icons.arrow_downward_sharp, + size: 16, + color: + ((SelectedParallelAmendProcess[ServiceId] == + "1") || + (SelectedParallelAmendProcess[ServiceId] == + "2") || + (SelectedParallelAmendProcess[ServiceId] == + "3")) + ? Colors.green + : Colors.grey, + ), + + // Bottom line + ], ), + // child: Container( + // height: 25, + // width: 25, + // // decoration: BoxDecoration( + // // shape: BoxShape.circle, + // // border: Border.all( + // // color: + // // ((SelectedParallelAmendProcess[ServiceId] == + // // "1") || + // // (SelectedParallelAmendProcess[ServiceId] == + // // "2") || + // // (SelectedParallelAmendProcess[ServiceId] == + // // "3")) + // // ? Colors.green + // // : Colors.grey, + // // width: 2, + // // ), + // // ), + // child: Icon( + // Icons.circle, + // size: 20, + // color: + // ((SelectedParallelAmendProcess[ServiceId] == + // "1") || + // (SelectedParallelAmendProcess[ServiceId] == + // "2") || + // (SelectedParallelAmendProcess[ServiceId] == + // "3")) + // ? Colors.green + // : Colors.grey, + // // color: Colors.grey, + // ), + // ), ), ], ), ), Container( // padding: const EdgeInsets.all(10), - padding: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0), + padding: const EdgeInsets.symmetric( + horizontal: 4.0, + vertical: 4.0, + ), child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -2420,9 +2741,9 @@ class PolicyCriteriaState extends State { Spacer(), CustomTextFieldUserWrapper( width: - MediaQuery.of( - context, - ).size.width * + MediaQuery.of( + context, + ).size.width * 0.12, isFocused: false, isDesktop: widget.isDesktop, @@ -2430,38 +2751,38 @@ class PolicyCriteriaState extends State { height: 35, child: DropdownSearch( selectedItem: - FourthAmendApproverAction[ServiceId], + FourthAmendApproverAction[ServiceId], // enabled: !isViewMode, popupProps: PopupProps.menu( // showSearchBox: true, fit: - FlexFit - .loose, // Allows flexible height + FlexFit + .loose, // Allows flexible height constraints: BoxConstraints( maxHeight: 250, ), itemBuilder: ( - context, - item, - isSelected, + context, + item, + isSelected, ) => Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0, - ), - child: Text( - item, - style: GoogleFonts.poppins( - fontSize: - 12, // 👈 Smaller text size here - color: - Colors - .black, // You can customize this + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: GoogleFonts.poppins( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), ), - ), - ), ), items: [ "Approval", @@ -2469,28 +2790,28 @@ class PolicyCriteriaState extends State { "None", ], dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: - InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5, + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), ), - ), - ), dropdownBuilder: (context, selectedItem) => - // Center-align selected item - Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B), - ), - ), + // Center-align selected item + Text( + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), onChanged: (String? newValue) { setState(() { @@ -2513,7 +2834,7 @@ class PolicyCriteriaState extends State { onTap: () { setState(() { SelectedParallelAmendProcess[ServiceId!] = - "4"; + "4"; }); print( "SelectedParallelAmendProcess - $SelectedParallelAmendProcess[ServiceId]", @@ -2522,37 +2843,37 @@ class PolicyCriteriaState extends State { child: Container( height: 25, width: 25, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: - ((SelectedParallelAmendProcess[ServiceId] == - "1") || - (SelectedParallelAmendProcess[ServiceId] == - "2") || - (SelectedParallelAmendProcess[ServiceId] == - "3") || - (SelectedParallelAmendProcess[ServiceId] == - "4")) - ? Colors.green - : Colors.grey, - width: 2, - ), - ), + // decoration: BoxDecoration( + // shape: BoxShape.circle, + // border: Border.all( + // color: + // ((SelectedParallelAmendProcess[ServiceId] == + // "1") || + // (SelectedParallelAmendProcess[ServiceId] == + // "2") || + // (SelectedParallelAmendProcess[ServiceId] == + // "3") || + // (SelectedParallelAmendProcess[ServiceId] == + // "4")) + // ? Colors.green + // : Colors.grey, + // width: 2, + // ), + // ), child: Icon( - Icons.check_circle, - size: 20, + Icons.circle, + size: 15, color: - ((SelectedParallelAmendProcess[ServiceId] == - "1") || - (SelectedParallelAmendProcess[ServiceId] == - "2") || - (SelectedParallelAmendProcess[ServiceId] == - "3") || - (SelectedParallelAmendProcess[ServiceId] == - "4")) - ? Colors.green - : Colors.grey, + ((SelectedParallelAmendProcess[ServiceId] == + "1") || + (SelectedParallelAmendProcess[ServiceId] == + "2") || + (SelectedParallelAmendProcess[ServiceId] == + "3") || + (SelectedParallelAmendProcess[ServiceId] == + "4")) + ? Colors.green + : Colors.grey, // color: Colors.grey, ), ), @@ -2624,15 +2945,14 @@ class PolicyCriteriaState extends State { }); List> dropdownItems = - purposeList - .map( - (item) => DropdownMenuItem( - value: item['dropdown_key'], - child: Text(item['dropdown_value']), - ), - ) - .toList(); - + purposeList + .map( + (item) => DropdownMenuItem( + value: item['dropdown_key'], + child: Text(item['dropdown_value']), + ), + ) + .toList(); if (dropdownItems.isEmpty) { dropdownItems.add( @@ -2725,96 +3045,96 @@ class PolicyCriteriaState extends State { height: 40, width: double.infinity, child: - (ServiceId!) != null && (isLoading || dropdownItems.isEmpty) - ? const Center(child: CircularProgressIndicator()) - : DropdownSearch>( - key: - classAction[(ServiceId!)] == null - ? UniqueKey() - : ValueKey(classAction[(ServiceId!)]), - items: purposeList.cast>(), + (ServiceId!) != null && (isLoading || dropdownItems.isEmpty) + ? const Center(child: CircularProgressIndicator()) + : DropdownSearch>( + key: + classAction[(ServiceId!)] == null + ? UniqueKey() + : ValueKey(classAction[(ServiceId!)]), + items: purposeList.cast>(), - // selectedItem: purposeList.firstWhere( - // (item) => item['dropdown_key'] == selectedClass, - // orElse: () => {}, - // ), - selectedItem: - classAction[(ServiceId!)] != null - ? purposeList.firstWhere( - (item) => - item['dropdown_key'] == - classAction[(ServiceId!)], - orElse: () => {}, - ) - : null, - itemAsString: (item) => item['dropdown_value'] ?? '', - popupProps: PopupProps.menu( - showSearchBox: false, - fit: FlexFit.loose, - menuProps: const MenuProps( - backgroundColor: Colors.white, - ), - itemBuilder: (context, item, isSelected) { - final bool isNotAllowed = - item['is_allowed'] == 'No'; - return Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 5, - ), - child: Text( - item['dropdown_value'] ?? '', - style: GoogleFonts.poppins( - fontSize: 12, - color: - isNotAllowed - ? Colors.redAccent - : Colors.black, + // selectedItem: purposeList.firstWhere( + // (item) => item['dropdown_key'] == selectedClass, + // orElse: () => {}, + // ), + selectedItem: + classAction[(ServiceId!)] != null + ? purposeList.firstWhere( + (item) => + item['dropdown_key'] == + classAction[(ServiceId!)], + orElse: () => {}, + ) + : null, + itemAsString: (item) => item['dropdown_value'] ?? '', + popupProps: PopupProps.menu( + showSearchBox: false, + fit: FlexFit.loose, + menuProps: const MenuProps( + backgroundColor: Colors.white, + ), + itemBuilder: (context, item, isSelected) { + final bool isNotAllowed = + item['is_allowed'] == 'No'; + return Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, + ), + child: Text( + item['dropdown_value'] ?? '', + style: GoogleFonts.poppins( + fontSize: 12, + color: + isNotAllowed + ? Colors.redAccent + : 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 + ? (Map? newValue) async { + setState(() { + classAction[(ServiceId!)] = + newValue?['dropdown_key']; + print( + "Selected Purpose: ${classAction[(ServiceId!)]}", + ); + }); + } + : null, ), - ); - }, - ), - 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 - ? (Map? newValue) async { - setState(() { - classAction[(ServiceId!)] = - newValue?['dropdown_key']; - print( - "Selected Purpose: ${classAction[(ServiceId!)]}", - ); - }); - } - : null, - ), ), ), ], @@ -2868,4 +3188,4 @@ class PolicyCriteriaState extends State { ], ); } -} \ No newline at end of file +}