From 6be8510b861855c21e9c1089fe50a84743cb53c4 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 1 Sep 2022 15:30:16 +0300 Subject: [PATCH] drawer menu ui changed. --- assets/images/drawer/change_password.svg | 3 + assets/images/drawer/employee_id.svg | 7 + assets/images/drawer/logout.svg | 3 + assets/images/drawer/mowadhafi.svg | 5 + assets/images/drawer/my_profile.svg | 14 ++ assets/images/drawer/my_requests.svg | 5 + assets/images/drawer/my_team.svg | 34 +++ assets/images/drawer/pending_trasactions.svg | 6 + .../images/drawer/performance_evaluation.svg | 12 ++ assets/images/drawer/view_business_card.svg | 11 + assets/langs/ar-SA.json | 11 +- assets/langs/en-US.json | 11 +- lib/api/dashboard_api_client.dart | 5 +- lib/extensions/string_extensions.dart | 9 +- lib/generated/codegen_loader.g.dart | 12 ++ lib/generated/locale_keys.g.dart | 6 + .../dashboard/drawer_menu_item_model.dart | 7 + lib/provider/dashboard_provider_model.dart | 31 ++- lib/ui/landing/dashboard_screen.dart | 13 +- lib/ui/landing/widget/app_drawer.dart | 202 ++++++++++-------- pubspec.yaml | 1 + 21 files changed, 287 insertions(+), 121 deletions(-) create mode 100644 assets/images/drawer/change_password.svg create mode 100644 assets/images/drawer/employee_id.svg create mode 100644 assets/images/drawer/logout.svg create mode 100644 assets/images/drawer/mowadhafi.svg create mode 100644 assets/images/drawer/my_profile.svg create mode 100644 assets/images/drawer/my_requests.svg create mode 100644 assets/images/drawer/my_team.svg create mode 100644 assets/images/drawer/pending_trasactions.svg create mode 100644 assets/images/drawer/performance_evaluation.svg create mode 100644 assets/images/drawer/view_business_card.svg create mode 100644 lib/models/dashboard/drawer_menu_item_model.dart diff --git a/assets/images/drawer/change_password.svg b/assets/images/drawer/change_password.svg new file mode 100644 index 0000000..7e953d2 --- /dev/null +++ b/assets/images/drawer/change_password.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/drawer/employee_id.svg b/assets/images/drawer/employee_id.svg new file mode 100644 index 0000000..b40b670 --- /dev/null +++ b/assets/images/drawer/employee_id.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/images/drawer/logout.svg b/assets/images/drawer/logout.svg new file mode 100644 index 0000000..acdc741 --- /dev/null +++ b/assets/images/drawer/logout.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/drawer/mowadhafi.svg b/assets/images/drawer/mowadhafi.svg new file mode 100644 index 0000000..b76f9b8 --- /dev/null +++ b/assets/images/drawer/mowadhafi.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/drawer/my_profile.svg b/assets/images/drawer/my_profile.svg new file mode 100644 index 0000000..45b9155 --- /dev/null +++ b/assets/images/drawer/my_profile.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/images/drawer/my_requests.svg b/assets/images/drawer/my_requests.svg new file mode 100644 index 0000000..223beee --- /dev/null +++ b/assets/images/drawer/my_requests.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/drawer/my_team.svg b/assets/images/drawer/my_team.svg new file mode 100644 index 0000000..9eae21b --- /dev/null +++ b/assets/images/drawer/my_team.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/drawer/pending_trasactions.svg b/assets/images/drawer/pending_trasactions.svg new file mode 100644 index 0000000..5975ca3 --- /dev/null +++ b/assets/images/drawer/pending_trasactions.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/drawer/performance_evaluation.svg b/assets/images/drawer/performance_evaluation.svg new file mode 100644 index 0000000..534b5a6 --- /dev/null +++ b/assets/images/drawer/performance_evaluation.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/images/drawer/view_business_card.svg b/assets/images/drawer/view_business_card.svg new file mode 100644 index 0000000..5544e05 --- /dev/null +++ b/assets/images/drawer/view_business_card.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 7e2048d..f16b125 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -97,6 +97,7 @@ "cancel": "إلغاء", "requestedItems": "العناصر المطلوبة", "request": "طلب", + "myRequest": "طلبي", "actions": "أجراءات", "delegate": "مندوب", "request_info": "اطلب معلومات", @@ -311,6 +312,9 @@ "requestType": "نوع الطلب", "employeeDigitalID": "هويةالموظف الرقمية", "businessCard": "بطاقة العمل", + "viewBusinessCard": "عرض بطاقة العمل", + "performanceEvaluation": "تقييم الأداء", + "logout": "تسجيل خروج", "checkOut": "وقت الخروج", "regular": "منتظم", "mark": "علامة", @@ -341,13 +345,12 @@ "pleaseSelectDate": "الرجاء تحديد التاريخ", "todayAttendance": "حضور اليوم", "viewAttendance": "عرض الحضور", - "teamMembers":"اعضاءالفريق", + "teamMembers": "اعضاءالفريق", "profileDetails": "الملف الشخصي", - "noResultsFound" : "لايوجد نتائج", + "noResultsFound": "لايوجد نتائج", "searchBy": "بحث بواسطة", "myTeamMembers": "اعضاء فريقي", "save": "حفظ", - "itemType": "نوع العنصر", "TurnNotificationsFor": "تفعيل الاشعارات", "worklistSettings": "اعدادات الاشعارات", "absenceType": "نوع الغياب", @@ -356,6 +359,8 @@ "hours": "ساعات", "approvalStatus": "حالة القبول", "absenceStatus": "حالة الغياب", + "poweredBy": "مشغل بواسطة", + "cloudSolutions": "حلول السحابة", "profile": { "reset_password": { "label": "Reset Password", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 38765dd..3593bf2 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -94,6 +94,7 @@ "cancel": "Cancel", "requestedItems": "Requested Items", "request": "Request", + "myRequest": "My Request", "actions": "Actions", "delegate": "Delegate", "request_info": "Request Info", @@ -311,6 +312,9 @@ "wantToReject": "Are you sure want to reject?", "employeeDigitalID": "Employee Digital ID", "businessCard": "Business Card", + "viewBusinessCard": "View Business Card", + "performanceEvaluation": "Performance Evaluation", + "logout": "Logout", "checkOut": "Check Out", "regular": "Regular", "mark": "Mark", @@ -341,13 +345,12 @@ "pleaseSelectDate": "Please select date", "todayAttendance": "Today's Attendance", "viewAttendance": "View Attendance", - "teamMembers":"Team Members", + "teamMembers": "Team Members", "profileDetails": "Profile Details", - "noResultsFound" : "No Results Found", + "noResultsFound": "No Results Found", "searchBy": "Search by", "myTeamMembers": "My Team Members", "save": "Save", - "itemType": "Item Type", "TurnNotificationsFor": "Turn on notifications for", "worklistSettings": "Worklist Settings", "absenceType": "Absence Type", @@ -356,6 +359,8 @@ "hours": "Hours", "approvalStatus": "Approval Status", "absenceStatus": "Absence Status", + "poweredBy": "Powered By", + "cloudSolutions": "Cloud Solutions", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/api/dashboard_api_client.dart b/lib/api/dashboard_api_client.dart index 1dd58b1..5b00e7f 100644 --- a/lib/api/dashboard_api_client.dart +++ b/lib/api/dashboard_api_client.dart @@ -5,6 +5,7 @@ import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/consts.dart'; import 'package:mohem_flutter_app/models/dashboard/get_attendance_tracking_list_model.dart'; import 'package:mohem_flutter_app/models/dashboard/itg_forms_model.dart'; +import 'package:mohem_flutter_app/models/dashboard/list_menu.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:uuid/uuid.dart'; @@ -66,13 +67,13 @@ class DashboardApiClient { } //Menus List - Future getListMenu() async { + Future> getListMenu() async { String url = "${ApiConsts.erpRest}GET_MENU"; Map postParams = {}; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel responseData = GenericResponseModel.fromJson(json); - return responseData; + return responseData.listMenu ?? []; }, url, postParams); } diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index e895ad1..b59d90d 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -49,9 +49,9 @@ extension EmailValidator on String { style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.52, decoration: isUnderLine ? TextDecoration.underline : null), ); - Widget toText14({Color? color, bool isBold = false}) => Text( + Widget toText14({Color? color, bool isBold = false, FontWeight? weight}) => Text( this, - style: TextStyle(color: color ?? MyColors.darkTextColor, fontSize: 14, letterSpacing: -0.48, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), + style: TextStyle(color: color ?? MyColors.darkTextColor, fontSize: 14, letterSpacing: -0.48, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.w600)), ); Widget toText16({Color? color, bool isUnderLine = false, bool isBold = false, int? maxlines}) => Text( @@ -71,6 +71,11 @@ extension EmailValidator on String { style: TextStyle(color: color ?? MyColors.darkTextColor, fontSize: 17, letterSpacing: -0.68, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), ); + Widget toText18({Color? color, bool isBold = false}) => Text( + this, + style: TextStyle(fontSize: 18, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -1.08), + ); + Widget toText20({Color? color, bool isBold = false}) => Text( this, style: TextStyle(fontSize: 20, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.4), diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 53499b8..fa2d61e 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -113,6 +113,7 @@ class CodegenLoader extends AssetLoader{ "cancel": "إلغاء", "requestedItems": "العناصر المطلوبة", "request": "طلب", + "myRequest": "طلبي", "actions": "أجراءات", "delegate": "مندوب", "request_info": "اطلب معلومات", @@ -327,6 +328,9 @@ class CodegenLoader extends AssetLoader{ "requestType": "نوع الطلب", "employeeDigitalID": "هويةالموظف الرقمية", "businessCard": "بطاقة العمل", + "viewBusinessCard": "عرض بطاقة العمل", + "performanceEvaluation": "تقييم الأداء", + "logout": "تسجيل خروج", "checkOut": "وقت الخروج", "regular": "منتظم", "mark": "علامة", @@ -371,6 +375,8 @@ class CodegenLoader extends AssetLoader{ "hours": "ساعات", "approvalStatus": "حالة القبول", "absenceStatus": "حالة الغياب", + "poweredBy": "مشغل بواسطة", + "cloudSolutions": "حلول السحابة", "profile": { "reset_password": { "label": "Reset Password", @@ -501,6 +507,7 @@ static const Map en_US = { "cancel": "Cancel", "requestedItems": "Requested Items", "request": "Request", + "myRequest": "My Request", "actions": "Actions", "delegate": "Delegate", "request_info": "Request Info", @@ -718,6 +725,9 @@ static const Map en_US = { "wantToReject": "Are you sure want to reject?", "employeeDigitalID": "Employee Digital ID", "businessCard": "Business Card", + "viewBusinessCard": "View Business Card", + "performanceEvaluation": "Performance Evaluation", + "logout": "Logout", "checkOut": "Check Out", "regular": "Regular", "mark": "Mark", @@ -762,6 +772,8 @@ static const Map en_US = { "hours": "Hours", "approvalStatus": "Approval Status", "absenceStatus": "Absence Status", + "poweredBy": "Powered By", + "cloudSolutions": "Cloud Solutions", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 43165af..c307d43 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -98,6 +98,7 @@ abstract class LocaleKeys { static const cancel = 'cancel'; static const requestedItems = 'requestedItems'; static const request = 'request'; + static const myRequest = 'myRequest'; static const actions = 'actions'; static const delegate = 'delegate'; static const request_info = 'request_info'; @@ -312,6 +313,9 @@ abstract class LocaleKeys { static const requestType = 'requestType'; static const employeeDigitalID = 'employeeDigitalID'; static const businessCard = 'businessCard'; + static const viewBusinessCard = 'viewBusinessCard'; + static const performanceEvaluation = 'performanceEvaluation'; + static const logout = 'logout'; static const checkOut = 'checkOut'; static const regular = 'regular'; static const mark = 'mark'; @@ -356,6 +360,8 @@ abstract class LocaleKeys { static const hours = 'hours'; static const approvalStatus = 'approvalStatus'; static const absenceStatus = 'absenceStatus'; + static const poweredBy = 'poweredBy'; + static const cloudSolutions = 'cloudSolutions'; static const profile_reset_password_label = 'profile.reset_password.label'; static const profile_reset_password_username = 'profile.reset_password.username'; static const profile_reset_password_password = 'profile.reset_password.password'; diff --git a/lib/models/dashboard/drawer_menu_item_model.dart b/lib/models/dashboard/drawer_menu_item_model.dart new file mode 100644 index 0000000..54a7bfc --- /dev/null +++ b/lib/models/dashboard/drawer_menu_item_model.dart @@ -0,0 +1,7 @@ +class DrawerMenuItem { + String icon; + String title; + String routeName; + + DrawerMenuItem(this.icon, this.title, this.routeName); +} diff --git a/lib/provider/dashboard_provider_model.dart b/lib/provider/dashboard_provider_model.dart index 511fc03..20a0634 100644 --- a/lib/provider/dashboard_provider_model.dart +++ b/lib/provider/dashboard_provider_model.dart @@ -1,15 +1,16 @@ -import 'dart:convert'; - import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/api/dashboard_api_client.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/main.dart'; +import 'package:mohem_flutter_app/models/dashboard/drawer_menu_item_model.dart'; import 'package:mohem_flutter_app/models/dashboard/get_attendance_tracking_list_model.dart'; import 'package:mohem_flutter_app/models/dashboard/get_open_notifications_list.dart'; import 'package:mohem_flutter_app/models/dashboard/itg_forms_model.dart'; +import 'package:mohem_flutter_app/models/dashboard/list_menu.dart'; import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; import 'package:mohem_flutter_app/models/dashboard/menus.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart'; @@ -138,20 +139,28 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { } //List Menu API's & Methods + + List drawerMenuItemList = [ + DrawerMenuItem("assets/images/drawer/my_profile.svg", LocaleKeys.myProfile.tr(), AppRoutes.profile), + DrawerMenuItem("assets/images/drawer/performance_evaluation.svg", LocaleKeys.performanceEvaluation.tr(), ""), + DrawerMenuItem("assets/images/drawer/mowadhafi.svg", LocaleKeys.mowadhafhi.tr(), AppRoutes.mowadhafhi), + DrawerMenuItem("assets/images/drawer/pending_trasactions.svg", LocaleKeys.pendingTransactions.tr(), AppRoutes.pendingTransactions), + DrawerMenuItem("assets/images/drawer/change_password.svg", LocaleKeys.changePassword.tr(), ""), + ]; + void fetchListMenu() async { try { - GenericResponseModel? genericResponseModel = await DashboardApiClient().getListMenu(); - Map map = {}; - print(jsonEncode(genericResponseModel!.listMenu)); - for (int i = 0; i < genericResponseModel.listMenu!.length; i++) { - print(genericResponseModel.listMenu![i].menuName ?? ""); - map[genericResponseModel.listMenu![i].menuName ?? ""] = i.toString(); + List menuList = await DashboardApiClient().getListMenu(); + List findMyRequest = menuList.where((element) => element.menuName == "My Requests").toList(); + if (findMyRequest.isNotEmpty) { + drawerMenuItemList.insert(3, DrawerMenuItem("assets/images/drawer/my_requests.svg", LocaleKeys.myRequest.tr(), AppRoutes.myTeam)); + } + List findMyTeam = menuList.where((element) => element.menuName == "My Team").toList(); + if (findMyTeam.isNotEmpty) { + drawerMenuItemList.insert(2, DrawerMenuItem("assets/images/drawer/my_team.svg", LocaleKeys.myTeamMembers.tr(), AppRoutes.myTeam)); } - logger.i(map); - notifyListeners(); } catch (ex) { logger.wtf(ex); - notifyListeners(); Utils.handleException(ex, null, null); } } diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 4a6ad82..5c3f38f 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -41,6 +41,7 @@ class _DashboardScreenState extends State { void initState() { super.initState(); data = Provider.of(context, listen: false); + data.fetchListMenu(); data.fetchAttendanceTracking(context); data.fetchWorkListCounter(context); data.fetchMissingSwipe(context); @@ -217,9 +218,11 @@ class _DashboardScreenState extends State { ), ], ), - ).onPress(() { - Navigator.pushNamed(context, AppRoutes.todayAttendance); - })) + ).onPress( + () { + Navigator.pushNamed(context, AppRoutes.todayAttendance); + }, + )) .animatedSwither(); }, ), @@ -237,10 +240,10 @@ class _DashboardScreenState extends State { 8.height, Container( width: double.infinity, - padding: EdgeInsets.only(top: 31), + padding: const EdgeInsets.only(top: 31), decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.only(topRight: Radius.circular(50), topLeft: Radius.circular(50)), + borderRadius: const BorderRadius.only(topRight: Radius.circular(50), topLeft: Radius.circular(50)), border: Border.all(color: MyColors.lightGreyEDColor, width: 1), ), child: Column( diff --git a/lib/ui/landing/widget/app_drawer.dart b/lib/ui/landing/widget/app_drawer.dart index e9a33b4..7ea9748 100644 --- a/lib/ui/landing/widget/app_drawer.dart +++ b/lib/ui/landing/widget/app_drawer.dart @@ -1,13 +1,20 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; -import 'package:mohem_flutter_app/config/routes.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:mohem_flutter_app/app_state/app_state.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/models/dashboard/drawer_menu_item_model.dart'; +import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; +import 'package:mohem_flutter_app/ui/dialogs/id/business_card_dialog.dart'; import 'package:mohem_flutter_app/ui/dialogs/id/employee_digital_id_dialog.dart'; -import 'package:mohem_flutter_app/ui/landing/widget/drawer_item.dart'; - import 'package:mohem_flutter_app/widgets/dialogs/dialogs.dart'; -import 'package:mohem_flutter_app/ui/dialogs/id/business_card_dialog.dart'; -import 'package:easy_localization/easy_localization.dart'; -import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:provider/provider.dart'; class AppDrawer extends StatefulWidget { @override @@ -15,103 +22,108 @@ class AppDrawer extends StatefulWidget { } class _AppDrawerState extends State { + List drawerMenuItemList = []; + @override Widget build(BuildContext context) { - return Container( - color: Colors.white, - child: Drawer( - child: Column( - children: [ - const SizedBox( - height: 200, - ), - Expanded( - child: ListView( - padding: const EdgeInsets.all(21), - physics: const BouncingScrollPhysics(), + if (drawerMenuItemList.isEmpty) { + drawerMenuItemList = Provider.of(context, listen: false).drawerMenuItemList; + } + + return Drawer( + width: MediaQuery.of(context).size.width * 303 / 375, + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Image.asset("assets/images/logos/main_mohemm_logo.png", width: 134, height: 24), + const Icon(Icons.clear).onPress(() => Navigator.pop(context)), + ], + ).paddingOnly(left: 4, right: 14), + Row( + children: [ + CircleAvatar( + radius: 52 / 2, + backgroundImage: MemoryImage(Utils.getPostBytes(AppState().memberInformationList!.eMPLOYEEIMAGE)), + backgroundColor: Colors.black, + ), + 12.width, + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - const Divider(), - InkWell( - child: new DrawerItem( - //'My Profile', - LocaleKeys.myProfile.tr(), - icon: Icons.person, - color: Colors.grey, - ), - onTap: () { - drawerNavigator(context, AppRoutes.profile); - }), - const Divider(), - InkWell( - child: DrawerItem( - // 'Mowadhafhi', - LocaleKeys.mowadhafhi.tr(), - icon: Icons.person, - color: Colors.grey, - ), - onTap: () { - drawerNavigator(context, AppRoutes.mowadhafhi); - }, - ), - const Divider(), - InkWell( - child: DrawerItem( - LocaleKeys.pendingTransactions.tr(), - icon: Icons.person, - color: Colors.grey, - ), - onTap: () { - drawerNavigator(context, AppRoutes.pendingTransactions); - }, - ), - const Divider(), - InkWell( - child: DrawerItem( - "My Team", - icon: Icons.person, - color: Colors.grey, - ), - onTap: () { - drawerNavigator(context, AppRoutes.myTeam); - }, - ), - InkWell( - child: DrawerItem( - LocaleKeys.employeeDigitalID.tr(), - icon: Icons.insert_drive_file_outlined, - color: Colors.grey, - ), - onTap: () { - showMDialog(context, child: EmployeeDigitialIdDialog()); - }, - ), - Divider(), - InkWell( - child: DrawerItem( - LocaleKeys.businessCard.tr(), - icon: Icons.insert_drive_file_outlined, - color: Colors.grey, - ), - onTap: () { - showMDialog(context, child: BusinessCardDialog()); - }, - ), + AppState().memberInformationList!.eMPLOYEENAME!.toText18(isBold: true), + AppState().memberInformationList!.jOBNAME!.toText14(weight: FontWeight.w500), ], - ), - ) - ], - ), - ), + ).expanded + ], + ).paddingOnly(left: 14, right: 14, top: 21, bottom: 21), + const Divider( + height: 1, + thickness: 1, + color: MyColors.lightGreyEFColor, + ), + ListView( + padding: const EdgeInsets.only(top: 21, bottom: 21), + children: [ + ListView.builder( + padding: EdgeInsets.zero, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemCount: drawerMenuItemList.length, + itemBuilder: (cxt, index) { + return menuItem(drawerMenuItemList[index].icon, drawerMenuItemList[index].title, drawerMenuItemList[index].routeName, onPress: () { + Navigator.pushNamed(context, drawerMenuItemList[index].routeName); + }); + }), + menuItem("assets/images/drawer/employee_id.svg", LocaleKeys.employeeDigitalID.tr(), "", closeDrawer: false, onPress: () => showMDialog(context, child: EmployeeDigitialIdDialog())), + menuItem("assets/images/drawer/view_business_card.svg", LocaleKeys.viewBusinessCard.tr(), "", closeDrawer: false, onPress: () => showMDialog(context, child: BusinessCardDialog())), + menuItem("assets/images/drawer/logout.svg", LocaleKeys.logout.tr(), "", color: MyColors.redA3Color, closeDrawer: false, onPress: () {}), + ], + ).expanded, + const Divider( + height: 1, + thickness: 1, + color: MyColors.lightGreyEFColor, + ), + Row( + children: [ + RichText( + text: TextSpan(text: LocaleKeys.poweredBy.tr() + " ", style: const TextStyle(color: MyColors.grey98Color, fontSize: 14, letterSpacing: -0.56, fontWeight: FontWeight.w600), children: [ + TextSpan( + text: LocaleKeys.cloudSolutions.tr(), + style: const TextStyle(color: MyColors.grey3AColor, fontSize: 14, letterSpacing: -0.56, fontWeight: FontWeight.w600), + ), + ]), + ).expanded, + Image.asset("assets/images/logos/bn_cloud_soloution.jpg", width: 40, height: 40) + ], + ).paddingOnly(left: 21, right: 21, top: 21) + ], + ).paddingOnly(top: 21, bottom: 21), ); } + Widget menuItem(String icon, String title, String routeName, {Color? color, bool closeDrawer = true, VoidCallback? onPress}) { + return Row( + children: [ + SvgPicture.asset( + icon, + height: 20, + width: 20, + ), + 9.width, + title.toText14(color: color).expanded + ], + ).paddingOnly(left: 21, top: 10, bottom: 10).onPress(closeDrawer + ? () async { + Navigator.pop(context); + Future.delayed(const Duration(microseconds: 200), onPress); + } + : onPress!); + } + void drawerNavigator(context, routeName) { Navigator.of(context).pushNamed(routeName); } } - -String capitalizeOnlyFirstLater(String text) { - if (text.trim().isEmpty) return ""; - - return "${text[0].toUpperCase()}${text.substring(1)}"; -} diff --git a/pubspec.yaml b/pubspec.yaml index dde9d39..dd26813 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -111,6 +111,7 @@ flutter: - assets/images/ - assets/images/login/ - assets/images/logos/ + - assets/images/drawer/ - assets/icons/nfc/ic_nfc.png - assets/icons/nfc/ic_done.png