FIX_UI
This commit is contained in:
parent
88e65c0923
commit
40de0e49e8
@ -280,7 +280,10 @@ class _AddDialogState extends State<AddDialog> {
|
||||
color: const Color(0xFFF1F1F1),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
child: const Icon(Icons.close, size: 18),
|
||||
child: Tooltip(
|
||||
message: 'Close',
|
||||
child: const Icon(Icons.close, size: 18),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@ -569,7 +569,9 @@ class PolicyTabState extends ConsumerState<PolicyTab> {
|
||||
}
|
||||
|
||||
Widget _actionEnroll(BuildContext context) {
|
||||
return IconButton(
|
||||
return Tooltip(
|
||||
message: 'Add Endorsement',
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
@ -587,11 +589,13 @@ class PolicyTabState extends ConsumerState<PolicyTab> {
|
||||
);
|
||||
},
|
||||
icon: Icon(Icons.add),
|
||||
);
|
||||
),);
|
||||
}
|
||||
|
||||
Widget _actionClaims(BuildContext context) {
|
||||
return IconButton(
|
||||
return Tooltip(
|
||||
message: 'Add Claim',
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
@ -609,6 +613,7 @@ class PolicyTabState extends ConsumerState<PolicyTab> {
|
||||
);
|
||||
},
|
||||
icon: Icon(Icons.add),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -418,10 +418,16 @@ class TabEnquiryListState extends ConsumerState<TabEnquiryList> {
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.arrow_left_sharp,
|
||||
size: 35,
|
||||
color: Color(0xFF425B5B),
|
||||
Tooltip(
|
||||
message: 'Back',
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.arrow_left_sharp,size: 35,color: Color(0xFF425B5B)),
|
||||
onPressed: () { ref.read(enquiryIdProvider.notifier).state = null; context.go(AppRoutes.enquiryLst); },
|
||||
splashRadius: 28,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(8),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
|
||||
@ -350,7 +350,7 @@ class EnquiryListState extends ConsumerState<EnquiryList> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
height: 30,
|
||||
height: 40,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
@ -360,11 +360,27 @@ class EnquiryListState extends ConsumerState<EnquiryList> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_left_sharp,
|
||||
size: ResponsiveLayout.isMobile(context) ? 25 : 35,
|
||||
color: Color(0xFF425B5B),
|
||||
// Icon(
|
||||
// Icons.arrow_left_sharp,
|
||||
// size: ResponsiveLayout.isMobile(context) ? 25 : 35,
|
||||
// color: Color(0xFF425B5B),
|
||||
// ),
|
||||
Tooltip(
|
||||
message: 'Back',
|
||||
child: IconButton(
|
||||
icon: Icon(
|
||||
Icons.arrow_left_sharp,
|
||||
size: ResponsiveLayout.isMobile(context) ? 25 : 25,
|
||||
color: const Color(0xFF425B5B),
|
||||
),
|
||||
onPressed: () { context.go(AppRoutes.dashboard); },
|
||||
splashRadius: 18,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(4),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5), // spacing between icon and text
|
||||
Text(
|
||||
"Enquiries",
|
||||
style: GoogleFonts.inter(
|
||||
@ -764,7 +780,7 @@ class EnquiryListState extends ConsumerState<EnquiryList> {
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// Navigator.pop(context);
|
||||
// print('EDITStaff - ${item['id']}');
|
||||
@ -778,15 +794,32 @@ class EnquiryListState extends ConsumerState<EnquiryList> {
|
||||
//
|
||||
// context.go(AppRoutes.tabEnquiry);
|
||||
// },
|
||||
onTap: () {
|
||||
handleEdit(item);
|
||||
},
|
||||
child: Image.asset(
|
||||
"assets/miscellaneous/Edit.png",
|
||||
height: 15,
|
||||
width: 15,
|
||||
// onTap: () {
|
||||
// handleEdit(item);
|
||||
// },
|
||||
// child: Image.asset(
|
||||
// "assets/miscellaneous/Edit.png",
|
||||
// height: 15,
|
||||
// width: 15,
|
||||
// ),
|
||||
// ),
|
||||
Tooltip(
|
||||
message: 'Edit',
|
||||
child: IconButton(
|
||||
icon: Image.asset(
|
||||
"assets/miscellaneous/Edit.png",
|
||||
height: 15,
|
||||
width: 15,
|
||||
),
|
||||
onPressed: () {
|
||||
handleEdit(item);
|
||||
},
|
||||
splashRadius: 28,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(8),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -845,29 +878,46 @@ class EnquiryListState extends ConsumerState<EnquiryList> {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(item['reg_no'] ?? '-', style: _headerStyle),
|
||||
GestureDetector(
|
||||
// onTap: () {
|
||||
// Navigator.pop(context);
|
||||
// print('EDITStaff - ${item['id']}');
|
||||
// // dynamic id = data['id'];
|
||||
// // context.go('/tabEnquiry/$id');
|
||||
// setState(() {
|
||||
// final id = item['id'].toString();
|
||||
// ref.read(enquiryIdProvider.notifier).state = id;
|
||||
// });
|
||||
// // update provider
|
||||
//
|
||||
// context.go(AppRoutes.tabEnquiry);
|
||||
// },
|
||||
onTap: () {
|
||||
handleEdit(item);
|
||||
},
|
||||
child: Image.asset(
|
||||
"assets/miscellaneous/Edit.png",
|
||||
height: 15,
|
||||
width: 15,
|
||||
Tooltip(
|
||||
message: 'Edit',
|
||||
child: IconButton(
|
||||
icon: Image.asset(
|
||||
"assets/miscellaneous/Edit.png",
|
||||
height: 15,
|
||||
width: 15,
|
||||
),
|
||||
onPressed: () {
|
||||
handleEdit(item);
|
||||
},
|
||||
splashRadius: 28,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(8),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
)
|
||||
// GestureDetector(
|
||||
// // onTap: () {
|
||||
// // Navigator.pop(context);
|
||||
// // print('EDITStaff - ${item['id']}');
|
||||
// // // dynamic id = data['id'];
|
||||
// // // context.go('/tabEnquiry/$id');
|
||||
// // setState(() {
|
||||
// // final id = item['id'].toString();
|
||||
// // ref.read(enquiryIdProvider.notifier).state = id;
|
||||
// // });
|
||||
// // // update provider
|
||||
// //
|
||||
// // context.go(AppRoutes.tabEnquiry);
|
||||
// // },
|
||||
// onTap: () {
|
||||
// handleEdit(item);
|
||||
// },
|
||||
// child: Image.asset(
|
||||
// "assets/miscellaneous/Edit.png",
|
||||
// height: 15,
|
||||
// width: 15,
|
||||
// ),
|
||||
// ),
|
||||
// PopupMenuButton<int>(
|
||||
// color: Colors.white,
|
||||
// padding: EdgeInsets.zero,
|
||||
|
||||
@ -178,7 +178,7 @@ class claimListState extends ConsumerState<claimList> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
height: 30,
|
||||
height: 40,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
@ -188,11 +188,18 @@ class claimListState extends ConsumerState<claimList> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_left_sharp,
|
||||
size: 35,
|
||||
color: Color(0xFF425B5B),
|
||||
Tooltip(
|
||||
message: 'Back',
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.arrow_left_sharp,size: 25,color: Color(0xFF425B5B)),
|
||||
onPressed: () { context.go(AppRoutes.dashboard); },
|
||||
splashRadius: 18,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(4),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5), // spacing between icon and text
|
||||
Text(
|
||||
"Claims",
|
||||
style: GoogleFonts.inter(
|
||||
|
||||
@ -174,7 +174,7 @@ class endosementState extends ConsumerState<endosement> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
height: 30,
|
||||
height: 40,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
@ -184,11 +184,18 @@ class endosementState extends ConsumerState<endosement> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_left_sharp,
|
||||
size: 35,
|
||||
color: Color(0xFF425B5B),
|
||||
Tooltip(
|
||||
message: 'Back',
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.arrow_left_sharp,size: 25,color: Color(0xFF425B5B)),
|
||||
onPressed: () { context.go(AppRoutes.dashboard); },
|
||||
splashRadius: 18,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(4),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5), // spacing between icon and text
|
||||
Text(
|
||||
"Endorsement",
|
||||
style: GoogleFonts.inter(
|
||||
|
||||
@ -344,11 +344,18 @@ class AgentState extends ConsumerState<Agent> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_left_sharp,
|
||||
size: 35,
|
||||
color: Color(0xFF425B5B),
|
||||
Tooltip(
|
||||
message: 'Back',
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.arrow_left_sharp,size: 25,color: Color(0xFF425B5B)),
|
||||
onPressed: () { context.go(AppRoutes.agentLst); },
|
||||
splashRadius: 18,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(4),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5), // spacing between icon and text
|
||||
Text(
|
||||
"Agent",
|
||||
style: TextStyle(
|
||||
|
||||
@ -389,18 +389,31 @@ class UploadIncentiveModalState extends ConsumerState<UploadIncentiveModal> {
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
refresh();
|
||||
},
|
||||
icon: Icon(Icons.refresh),
|
||||
Tooltip(
|
||||
message: 'Refresh',
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.refresh, size: 20, color: Color(0xFF425B5B)),
|
||||
onPressed: () {
|
||||
refresh();
|
||||
},
|
||||
splashRadius: 28,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(8),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
icon: Icon(Icons.close),
|
||||
Tooltip(
|
||||
message: 'Close',
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.close, size: 20, color: Color(0xFF425B5B)),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
splashRadius: 28,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(8),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@ -175,11 +175,18 @@ class AgentListState extends ConsumerState<AgentList> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_left_sharp,
|
||||
size: 35,
|
||||
color: Color(0xFF425B5B),
|
||||
Tooltip(
|
||||
message: 'Back',
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.arrow_left_sharp,size: 25,color: Color(0xFF425B5B)),
|
||||
onPressed: () { context.go(AppRoutes.dashboard); },
|
||||
splashRadius: 18,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(4),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5), // spacing between icon and text
|
||||
Text(
|
||||
"Agent",
|
||||
style: TextStyle(
|
||||
@ -493,17 +500,23 @@ class AgentListState extends ConsumerState<AgentList> {
|
||||
child: item['is_active'] == "1"
|
||||
? Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
// Navigator.pop(context);
|
||||
print('EDITStaff - ${item['id']}');
|
||||
dynamic id = item['id'];
|
||||
context.go('/agent/$id');
|
||||
},
|
||||
child: Image.asset(
|
||||
"assets/miscellaneous/Edit.png",
|
||||
height: 15,
|
||||
width: 15,
|
||||
Tooltip(
|
||||
message: 'Edit',
|
||||
child: IconButton(
|
||||
icon: Image.asset(
|
||||
"assets/miscellaneous/Edit.png",
|
||||
height: 15,
|
||||
width: 15,
|
||||
),
|
||||
onPressed: () {
|
||||
print('EDITStaff - ${item['id']}');
|
||||
dynamic id = item['id'];
|
||||
context.go('/agent/$id');
|
||||
},
|
||||
splashRadius: 28,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(8),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@ -429,7 +429,10 @@ class ProfileState extends ConsumerState<Profile> {
|
||||
onTap: () {
|
||||
Navigator.of(context).pop(); // closes the popup
|
||||
},
|
||||
child: const Icon(Icons.close, size: 18),
|
||||
child: Tooltip(
|
||||
message: 'Close',
|
||||
child: const Icon(Icons.close, size: 18),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@ -171,7 +171,10 @@ class ProfilePopUpState extends ConsumerState<ProfilePopUp> {
|
||||
onTap: () {
|
||||
Navigator.of(context).pop(); // closes the popup
|
||||
},
|
||||
child: const Icon(Icons.close, size: 18),
|
||||
child: Tooltip(
|
||||
message: 'Close',
|
||||
child: const Icon(Icons.close, size: 18),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@ -232,11 +232,18 @@ class StaffState extends ConsumerState<Staff> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_left_sharp,
|
||||
size: 35,
|
||||
color: Color(0xFF425B5B),
|
||||
Tooltip(
|
||||
message: 'Back',
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.arrow_left_sharp,size: 35,color: Color(0xFF425B5B)),
|
||||
onPressed: () { context.go(AppRoutes.staffLst); },
|
||||
splashRadius: 28,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(8),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5), // spacing between icon and text
|
||||
Text(
|
||||
"Staff",
|
||||
style: TextStyle(
|
||||
|
||||
@ -176,11 +176,23 @@ class StaffListState extends ConsumerState<StaffList> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_left_sharp,
|
||||
size: 35,
|
||||
color: Color(0xFF425B5B),
|
||||
// Icon(
|
||||
// Icons.arrow_left_sharp,
|
||||
// size: 35,
|
||||
// color: Color(0xFF425B5B),
|
||||
// ),
|
||||
Tooltip(
|
||||
message: 'Back',
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.arrow_left_sharp,size: 25,color: Color(0xFF425B5B)),
|
||||
onPressed: () { context.go(AppRoutes.dashboard); },
|
||||
splashRadius: 18,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(4),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5), // spacing between icon and text
|
||||
Text(
|
||||
"Staff",
|
||||
style: TextStyle(
|
||||
@ -444,17 +456,36 @@ class StaffListState extends ConsumerState<StaffList> {
|
||||
child: item['is_active'] == "1"
|
||||
? Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
// Navigator.pop(context);
|
||||
print('EDITStaff - ${item['id']}');
|
||||
dynamic id = item['id'];
|
||||
context.go('/staff/$id');
|
||||
},
|
||||
child: Image.asset(
|
||||
"assets/miscellaneous/Edit.png",
|
||||
height: 15,
|
||||
width: 15,
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// // Navigator.pop(context);
|
||||
// print('EDITStaff - ${item['id']}');
|
||||
// dynamic id = item['id'];
|
||||
// context.go('/staff/$id');
|
||||
// },
|
||||
// child: Image.asset(
|
||||
// "assets/miscellaneous/Edit.png",
|
||||
// height: 15,
|
||||
// width: 15,
|
||||
// ),
|
||||
// ),
|
||||
Tooltip(
|
||||
message: 'Edit',
|
||||
child: IconButton(
|
||||
icon: Image.asset(
|
||||
"assets/miscellaneous/Edit.png",
|
||||
height: 15,
|
||||
width: 15,
|
||||
),
|
||||
onPressed: () {
|
||||
print('EDITStaff - ${item['id']}');
|
||||
dynamic id = item['id'];
|
||||
context.go('/staff/$id');
|
||||
},
|
||||
splashRadius: 28,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(8),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@ -435,7 +435,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryStaff> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
height: 30,
|
||||
height: 40,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
@ -445,11 +445,20 @@ class EnquiryStaffState extends ConsumerState<EnquiryStaff> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_left_sharp,
|
||||
size: 35,
|
||||
color: Color(0xFF425B5B),
|
||||
Tooltip(
|
||||
message: 'Back',
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.arrow_left_sharp),
|
||||
onPressed: () {
|
||||
context.go(AppRoutes.dashboard);
|
||||
},
|
||||
splashRadius: 28,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(8),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5), // spacing between icon and text
|
||||
Text(
|
||||
"Enquiries",
|
||||
style: TextStyle(
|
||||
@ -461,7 +470,6 @@ class EnquiryStaffState extends ConsumerState<EnquiryStaff> {
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 10),
|
||||
ResponsiveLayout.isMobile(context)
|
||||
? Container(
|
||||
|
||||
@ -213,7 +213,10 @@ class _AddDialogState extends State<AssignStaffDialog> {
|
||||
color: const Color(0xFFF1F1F1),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
child: const Icon(Icons.close, size: 18),
|
||||
child: Tooltip(
|
||||
message: 'Close',
|
||||
child: const Icon(Icons.close, size: 18),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -246,7 +249,10 @@ class _AddDialogState extends State<AssignStaffDialog> {
|
||||
color: const Color(0xFFF1F1F1),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
child: const Icon(Icons.close, size: 18),
|
||||
child: Tooltip(
|
||||
message: 'Close',
|
||||
child: const Icon(Icons.close, size: 18),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@ -526,7 +526,7 @@ class PolicyScreenState extends ConsumerState<PolicyScreen> {
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 30,
|
||||
height: 40,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
@ -536,11 +536,18 @@ class PolicyScreenState extends ConsumerState<PolicyScreen> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_left_sharp,
|
||||
size: 35,
|
||||
color: Color(0xFF425B5B),
|
||||
Tooltip(
|
||||
message: 'Back',
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.arrow_left_sharp,size: 25,color: Color(0xFF425B5B)),
|
||||
onPressed: () { context.go(AppRoutes.enquiryForStaff); },
|
||||
splashRadius: 18,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(4),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5), // spacing between icon and text
|
||||
Text(
|
||||
"Policy",
|
||||
style: GoogleFonts.inter(
|
||||
|
||||
@ -302,12 +302,14 @@ class policylistState extends ConsumerState<policylist> {
|
||||
child: Row(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/miscellaneous/image_1.png",
|
||||
height: 15,
|
||||
width: 15,
|
||||
Tooltip(
|
||||
message: "Close",
|
||||
child: Image.asset(
|
||||
"assets/miscellaneous/image_1.png",
|
||||
height: 15,
|
||||
width: 15,
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(width: 10),
|
||||
((data['status'] == 'Policy Created') ||
|
||||
(data['status'] == 'Quotation Accepted'))
|
||||
@ -367,7 +369,7 @@ class policylistState extends ConsumerState<policylist> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
height: 30,
|
||||
height: 40,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
@ -377,11 +379,18 @@ class policylistState extends ConsumerState<policylist> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_left_sharp,
|
||||
size: 35,
|
||||
color: Color(0xFF425B5B),
|
||||
Tooltip(
|
||||
message: 'Back',
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.arrow_left_sharp,size: 25,color: Color(0xFF425B5B)),
|
||||
onPressed: () { context.go(AppRoutes.dashboard); },
|
||||
splashRadius: 18,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(4),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5), // spacing between icon and text
|
||||
Text(
|
||||
"Policy",
|
||||
style: GoogleFonts.inter(
|
||||
|
||||
@ -341,7 +341,10 @@ class createQuotatDialogState extends State<createQuotatDialog> {
|
||||
color: const Color(0xFFF1F1F1),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
child: const Icon(Icons.close, size: 18),
|
||||
child: Tooltip(
|
||||
message: 'Close',
|
||||
child: const Icon(Icons.close, size: 18),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@ -292,11 +292,18 @@ class QuotationScreenState extends ConsumerState<QuotationScreen> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_left_sharp,
|
||||
size: 35,
|
||||
color: Color(0xFF425B5B),
|
||||
Tooltip(
|
||||
message: 'Back',
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.arrow_left_sharp,size: 20,color: Color(0xFF425B5B)),
|
||||
onPressed: () { context.go(AppRoutes.enquiryForStaff); },
|
||||
splashRadius: 9,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(4),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5), // spacing between icon and text
|
||||
Text(
|
||||
"Quotation",
|
||||
style: GoogleFonts.inter(
|
||||
@ -820,18 +827,37 @@ class QuotationScreenState extends ConsumerState<QuotationScreen> {
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: item['status'] == 'Pending'
|
||||
? GestureDetector(
|
||||
onTap: () {
|
||||
final id = item['id'];
|
||||
print('RAV - $id');
|
||||
handleEdit(id, item);
|
||||
},
|
||||
child: Image.asset(
|
||||
"assets/miscellaneous/Edit.png",
|
||||
height: 15,
|
||||
width: 15,
|
||||
),
|
||||
)
|
||||
// ? GestureDetector(
|
||||
// onTap: () {
|
||||
// final id = item['id'];
|
||||
// print('RAV - $id');
|
||||
// handleEdit(id, item);
|
||||
// },
|
||||
// child: Image.asset(
|
||||
// "assets/miscellaneous/Edit.png",
|
||||
// height: 15,
|
||||
// width: 15,
|
||||
// ),
|
||||
// )
|
||||
? Tooltip(
|
||||
message: 'Edit',
|
||||
child: IconButton(
|
||||
icon: Image.asset(
|
||||
"assets/miscellaneous/Edit.png",
|
||||
height: 15,
|
||||
width: 15,
|
||||
),
|
||||
onPressed: () {
|
||||
final id = item['id'];
|
||||
print('RAV - $id');
|
||||
handleEdit(id, item);
|
||||
},
|
||||
splashRadius: 20,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(8),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
)
|
||||
: Image.asset(
|
||||
"assets/miscellaneous/Edit_muted.png",
|
||||
height: 15,
|
||||
@ -886,18 +912,37 @@ class QuotationScreenState extends ConsumerState<QuotationScreen> {
|
||||
style: _cardheaderStyle,
|
||||
),
|
||||
item['status'] == 'Pending'
|
||||
? GestureDetector(
|
||||
onTap: () {
|
||||
final id = item['id'];
|
||||
print('RAV - $id');
|
||||
handleEdit(id, item);
|
||||
},
|
||||
child: Image.asset(
|
||||
// ? GestureDetector(
|
||||
// onTap: () {
|
||||
// final id = item['id'];
|
||||
// print('RAV - $id');
|
||||
// handleEdit(id, item);
|
||||
// },
|
||||
// child: Image.asset(
|
||||
// "assets/miscellaneous/Edit.png",
|
||||
// height: 15,
|
||||
// width: 15,
|
||||
// ),
|
||||
// )
|
||||
? Tooltip(
|
||||
message: 'Edit',
|
||||
child: IconButton(
|
||||
icon: Image.asset(
|
||||
"assets/miscellaneous/Edit.png",
|
||||
height: 15,
|
||||
width: 15,
|
||||
),
|
||||
)
|
||||
onPressed: () {
|
||||
final id = item['id'];
|
||||
print('RAV - $id');
|
||||
handleEdit(id, item);
|
||||
},
|
||||
splashRadius: 28,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(8),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
)
|
||||
: Image.asset(
|
||||
"assets/miscellaneous/Edit_muted.png",
|
||||
height: 15,
|
||||
|
||||
@ -56,16 +56,34 @@ class DateFilterRow extends StatelessWidget {
|
||||
final buttons = [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
if (formKey.currentState!.validate()) onFilter();
|
||||
},
|
||||
child: Icon(Icons.filter_alt_outlined),
|
||||
// child: GestureDetector(
|
||||
// onTap: () {
|
||||
// if (formKey.currentState!.validate()) onFilter();
|
||||
// },
|
||||
// child: Icon(Icons.filter_alt_outlined),
|
||||
// ),
|
||||
child: Tooltip(
|
||||
message: 'Filter',
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.filter_alt_outlined),
|
||||
onPressed: () {
|
||||
if (formKey.currentState!.validate()) {
|
||||
onFilter();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: GestureDetector(onTap: onRefresh, child: Icon(Icons.refresh)),
|
||||
// child: GestureDetector(onTap: onRefresh, child: Icon(Icons.refresh)),
|
||||
child: Tooltip(
|
||||
message: 'Refresh',
|
||||
child: IconButton(
|
||||
onPressed: onRefresh,
|
||||
icon: const Icon(Icons.refresh),
|
||||
),
|
||||
),
|
||||
),
|
||||
];
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@ import 'package:google_fonts/google_fonts.dart';
|
||||
import '../../core/routing/routes.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import '../providers/manager_provider.dart';
|
||||
import '../providers/userRoleProvider.dart';
|
||||
import 'drawerContentWrapper.dart';
|
||||
|
||||
@ -18,17 +17,15 @@ class DrawerMenuState extends ConsumerState<DrawerMenu> {
|
||||
OverlayEntry? _overlayEntry;
|
||||
|
||||
void _showPopup(BuildContext context, Offset offset, Size size, String key) {
|
||||
_hidePopup(); // clear old one before creating new
|
||||
_hidePopup(); // remove previous popup
|
||||
|
||||
_overlayEntry = OverlayEntry(
|
||||
builder: (context) {
|
||||
builder: (_) {
|
||||
return Positioned(
|
||||
left: offset.dx + size.width - 5, // little spacing
|
||||
left: offset.dx + size.width - 5,
|
||||
top: offset.dy + (size.height / 2) - 20,
|
||||
// left: offset.dx + size.width,
|
||||
// top: offset.dy,
|
||||
child: MouseRegion(
|
||||
onExit: (_) => _hidePopup(),
|
||||
onExit: (_) => _hidePopup(), // hide when mouse leaves popup
|
||||
child: Material(
|
||||
elevation: 4,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
@ -37,12 +34,10 @@ class DrawerMenuState extends ConsumerState<DrawerMenu> {
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
color: const Color(0xFFDDF5F1),
|
||||
// color: Colors.white,
|
||||
),
|
||||
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (key == 'User') ...[
|
||||
_buildPopupItem(
|
||||
@ -71,109 +66,6 @@ class DrawerMenuState extends ConsumerState<DrawerMenu> {
|
||||
onTap: () => context.go(AppRoutes.policylist),
|
||||
),
|
||||
],
|
||||
|
||||
// if (key == 'User') ...[
|
||||
// Row(
|
||||
// children: [
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// print("Tappped Agent");
|
||||
// context.go(AppRoutes.agentLst);
|
||||
// },
|
||||
// child: Text("Agent", style: _cardTextStyle),
|
||||
// ),
|
||||
//
|
||||
// Icon(
|
||||
// Icons.arrow_forward_ios_rounded,
|
||||
// size: 12,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// const SizedBox(height: 5),
|
||||
// Row(
|
||||
// children: [
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// print("Bf clicked");
|
||||
// context.go(AppRoutes.staffLst);
|
||||
// },
|
||||
// child: Text("Staff", style: _cardTextStyle),
|
||||
// ),
|
||||
//
|
||||
// Icon(
|
||||
// Icons.arrow_forward_ios_rounded,
|
||||
// size: 12,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
//
|
||||
// if (key == 'Reports') ...[
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// context.go(AppRoutes.claimlist);
|
||||
// },
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text("Claims", style: _cardTextStyle),
|
||||
// Icon(
|
||||
// Icons.arrow_forward_ios_rounded,
|
||||
// size: 12,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// // const SizedBox(height: 5),
|
||||
// // GestureDetector(
|
||||
// // onTap: () {
|
||||
// // context.go(AppRoutes.enquiryLst);
|
||||
// // },
|
||||
// // child: const Text(
|
||||
// // "Enquiries",
|
||||
// // style: TextStyle(
|
||||
// // fontSize: 16,
|
||||
// // fontWeight: FontWeight.w400,
|
||||
// // ),
|
||||
// // ),
|
||||
// // ),
|
||||
// const SizedBox(height: 5),
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// context.go(AppRoutes.endosement);
|
||||
// },
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text("Endorsement", style: _cardTextStyle),
|
||||
//
|
||||
// Icon(
|
||||
// Icons.arrow_forward_ios_rounded,
|
||||
// size: 12,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(height: 5),
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// context.go(AppRoutes.policylist);
|
||||
// },
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text("Policy", style: _cardTextStyle),
|
||||
//
|
||||
// Icon(
|
||||
// Icons.arrow_forward_ios_rounded,
|
||||
// size: 12,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -183,8 +75,7 @@ class DrawerMenuState extends ConsumerState<DrawerMenu> {
|
||||
},
|
||||
);
|
||||
|
||||
final overlay = Overlay.of(context, rootOverlay: true);
|
||||
overlay?.insert(_overlayEntry!);
|
||||
Overlay.of(context, rootOverlay: true)?.insert(_overlayEntry!);
|
||||
}
|
||||
|
||||
void _hidePopup() {
|
||||
@ -193,122 +84,127 @@ class DrawerMenuState extends ConsumerState<DrawerMenu> {
|
||||
_overlayEntry = null;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_hidePopup(); // remove any popup when drawer is disposed
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final roleId = ref.watch(userRoleProvider);
|
||||
|
||||
print('RoleId - $roleId');
|
||||
return Container(
|
||||
color: Color(0xFF425B5B),
|
||||
padding: EdgeInsets.all(13.0),
|
||||
color: const Color(0xFF425B5B),
|
||||
padding: const EdgeInsets.all(13.0),
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: [
|
||||
SizedBox(height: 30),
|
||||
GestureDetector(
|
||||
const SizedBox(height: 30),
|
||||
|
||||
// Dashboard
|
||||
_buildMenuItem(
|
||||
context: context,
|
||||
icon: Image.asset(
|
||||
"assets/drawer/drawerImg1.png",
|
||||
height: 25,
|
||||
width: 25,
|
||||
),
|
||||
label: "Dashboard",
|
||||
onTap: () {
|
||||
_hidePopup();
|
||||
context.go(AppRoutes.dashboard);
|
||||
},
|
||||
child: DrawerContentWrapper(
|
||||
child: Image.asset(
|
||||
"assets/drawer/drawerImg1.png",
|
||||
height: 25,
|
||||
width: 25,
|
||||
),
|
||||
),
|
||||
),
|
||||
DrawerLabel("Dashboard"),
|
||||
|
||||
DrawerContentWrapper(
|
||||
child: Consumer(
|
||||
builder: (context, ref, _) {
|
||||
return IconButton(
|
||||
onPressed: () {
|
||||
print('roleI - $roleId');
|
||||
if (roleId == 'agent') {
|
||||
context.go(AppRoutes.enquiryLst);
|
||||
} else {
|
||||
context.go(AppRoutes.enquiryForStaff);
|
||||
}
|
||||
// ref.read(enquiryIdProvider.notifier).state = null;
|
||||
// context.go(AppRoutes.tabEnquiry);
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.list_alt_rounded,
|
||||
size: 30,
|
||||
color: Colors.black,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
DrawerLabel("Enquiry"),
|
||||
// Enquiry
|
||||
_buildMenuItem(
|
||||
context: context,
|
||||
icon: Icon(Icons.list_alt_rounded, size: 30, color: Colors.black),
|
||||
label: "Enquiry",
|
||||
onTap: () {
|
||||
_hidePopup();
|
||||
if (roleId == 'agent') {
|
||||
context.go(AppRoutes.enquiryLst);
|
||||
} else {
|
||||
context.go(AppRoutes.enquiryForStaff);
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
if (roleId == 'manager') ...[
|
||||
Builder(
|
||||
builder: (itemContext) {
|
||||
return MouseRegion(
|
||||
// onEnter: (_) => _showPopup(itemContext),
|
||||
onEnter: (_) {
|
||||
final renderBox =
|
||||
itemContext.findRenderObject() as RenderBox;
|
||||
final offset = renderBox.localToGlobal(Offset.zero);
|
||||
final size = renderBox.size;
|
||||
final key = 'User';
|
||||
_showPopup(context, offset, size, key);
|
||||
},
|
||||
// User (Manager Only)
|
||||
if (roleId == 'manager') _buildHoverMenu(
|
||||
context: context,
|
||||
icon: Icon(Icons.person_add_alt, size: 30),
|
||||
label: "User",
|
||||
popupKey: 'User',
|
||||
),
|
||||
|
||||
child: DrawerContentWrapper(
|
||||
child: Icon(Icons.person_add_alt, size: 30),
|
||||
),
|
||||
);
|
||||
},
|
||||
// Reports (Not Staff)
|
||||
if (roleId != 'staff') _buildHoverMenu(
|
||||
context: context,
|
||||
icon: Image.asset(
|
||||
"assets/drawer/drawerImg2.png",
|
||||
height: 25,
|
||||
width: 25,
|
||||
),
|
||||
DrawerLabel("User"),
|
||||
],
|
||||
|
||||
if (roleId != 'staff') ...[
|
||||
Builder(
|
||||
builder: (itemContext) {
|
||||
return MouseRegion(
|
||||
// onEnter: (_) => _showPopup(itemContext),
|
||||
onEnter: (_) {
|
||||
final renderBox =
|
||||
itemContext.findRenderObject() as RenderBox;
|
||||
final offset = renderBox.localToGlobal(Offset.zero);
|
||||
final size = renderBox.size;
|
||||
final key = "Reports";
|
||||
_showPopup(context, offset, size, key);
|
||||
},
|
||||
|
||||
child: DrawerContentWrapper(
|
||||
child: Image.asset(
|
||||
"assets/drawer/drawerImg2.png",
|
||||
height: 25,
|
||||
width: 25,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
DrawerLabel("Reports"),
|
||||
],
|
||||
label: "Reports",
|
||||
popupKey: 'Reports',
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMenuItem({
|
||||
required BuildContext context,
|
||||
required Widget icon,
|
||||
required String label,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
return Column(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: onTap,
|
||||
child: MouseRegion(
|
||||
onEnter: (_) => _hidePopup(), // hide any popup when hovering
|
||||
child: DrawerContentWrapper(child: icon),
|
||||
),
|
||||
),
|
||||
DrawerLabel(label),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHoverMenu({
|
||||
required BuildContext context,
|
||||
required Widget icon,
|
||||
required String label,
|
||||
required String popupKey,
|
||||
}) {
|
||||
return Column(
|
||||
children: [
|
||||
Builder(
|
||||
builder: (itemContext) {
|
||||
return MouseRegion(
|
||||
onEnter: (_) {
|
||||
final renderBox = itemContext.findRenderObject() as RenderBox;
|
||||
final offset = renderBox.localToGlobal(Offset.zero);
|
||||
final size = renderBox.size;
|
||||
_showPopup(context, offset, size, popupKey);
|
||||
},
|
||||
child: DrawerContentWrapper(child: icon),
|
||||
);
|
||||
},
|
||||
),
|
||||
DrawerLabel(label),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildPopupItem({required String label, required VoidCallback onTap}) {
|
||||
return _HoverableContainer(
|
||||
label: label,
|
||||
onTap: onTap,
|
||||
normalColor: Color(0xFFDDF5F1),
|
||||
hoverColor: Colors.white, // change to your desired hover color
|
||||
);
|
||||
}
|
||||
|
||||
// Drawer label widget
|
||||
class DrawerLabel extends StatelessWidget {
|
||||
final String text;
|
||||
const DrawerLabel(this.text, {super.key});
|
||||
@ -322,12 +218,23 @@ class DrawerLabel extends StatelessWidget {
|
||||
text,
|
||||
style: GoogleFonts.inter(color: Colors.white, fontSize: 11.5),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Popup item
|
||||
Widget _buildPopupItem({required String label, required VoidCallback onTap}) {
|
||||
return _HoverableContainer(
|
||||
label: label,
|
||||
onTap: onTap,
|
||||
normalColor: const Color(0xFFDDF5F1),
|
||||
hoverColor: Colors.white,
|
||||
);
|
||||
}
|
||||
|
||||
// Hoverable container for popup items
|
||||
class _HoverableContainer extends StatefulWidget {
|
||||
final String label;
|
||||
final VoidCallback onTap;
|
||||
@ -365,7 +272,7 @@ class _HoverableContainerState extends State<_HoverableContainer> {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
SizedBox(
|
||||
width: 110,
|
||||
child: Text(widget.label, style: _cardTextStyle),
|
||||
),
|
||||
|
||||
388
lib/presentation/widgets/drawer_menu1.dart
Normal file
388
lib/presentation/widgets/drawer_menu1.dart
Normal file
@ -0,0 +1,388 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../../core/routing/routes.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import '../providers/manager_provider.dart';
|
||||
import '../providers/userRoleProvider.dart';
|
||||
import 'drawerContentWrapper.dart';
|
||||
|
||||
class DrawerMenu extends ConsumerStatefulWidget {
|
||||
const DrawerMenu({super.key});
|
||||
@override
|
||||
ConsumerState<DrawerMenu> createState() => DrawerMenuState();
|
||||
}
|
||||
|
||||
class DrawerMenuState extends ConsumerState<DrawerMenu> {
|
||||
OverlayEntry? _overlayEntry;
|
||||
|
||||
void _showPopup(BuildContext context, Offset offset, Size size, String key) {
|
||||
_hidePopup(); // clear old one before creating new
|
||||
|
||||
_overlayEntry = OverlayEntry(
|
||||
builder: (context) {
|
||||
return Positioned(
|
||||
left: offset.dx + size.width - 5, // little spacing
|
||||
top: offset.dy + (size.height / 2) - 20,
|
||||
// left: offset.dx + size.width,
|
||||
// top: offset.dy,
|
||||
child: MouseRegion(
|
||||
onExit: (_) => _hidePopup(),
|
||||
child: Material(
|
||||
elevation: 4,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
color: const Color(0xFFDDF5F1),
|
||||
// color: Colors.white,
|
||||
),
|
||||
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (key == 'User') ...[
|
||||
_buildPopupItem(
|
||||
label: "Agent",
|
||||
onTap: () => context.go(AppRoutes.agentLst),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
_buildPopupItem(
|
||||
label: "Staff",
|
||||
onTap: () => context.go(AppRoutes.staffLst),
|
||||
),
|
||||
],
|
||||
if (key == 'Reports') ...[
|
||||
_buildPopupItem(
|
||||
label: "Claims",
|
||||
onTap: () => context.go(AppRoutes.claimlist),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
_buildPopupItem(
|
||||
label: "Endorsement",
|
||||
onTap: () => context.go(AppRoutes.endosement),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
_buildPopupItem(
|
||||
label: "Policy",
|
||||
onTap: () => context.go(AppRoutes.policylist),
|
||||
),
|
||||
],
|
||||
|
||||
// if (key == 'User') ...[
|
||||
// Row(
|
||||
// children: [
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// print("Tappped Agent");
|
||||
// context.go(AppRoutes.agentLst);
|
||||
// },
|
||||
// child: Text("Agent", style: _cardTextStyle),
|
||||
// ),
|
||||
//
|
||||
// Icon(
|
||||
// Icons.arrow_forward_ios_rounded,
|
||||
// size: 12,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// const SizedBox(height: 5),
|
||||
// Row(
|
||||
// children: [
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// print("Bf clicked");
|
||||
// context.go(AppRoutes.staffLst);
|
||||
// },
|
||||
// child: Text("Staff", style: _cardTextStyle),
|
||||
// ),
|
||||
//
|
||||
// Icon(
|
||||
// Icons.arrow_forward_ios_rounded,
|
||||
// size: 12,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
//
|
||||
// if (key == 'Reports') ...[
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// context.go(AppRoutes.claimlist);
|
||||
// },
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text("Claims", style: _cardTextStyle),
|
||||
// Icon(
|
||||
// Icons.arrow_forward_ios_rounded,
|
||||
// size: 12,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// // const SizedBox(height: 5),
|
||||
// // GestureDetector(
|
||||
// // onTap: () {
|
||||
// // context.go(AppRoutes.enquiryLst);
|
||||
// // },
|
||||
// // child: const Text(
|
||||
// // "Enquiries",
|
||||
// // style: TextStyle(
|
||||
// // fontSize: 16,
|
||||
// // fontWeight: FontWeight.w400,
|
||||
// // ),
|
||||
// // ),
|
||||
// // ),
|
||||
// const SizedBox(height: 5),
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// context.go(AppRoutes.endosement);
|
||||
// },
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text("Endorsement", style: _cardTextStyle),
|
||||
//
|
||||
// Icon(
|
||||
// Icons.arrow_forward_ios_rounded,
|
||||
// size: 12,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(height: 5),
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// context.go(AppRoutes.policylist);
|
||||
// },
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text("Policy", style: _cardTextStyle),
|
||||
//
|
||||
// Icon(
|
||||
// Icons.arrow_forward_ios_rounded,
|
||||
// size: 12,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
final overlay = Overlay.of(context, rootOverlay: true);
|
||||
overlay?.insert(_overlayEntry!);
|
||||
}
|
||||
|
||||
void _hidePopup() {
|
||||
print('Hide');
|
||||
_overlayEntry?.remove();
|
||||
_overlayEntry = null;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final roleId = ref.watch(userRoleProvider);
|
||||
|
||||
print('RoleId - $roleId');
|
||||
return Container(
|
||||
color: Color(0xFF425B5B),
|
||||
padding: EdgeInsets.all(13.0),
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: [
|
||||
SizedBox(height: 30),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
context.go(AppRoutes.dashboard);
|
||||
},
|
||||
child: DrawerContentWrapper(
|
||||
child: Image.asset(
|
||||
"assets/drawer/drawerImg1.png",
|
||||
height: 25,
|
||||
width: 25,
|
||||
),
|
||||
),
|
||||
),
|
||||
DrawerLabel("Dashboard"),
|
||||
|
||||
DrawerContentWrapper(
|
||||
child: Consumer(
|
||||
builder: (context, ref, _) {
|
||||
return IconButton(
|
||||
onPressed: () {
|
||||
print('roleI - $roleId');
|
||||
if (roleId == 'agent') {
|
||||
context.go(AppRoutes.enquiryLst);
|
||||
} else {
|
||||
context.go(AppRoutes.enquiryForStaff);
|
||||
}
|
||||
// ref.read(enquiryIdProvider.notifier).state = null;
|
||||
// context.go(AppRoutes.tabEnquiry);
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.list_alt_rounded,
|
||||
size: 30,
|
||||
color: Colors.black,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
DrawerLabel("Enquiry"),
|
||||
|
||||
if (roleId == 'manager') ...[
|
||||
Builder(
|
||||
builder: (itemContext) {
|
||||
return MouseRegion(
|
||||
// onEnter: (_) => _showPopup(itemContext),
|
||||
onEnter: (_) {
|
||||
final renderBox =
|
||||
itemContext.findRenderObject() as RenderBox;
|
||||
final offset = renderBox.localToGlobal(Offset.zero);
|
||||
final size = renderBox.size;
|
||||
final key = 'User';
|
||||
_showPopup(context, offset, size, key);
|
||||
},
|
||||
|
||||
child: DrawerContentWrapper(
|
||||
child: Icon(Icons.person_add_alt, size: 30),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
DrawerLabel("User"),
|
||||
],
|
||||
|
||||
if (roleId != 'staff') ...[
|
||||
Builder(
|
||||
builder: (itemContext) {
|
||||
return MouseRegion(
|
||||
// onEnter: (_) => _showPopup(itemContext),
|
||||
onEnter: (_) {
|
||||
final renderBox =
|
||||
itemContext.findRenderObject() as RenderBox;
|
||||
final offset = renderBox.localToGlobal(Offset.zero);
|
||||
final size = renderBox.size;
|
||||
final key = "Reports";
|
||||
_showPopup(context, offset, size, key);
|
||||
},
|
||||
|
||||
child: DrawerContentWrapper(
|
||||
child: Image.asset(
|
||||
"assets/drawer/drawerImg2.png",
|
||||
height: 25,
|
||||
width: 25,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
DrawerLabel("Reports"),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildPopupItem({required String label, required VoidCallback onTap}) {
|
||||
return _HoverableContainer(
|
||||
label: label,
|
||||
onTap: onTap,
|
||||
normalColor: Color(0xFFDDF5F1),
|
||||
hoverColor: Colors.white, // change to your desired hover color
|
||||
);
|
||||
}
|
||||
|
||||
class DrawerLabel extends StatelessWidget {
|
||||
final String text;
|
||||
const DrawerLabel(this.text, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
text,
|
||||
style: GoogleFonts.inter(color: Colors.white, fontSize: 11.5),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _HoverableContainer extends StatefulWidget {
|
||||
final String label;
|
||||
final VoidCallback onTap;
|
||||
final Color normalColor;
|
||||
final Color hoverColor;
|
||||
|
||||
const _HoverableContainer({
|
||||
super.key,
|
||||
required this.label,
|
||||
required this.onTap,
|
||||
required this.normalColor,
|
||||
required this.hoverColor,
|
||||
});
|
||||
|
||||
@override
|
||||
_HoverableContainerState createState() => _HoverableContainerState();
|
||||
}
|
||||
|
||||
class _HoverableContainerState extends State<_HoverableContainer> {
|
||||
bool _isHovered = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MouseRegion(
|
||||
onEnter: (_) => setState(() => _isHovered = true),
|
||||
onExit: (_) => setState(() => _isHovered = false),
|
||||
child: GestureDetector(
|
||||
onTap: widget.onTap,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: _isHovered ? widget.hoverColor : widget.normalColor,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
width: 110,
|
||||
child: Text(widget.label, style: _cardTextStyle),
|
||||
),
|
||||
const Icon(
|
||||
Icons.arrow_forward_ios_rounded,
|
||||
size: 12,
|
||||
color: Colors.black,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
TextStyle _cardTextStyle = GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
);
|
||||
@ -142,10 +142,13 @@ class _TopBarState extends State<TopBar> {
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(50.0),
|
||||
),
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.notifications_none, color: Colors.black87),
|
||||
onPressed: widget.onNotifications,
|
||||
),
|
||||
child: Tooltip(
|
||||
message: 'Notifications',
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.notifications_none, color: Colors.black87),
|
||||
onPressed: widget.onNotifications,
|
||||
),
|
||||
)
|
||||
),
|
||||
if (!widget.isMobile) ...[
|
||||
SizedBox(width: 10),
|
||||
@ -156,10 +159,12 @@ class _TopBarState extends State<TopBar> {
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(50.0),
|
||||
),
|
||||
child : Tooltip( message: 'Profile',
|
||||
child: GestureDetector(
|
||||
onTapDown: (details) => widget.onProfile!(details),
|
||||
child: const Icon(Icons.person_outline, color: Colors.black87),
|
||||
),
|
||||
)
|
||||
),
|
||||
|
||||
// IconButton(
|
||||
@ -175,10 +180,13 @@ class _TopBarState extends State<TopBar> {
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(50.0),
|
||||
),
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.logout, color: Colors.black87),
|
||||
onPressed: widget.onLogout,
|
||||
),
|
||||
child: Tooltip(
|
||||
message: 'Logout',
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.logout, color: Colors.black87),
|
||||
onPressed: widget.onLogout,
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user