From 40de0e49e8ecac44a174ef2d126983cd3c13a2ba Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Thu, 9 Oct 2025 17:28:37 +0530 Subject: [PATCH] FIX_UI --- .../screens/Enquiry/enquiry/policy_popup.dart | 5 +- .../screens/Enquiry/enquiry/policy_tab.dart | 11 +- .../screens/Enquiry/enquiry/tabs.dart | 14 +- .../screens/Enquiry/enquiryList.dart | 122 ++++-- .../Enquiry/policy_claims_endros/claims.dart | 17 +- .../policy_claims_endros/endrosment.dart | 17 +- .../screens/UserManagement/Agent/agent.dart | 15 +- .../Agent/agentIncentiveFile.dart | 35 +- .../UserManagement/Agent/agentList.dart | 43 +- .../Profile/profile_mobile.dart | 5 +- .../UserManagement/Profile/profile_web.dart | 5 +- .../screens/UserManagement/Staff/staff.dart | 15 +- .../UserManagement/Staff/staffList.dart | 61 ++- .../screens/staff/Enquiry/enquiry_list.dart | 20 +- .../screens/staff/assignStaff.dart | 10 +- .../screens/staff/policy/policy.dart | 17 +- .../screens/staff/policy/policy_list.dart | 29 +- .../quotations/createQuotationPopUp.dart | 5 +- .../screens/staff/quotations/quotation.dart | 93 +++-- .../widgets/custom_Stdate_EnDate_Filter.dart | 30 +- lib/presentation/widgets/drawer_menu.dart | 327 ++++++--------- lib/presentation/widgets/drawer_menu1.dart | 388 ++++++++++++++++++ lib/presentation/widgets/topbar.dart | 24 +- 23 files changed, 931 insertions(+), 377 deletions(-) create mode 100644 lib/presentation/widgets/drawer_menu1.dart diff --git a/lib/presentation/screens/Enquiry/enquiry/policy_popup.dart b/lib/presentation/screens/Enquiry/enquiry/policy_popup.dart index 3eb565e..0808b5c 100644 --- a/lib/presentation/screens/Enquiry/enquiry/policy_popup.dart +++ b/lib/presentation/screens/Enquiry/enquiry/policy_popup.dart @@ -280,7 +280,10 @@ class _AddDialogState extends State { 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), + ), ), ), ], diff --git a/lib/presentation/screens/Enquiry/enquiry/policy_tab.dart b/lib/presentation/screens/Enquiry/enquiry/policy_tab.dart index 3b26442..cd33dff 100644 --- a/lib/presentation/screens/Enquiry/enquiry/policy_tab.dart +++ b/lib/presentation/screens/Enquiry/enquiry/policy_tab.dart @@ -569,7 +569,9 @@ class PolicyTabState extends ConsumerState { } 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 { ); }, 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 { ); }, icon: Icon(Icons.add), + ), ); } diff --git a/lib/presentation/screens/Enquiry/enquiry/tabs.dart b/lib/presentation/screens/Enquiry/enquiry/tabs.dart index 814edf4..99af8cd 100644 --- a/lib/presentation/screens/Enquiry/enquiry/tabs.dart +++ b/lib/presentation/screens/Enquiry/enquiry/tabs.dart @@ -418,10 +418,16 @@ class TabEnquiryListState extends ConsumerState { }, 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( diff --git a/lib/presentation/screens/Enquiry/enquiryList.dart b/lib/presentation/screens/Enquiry/enquiryList.dart index 813d910..a715442 100644 --- a/lib/presentation/screens/Enquiry/enquiryList.dart +++ b/lib/presentation/screens/Enquiry/enquiryList.dart @@ -350,7 +350,7 @@ class EnquiryListState extends ConsumerState { 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 { 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 { 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 { // // 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 { 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( // color: Colors.white, // padding: EdgeInsets.zero, diff --git a/lib/presentation/screens/Enquiry/policy_claims_endros/claims.dart b/lib/presentation/screens/Enquiry/policy_claims_endros/claims.dart index 14fad8b..2abb45e 100644 --- a/lib/presentation/screens/Enquiry/policy_claims_endros/claims.dart +++ b/lib/presentation/screens/Enquiry/policy_claims_endros/claims.dart @@ -178,7 +178,7 @@ class claimListState extends ConsumerState { 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 { 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( diff --git a/lib/presentation/screens/Enquiry/policy_claims_endros/endrosment.dart b/lib/presentation/screens/Enquiry/policy_claims_endros/endrosment.dart index 1cbf397..3de8e53 100644 --- a/lib/presentation/screens/Enquiry/policy_claims_endros/endrosment.dart +++ b/lib/presentation/screens/Enquiry/policy_claims_endros/endrosment.dart @@ -174,7 +174,7 @@ class endosementState extends ConsumerState { 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 { 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( diff --git a/lib/presentation/screens/UserManagement/Agent/agent.dart b/lib/presentation/screens/UserManagement/Agent/agent.dart index 5201015..c558c68 100644 --- a/lib/presentation/screens/UserManagement/Agent/agent.dart +++ b/lib/presentation/screens/UserManagement/Agent/agent.dart @@ -344,11 +344,18 @@ class AgentState extends ConsumerState { 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( diff --git a/lib/presentation/screens/UserManagement/Agent/agentIncentiveFile.dart b/lib/presentation/screens/UserManagement/Agent/agentIncentiveFile.dart index b1011d6..ac35ae0 100644 --- a/lib/presentation/screens/UserManagement/Agent/agentIncentiveFile.dart +++ b/lib/presentation/screens/UserManagement/Agent/agentIncentiveFile.dart @@ -389,18 +389,31 @@ class UploadIncentiveModalState extends ConsumerState { ), ), 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(), + ), ), ], ), diff --git a/lib/presentation/screens/UserManagement/Agent/agentList.dart b/lib/presentation/screens/UserManagement/Agent/agentList.dart index 2dc1c53..10d4262 100644 --- a/lib/presentation/screens/UserManagement/Agent/agentList.dart +++ b/lib/presentation/screens/UserManagement/Agent/agentList.dart @@ -175,11 +175,18 @@ class AgentListState extends ConsumerState { 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 { 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(), ), ), ], diff --git a/lib/presentation/screens/UserManagement/Profile/profile_mobile.dart b/lib/presentation/screens/UserManagement/Profile/profile_mobile.dart index f76aa4f..c12c54c 100644 --- a/lib/presentation/screens/UserManagement/Profile/profile_mobile.dart +++ b/lib/presentation/screens/UserManagement/Profile/profile_mobile.dart @@ -429,7 +429,10 @@ class ProfileState extends ConsumerState { 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), + ), ), ), ], diff --git a/lib/presentation/screens/UserManagement/Profile/profile_web.dart b/lib/presentation/screens/UserManagement/Profile/profile_web.dart index 3d2011e..ee4bca9 100644 --- a/lib/presentation/screens/UserManagement/Profile/profile_web.dart +++ b/lib/presentation/screens/UserManagement/Profile/profile_web.dart @@ -171,7 +171,10 @@ class ProfilePopUpState extends ConsumerState { 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), + ), ), ), ], diff --git a/lib/presentation/screens/UserManagement/Staff/staff.dart b/lib/presentation/screens/UserManagement/Staff/staff.dart index aeb4157..668d29d 100644 --- a/lib/presentation/screens/UserManagement/Staff/staff.dart +++ b/lib/presentation/screens/UserManagement/Staff/staff.dart @@ -232,11 +232,18 @@ class StaffState extends ConsumerState { 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( diff --git a/lib/presentation/screens/UserManagement/Staff/staffList.dart b/lib/presentation/screens/UserManagement/Staff/staffList.dart index c2b08bf..5e7cd46 100644 --- a/lib/presentation/screens/UserManagement/Staff/staffList.dart +++ b/lib/presentation/screens/UserManagement/Staff/staffList.dart @@ -176,11 +176,23 @@ class StaffListState extends ConsumerState { 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 { 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(), ), ), ], diff --git a/lib/presentation/screens/staff/Enquiry/enquiry_list.dart b/lib/presentation/screens/staff/Enquiry/enquiry_list.dart index 8103052..f564402 100644 --- a/lib/presentation/screens/staff/Enquiry/enquiry_list.dart +++ b/lib/presentation/screens/staff/Enquiry/enquiry_list.dart @@ -435,7 +435,7 @@ class EnquiryStaffState extends ConsumerState { 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 { 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 { ), ), ), - SizedBox(height: 10), ResponsiveLayout.isMobile(context) ? Container( diff --git a/lib/presentation/screens/staff/assignStaff.dart b/lib/presentation/screens/staff/assignStaff.dart index 9f7f66a..21304f2 100644 --- a/lib/presentation/screens/staff/assignStaff.dart +++ b/lib/presentation/screens/staff/assignStaff.dart @@ -213,7 +213,10 @@ class _AddDialogState extends State { 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 { 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), + ), ), ), ], diff --git a/lib/presentation/screens/staff/policy/policy.dart b/lib/presentation/screens/staff/policy/policy.dart index b5e6a33..106cd57 100644 --- a/lib/presentation/screens/staff/policy/policy.dart +++ b/lib/presentation/screens/staff/policy/policy.dart @@ -526,7 +526,7 @@ class PolicyScreenState extends ConsumerState { 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 { 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( diff --git a/lib/presentation/screens/staff/policy/policy_list.dart b/lib/presentation/screens/staff/policy/policy_list.dart index 41b4a3d..8ef2e72 100644 --- a/lib/presentation/screens/staff/policy/policy_list.dart +++ b/lib/presentation/screens/staff/policy/policy_list.dart @@ -302,12 +302,14 @@ class policylistState extends ConsumerState { 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 { 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 { 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( diff --git a/lib/presentation/screens/staff/quotations/createQuotationPopUp.dart b/lib/presentation/screens/staff/quotations/createQuotationPopUp.dart index f011ff2..aa4a814 100644 --- a/lib/presentation/screens/staff/quotations/createQuotationPopUp.dart +++ b/lib/presentation/screens/staff/quotations/createQuotationPopUp.dart @@ -341,7 +341,10 @@ class createQuotatDialogState extends State { 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), + ), ), ), ], diff --git a/lib/presentation/screens/staff/quotations/quotation.dart b/lib/presentation/screens/staff/quotations/quotation.dart index ad07c74..7b1cf57 100644 --- a/lib/presentation/screens/staff/quotations/quotation.dart +++ b/lib/presentation/screens/staff/quotations/quotation.dart @@ -292,11 +292,18 @@ class QuotationScreenState extends ConsumerState { 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 { 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 { 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, diff --git a/lib/presentation/widgets/custom_Stdate_EnDate_Filter.dart b/lib/presentation/widgets/custom_Stdate_EnDate_Filter.dart index 7eeeb15..2fe77db 100644 --- a/lib/presentation/widgets/custom_Stdate_EnDate_Filter.dart +++ b/lib/presentation/widgets/custom_Stdate_EnDate_Filter.dart @@ -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), + ), + ), ), ]; diff --git a/lib/presentation/widgets/drawer_menu.dart b/lib/presentation/widgets/drawer_menu.dart index 34f82cd..c592a1b 100644 --- a/lib/presentation/widgets/drawer_menu.dart +++ b/lib/presentation/widgets/drawer_menu.dart @@ -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 { 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 { 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 { 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 { }, ); - 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 { _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), ), diff --git a/lib/presentation/widgets/drawer_menu1.dart b/lib/presentation/widgets/drawer_menu1.dart new file mode 100644 index 0000000..34f82cd --- /dev/null +++ b/lib/presentation/widgets/drawer_menu1.dart @@ -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 createState() => DrawerMenuState(); +} + +class DrawerMenuState extends ConsumerState { + 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, +); diff --git a/lib/presentation/widgets/topbar.dart b/lib/presentation/widgets/topbar.dart index 13e3827..b6e93b9 100644 --- a/lib/presentation/widgets/topbar.dart +++ b/lib/presentation/widgets/topbar.dart @@ -142,10 +142,13 @@ class _TopBarState extends State { 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 { 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 { 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, + ), + ) ), ], ),