From 86da658dcd2aa19ab9bdb04c28773ad4d61af2e7 Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Fri, 6 Jun 2025 11:49:17 +0530 Subject: [PATCH 1/2] latest commit 06-06-2025 --- pubspec.lock | 20 ++++++++++---------- pubspec.yaml | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 4e5e26c..6a829df 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -21,10 +21,10 @@ packages: dependency: transitive description: name: async - sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 + sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" url: "https://pub.dev" source: hosted - version: "2.12.0" + version: "2.13.0" bcrypt: dependency: "direct main" description: @@ -141,10 +141,10 @@ packages: dependency: transitive description: name: fake_async - sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.3.3" ffi: dependency: transitive description: @@ -433,18 +433,18 @@ packages: dependency: "direct main" description: name: intl - sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" url: "https://pub.dev" source: hosted - version: "0.19.0" + version: "0.20.2" leak_tracker: dependency: transitive description: name: leak_tracker - sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec + sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" url: "https://pub.dev" source: hosted - version: "10.0.8" + version: "10.0.9" leak_tracker_flutter_testing: dependency: transitive description: @@ -974,10 +974,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" + sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 url: "https://pub.dev" source: hosted - version: "14.3.1" + version: "15.0.0" web: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 6ef992f..a35d46d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -39,7 +39,7 @@ dependencies: responsive_builder: ^0.7.1 shared_preferences: ^2.5.2 easy_stepper: ^0.8.5+1 - intl: ^0.19.0 + intl: 0.20.2 dropdown_search: ^5.0.6 file_picker: ^10.0.0 bcrypt: ^1.1.3 From f663fd776f56124a18a7461ec3ad0571f4fb009f Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Fri, 6 Jun 2025 12:04:50 +0530 Subject: [PATCH 2/2] latest commit 06-06-2025 --- lib/Screens/plans/create_plans.dart | 13 +- lib/routes/custom_appBar.dart | 539 ++++++++++++++-------------- 2 files changed, 283 insertions(+), 269 deletions(-) diff --git a/lib/Screens/plans/create_plans.dart b/lib/Screens/plans/create_plans.dart index 3c6fb9e..b5d9ef3 100644 --- a/lib/Screens/plans/create_plans.dart +++ b/lib/Screens/plans/create_plans.dart @@ -1267,7 +1267,12 @@ class CreateNewPlansState extends State { ), ); - return ResponsiveBuilder( + return + + FocusTraversalGroup( + policy: OrderedTraversalPolicy(), // 👈 more predictable tab order + descendantsAreFocusable: true, + child: ResponsiveBuilder( builder: (context, sizingInfo) { bool isMobile = sizingInfo.isMobile; bool isDesktop = @@ -1627,7 +1632,11 @@ class CreateNewPlansState extends State { // ], // ) }, - ); + ) + // replace with your full form column + ); + + } // String? getSelectedCostCenterName() { diff --git a/lib/routes/custom_appBar.dart b/lib/routes/custom_appBar.dart index 8539d59..6b5ac2f 100644 --- a/lib/routes/custom_appBar.dart +++ b/lib/routes/custom_appBar.dart @@ -284,292 +284,297 @@ class _CustomAppBarState extends State { @override Widget build(BuildContext context) { - return AppBar( - backgroundColor: Colors.white, - surfaceTintColor: Colors.white, - // elevation: 3, - automaticallyImplyLeading: !widget.isDesktop, - iconTheme: IconThemeData( - color: layoutColor, // 👈 Set your desired icon color here - ), + return + FocusTraversalGroup( + descendantsAreFocusable: false, + child: + AppBar( + backgroundColor: Colors.white, + surfaceTintColor: Colors.white, + // elevation: 3, + automaticallyImplyLeading: !widget.isDesktop, + iconTheme: IconThemeData( + color: layoutColor, // 👈 Set your desired icon color here + ), - titleSpacing: 0, + titleSpacing: 0, - title: - !widget.isDesktop - ? Text('') - : Padding( + title: + !widget.isDesktop + ? Text('') + : Padding( + padding: EdgeInsets.symmetric( + horizontal: MediaQuery.of(context).size.width * 0.05, + ), + child: Row( + children: [ + Padding( + padding: const EdgeInsets.all(10), + + // padding: const EdgeInsets.symmetric(horizontal: 40, vertical: 10), + child: + selectedOrg?['logo'] != null + ? SizedBox( + height: 50, + child: ClipRect( + child: Image.network( + selectedOrg!['logo'], + width: 130, //130 + height: 80, //80 + fit: BoxFit.contain, + errorBuilder: (context, error, stackTrace) { + return const CircleAvatar( + radius: 20, + backgroundColor: Colors.redAccent, + child: Icon(Icons.error, size: 10), + ); + }, + ), + ), + ) + : const CircleAvatar( + radius: 20, + // backgroundColor: Colors.white, + child: Icon( + Icons.add_a_photo, + size: 10, + color: Colors.grey, + ), + ), + ), + SizedBox(width: MediaQuery.of(context).size.width * 0.18), + Container( + width: MediaQuery.of(context).size.width * 0.35, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + if (userData?["role"] == "Org Admin" || + userData?["role"] == "Travel Admin") + buildNavItem( + "Dashboard", + () => handleTabChange( + TabSelection.dashboard, + '/StatusDashboard', + ), + layoutColor!, + isSelected: selectedTab == TabSelection.dashboard, + icon: Icons.dashboard, + // icon: Icons.insights_outlined, + ), + if (userData?["role"] == "Org Admin" || + userData?["role"] == "Travel Admin") + const SizedBox(width: 20), + if (userData?["role"] == "Org Admin" || + userData?["role"] == "Travel Admin") + buildNavItem( + "All Trips", + () => handleTabChange( + TabSelection.allTrips, + '/listAllPlan', + ), + layoutColor!, + isSelected: selectedTab == TabSelection.allTrips, + icon: Icons.format_list_bulleted_rounded, + // icon: Icons.insights_outlined, + ), + if (userDetails["role"] != "Travel Agent") + const SizedBox(width: 20), + if (userData?["role"] == "Travel Agent") + buildNavItem( + "Trips", + () => handleTabChange( + TabSelection.myTrips, + '/listTravelAgentPlan', + ), + layoutColor!, + // () => context.go('/listTravelAgentPlan'), + isSelected: selectedTab == TabSelection.myTrips, + icon: Icons.shopping_bag_outlined, + // icon: Icons.request_page_outlined, + ), + if (userData?["role"] != "Travel Agent") // for others + buildNavItem( + "My Trips", + () => handleTabChange( + TabSelection.myTrips, + '/listPlan', + ), + layoutColor!, + // () => context.go('/listPlan'), + isSelected: selectedTab == TabSelection.myTrips, + icon: Icons.shopping_bag_outlined, + ), + const SizedBox(width: 20), + if (userData?["role"] != "Travel Agent") + buildNavItem( + "My Approvals", + + () => handleTabChange( + TabSelection.myApprovals, + '/ApprovalList', + ), + layoutColor!, + // () => context.go('/ApprovalList'), + isSelected: + selectedTab == TabSelection.myApprovals, + icon: Icons.verified_outlined, + ), + ], + ), + ), + Spacer(), + ], + ), + ), + actions: [ + Padding( padding: EdgeInsets.symmetric( horizontal: MediaQuery.of(context).size.width * 0.05, ), child: Row( children: [ - Padding( - padding: const EdgeInsets.all(10), + // if (userData?["role"] != "User") + Builder( + builder: + (context) => PopupMenuButton( + color: Colors.white, + padding: EdgeInsets.zero, + offset: const Offset(0, 50), // 👈 shift it 50 pixels down + onSelected: (String value) { + switch (value) { + case '/OrganizationSettings': + context.go('/OrganizationSettings'); + break; + // case '/OrganizationSetup': + // context.go('/OrganizationSetup'); + // break; + case '/listUser': + context.go('/listUser'); + break; + // case '/group': + // context.go('/group'); + // break; + // case '/department': + // context.go('/department'); + // break; + // case '/PolicyList': + // context.go('/PolicyList'); + // case '/getPerdiem': + // context.go('/getPerdiem'); + // case '/templateList': + // context.go('/templateList'); + // case '/template': + // context.go('/template'); - // padding: const EdgeInsets.symmetric(horizontal: 40, vertical: 10), - child: - selectedOrg?['logo'] != null - ? SizedBox( - height: 50, - child: ClipRect( - child: Image.network( - selectedOrg!['logo'], - width: 130, //130 - height: 80, //80 - fit: BoxFit.contain, - errorBuilder: (context, error, stackTrace) { - return const CircleAvatar( - radius: 20, - backgroundColor: Colors.redAccent, - child: Icon(Icons.error, size: 10), - ); + case '/CreateUserDetails': + context.go( + "/CreateUserDetails", + extra: { + "selectedUser": profileUserDetails, + "isEditProfile": true, + "isViewMode": false, }, + ); + case '/logout': + context.go('/'); + break; + } + }, + + // itemBuilder: (BuildContext context) => + // menuItems.map(buildMenuItem).toList(), + itemBuilder: (BuildContext context) { + // final isUser = userData?["role"] == "User"; + final role = userData?["role"]; + List> filteredItems; + + if (role == "User") { + filteredItems = + menuItems + .where( + (item) => + item['value'] == '/CreateUserDetails' || + item['value'] == '/logout', + ) + .toList(); + } else if (role == "Travel Agent") { + filteredItems = + menuItems + .where((item) => item['value'] == '/logout') + .toList(); + } else { + filteredItems = menuItems; + } + + // Create a new list starting with role display and divider + return [ + PopupMenuItem( + enabled: false, // ❌ Not clickable + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + userData?["role"] ?? '', + style: GoogleFonts.poppins( + fontSize: 12, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + const Divider(), // 👈 Divider after role + ], ), ), - ) - : const CircleAvatar( - radius: 20, - // backgroundColor: Colors.white, - child: Icon( - Icons.add_a_photo, - size: 10, - color: Colors.grey, - ), - ), - ), - SizedBox(width: MediaQuery.of(context).size.width * 0.18), - Container( - width: MediaQuery.of(context).size.width * 0.35, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - if (userData?["role"] == "Org Admin" || - userData?["role"] == "Travel Admin") - buildNavItem( - "Dashboard", - () => handleTabChange( - TabSelection.dashboard, - '/StatusDashboard', - ), - layoutColor!, - isSelected: selectedTab == TabSelection.dashboard, - icon: Icons.dashboard, - // icon: Icons.insights_outlined, - ), - if (userData?["role"] == "Org Admin" || - userData?["role"] == "Travel Admin") - const SizedBox(width: 20), - if (userData?["role"] == "Org Admin" || - userData?["role"] == "Travel Admin") - buildNavItem( - "All Trips", - () => handleTabChange( - TabSelection.allTrips, - '/listAllPlan', - ), - layoutColor!, - isSelected: selectedTab == TabSelection.allTrips, - icon: Icons.format_list_bulleted_rounded, - // icon: Icons.insights_outlined, - ), - if (userDetails["role"] != "Travel Agent") - const SizedBox(width: 20), - if (userData?["role"] == "Travel Agent") - buildNavItem( - "Trips", - () => handleTabChange( - TabSelection.myTrips, - '/listTravelAgentPlan', - ), - layoutColor!, - // () => context.go('/listTravelAgentPlan'), - isSelected: selectedTab == TabSelection.myTrips, - icon: Icons.shopping_bag_outlined, - // icon: Icons.request_page_outlined, - ), - if (userData?["role"] != "Travel Agent") // for others - buildNavItem( - "My Trips", - () => handleTabChange( - TabSelection.myTrips, - '/listPlan', - ), - layoutColor!, - // () => context.go('/listPlan'), - isSelected: selectedTab == TabSelection.myTrips, - icon: Icons.shopping_bag_outlined, - ), - const SizedBox(width: 20), - if (userData?["role"] != "Travel Agent") - buildNavItem( - "My Approvals", + ...filteredItems + .map(buildMenuItem) + .toList(), // 👈 then normal items + ]; + }, - () => handleTabChange( - TabSelection.myApprovals, - '/ApprovalList', + child: MouseRegion( + cursor: SystemMouseCursors.click, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + userData?["name"] ?? "N/A", + style: GoogleFonts.poppins( + fontSize: 14, + fontWeight: FontWeight.w500, + color: Colors.black, + ), + // style: const TextStyle( + // fontSize: 14, + // fontWeight: FontWeight.w500, + // fontFamily: "Roboto", + // color: Colors.black, + // ), + ), + const Icon( + Icons.arrow_drop_down, + size: 20, + color: Colors.black87, + ), + ], ), - layoutColor!, - // () => context.go('/ApprovalList'), - isSelected: - selectedTab == TabSelection.myApprovals, - icon: Icons.verified_outlined, ), - ], - ), + ), ), - Spacer(), + const SizedBox(width: 8), ], ), ), - actions: [ - Padding( - padding: EdgeInsets.symmetric( - horizontal: MediaQuery.of(context).size.width * 0.05, - ), - child: Row( - children: [ - // if (userData?["role"] != "User") - Builder( - builder: - (context) => PopupMenuButton( - color: Colors.white, - padding: EdgeInsets.zero, - offset: const Offset(0, 50), // 👈 shift it 50 pixels down - onSelected: (String value) { - switch (value) { - case '/OrganizationSettings': - context.go('/OrganizationSettings'); - break; - // case '/OrganizationSetup': - // context.go('/OrganizationSetup'); - // break; - case '/listUser': - context.go('/listUser'); - break; - // case '/group': - // context.go('/group'); - // break; - // case '/department': - // context.go('/department'); - // break; - // case '/PolicyList': - // context.go('/PolicyList'); - // case '/getPerdiem': - // context.go('/getPerdiem'); - // case '/templateList': - // context.go('/templateList'); - // case '/template': - // context.go('/template'); - - case '/CreateUserDetails': - context.go( - "/CreateUserDetails", - extra: { - "selectedUser": profileUserDetails, - "isEditProfile": true, - "isViewMode": false, - }, - ); - case '/logout': - context.go('/'); - break; - } - }, - - // itemBuilder: (BuildContext context) => - // menuItems.map(buildMenuItem).toList(), - itemBuilder: (BuildContext context) { - // final isUser = userData?["role"] == "User"; - final role = userData?["role"]; - List> filteredItems; - - if (role == "User") { - filteredItems = - menuItems - .where( - (item) => - item['value'] == '/CreateUserDetails' || - item['value'] == '/logout', - ) - .toList(); - } else if (role == "Travel Agent") { - filteredItems = - menuItems - .where((item) => item['value'] == '/logout') - .toList(); - } else { - filteredItems = menuItems; - } - - // Create a new list starting with role display and divider - return [ - PopupMenuItem( - enabled: false, // ❌ Not clickable - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - userData?["role"] ?? '', - style: GoogleFonts.poppins( - fontSize: 12, - fontWeight: FontWeight.bold, - color: Colors.black, - ), - ), - const Divider(), // 👈 Divider after role - ], - ), - ), - ...filteredItems - .map(buildMenuItem) - .toList(), // 👈 then normal items - ]; - }, - - child: MouseRegion( - cursor: SystemMouseCursors.click, - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - userData?["name"] ?? "N/A", - style: GoogleFonts.poppins( - fontSize: 14, - fontWeight: FontWeight.w500, - color: Colors.black, - ), - // style: const TextStyle( - // fontSize: 14, - // fontWeight: FontWeight.w500, - // fontFamily: "Roboto", - // color: Colors.black, - // ), - ), - const Icon( - Icons.arrow_drop_down, - size: 20, - color: Colors.black87, - ), - ], - ), - ), - ), - ), - const SizedBox(width: 8), ], - ), - ), - ], - bottom: PreferredSize( - preferredSize: Size.fromHeight(1), - child: Container( - height: 1, - // color: Colors.grey.shade200, // Set the color of the bottom border - color: layoutColor, // Set the color of the bottom border - ), - ), - ); + bottom: PreferredSize( + preferredSize: Size.fromHeight(1), + child: Container( + height: 1, + // color: Colors.grey.shade200, // Set the color of the bottom border + color: layoutColor, // Set the color of the bottom border + ), + ), + ) + ); } @override