latest commit 06-06-2025
This commit is contained in:
parent
ef79391915
commit
f663fd776f
@ -1267,7 +1267,12 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
||||
),
|
||||
);
|
||||
|
||||
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<CreateNewPlan> {
|
||||
// ],
|
||||
// )
|
||||
},
|
||||
);
|
||||
)
|
||||
// replace with your full form column
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// String? getSelectedCostCenterName() {
|
||||
|
||||
@ -284,292 +284,297 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
||||
|
||||
@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<String>(
|
||||
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<Map<String, dynamic>> 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<String>(
|
||||
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<String>(
|
||||
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<Map<String, dynamic>> 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<String>(
|
||||
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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user