From 398880c4ad4bd8b8c5c4023ff3018c5237202bef Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Thu, 13 Oct 2022 11:24:42 +0300 Subject: [PATCH 1/2] bug fixes --- lib/classes/consts.dart | 4 +- lib/provider/dashboard_provider_model.dart | 90 +--- lib/ui/landing/dashboard_screen.dart | 492 ++++++++++++------ lib/ui/login/verify_last_login_screen.dart | 154 ++++-- lib/ui/my_team/my_team.dart | 24 +- .../dynamic_input_basic_details_screen.dart | 14 +- 6 files changed, 507 insertions(+), 271 deletions(-) diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 12f818e..17bd143 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -1,7 +1,7 @@ class ApiConsts { //static String baseUrl = "http://10.200.204.20:2801/"; // Local server - static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server - // static String baseUrl = "https://hmgwebservices.com"; // Live server + // static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server + static String baseUrl = "https://hmgwebservices.com"; // Live server static String baseUrlServices = baseUrl + "/Services/"; // server // static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; diff --git a/lib/provider/dashboard_provider_model.dart b/lib/provider/dashboard_provider_model.dart index 40e1ab5..c5286ef 100644 --- a/lib/provider/dashboard_provider_model.dart +++ b/lib/provider/dashboard_provider_model.dart @@ -60,13 +60,10 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { isAttendanceTrackingLoading = false; // isTimeRemainingInSeconds = calculateSeconds( "00:00:00"); if (attendanceTracking?.pSwipeIn != null) { - isTimeRemainingInSeconds = - calculateSeconds(attendanceTracking!.pRemainingHours ?? "00:00:00"); - int totalShiftTimeInSeconds = - calculateSeconds(attendanceTracking!.pScheduledHours ?? "00:00:00"); + isTimeRemainingInSeconds = calculateSeconds(attendanceTracking!.pRemainingHours ?? "00:00:00"); + int totalShiftTimeInSeconds = calculateSeconds(attendanceTracking!.pScheduledHours ?? "00:00:00"); progress = (isTimeRemainingInSeconds / totalShiftTimeInSeconds); - endTime = DateTime.now().millisecondsSinceEpoch + - Duration(seconds: isTimeRemainingInSeconds).inMilliseconds; + endTime = DateTime.now().millisecondsSinceEpoch + Duration(seconds: isTimeRemainingInSeconds).inMilliseconds; } notifyListeners(); @@ -100,6 +97,14 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { isOffersLoading = true; getOffersList = []; + drawerMenuItemList = [ + DrawerMenuItem("assets/images/drawer/my_profile.svg", LocaleKeys.myProfile.tr(), AppRoutes.profile), + DrawerMenuItem("assets/images/drawer/performance_evaluation.svg", LocaleKeys.performanceEvaluation.tr(), AppRoutes.performanceEvaluation), + 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(), AppRoutes.changePassword), + ]; + notifyListeners(); } @@ -122,8 +127,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { Future fetchWorkListCounter(context, {bool showLoading = false}) async { try { if (showLoading) Utils.showLoading(context); - GenericResponseModel? genericResponseModel = - await DashboardApiClient().getOpenNotifications(); + GenericResponseModel? genericResponseModel = await DashboardApiClient().getOpenNotifications(); isWorkListLoading = false; getOpenNotificationsList = genericResponseModel?.getOpenNotificationsList; @@ -132,14 +136,10 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { itgFormsModel = await DashboardApiClient().getItgFormsPendingTask(); workListCounter = workListCounter + (itgFormsModel?.totalCount ?? 0); - GenericResponseModel? cocGenericResponseModel = - await DashboardApiClient().getCOCNotifications(); + GenericResponseModel? cocGenericResponseModel = await DashboardApiClient().getCOCNotifications(); cocCount = cocGenericResponseModel?.mohemmITGPendingTaskResponseItem; if (cocCount != null) { - cocFinalCount = (cocCount?.escalation ?? 0) + - (cocCount?.waitingToClose ?? 0) + - (cocCount?.waitingForAcceptance ?? 0) + - (cocCount?.extendTATRequest ?? 0); + cocFinalCount = (cocCount?.escalation ?? 0) + (cocCount?.waitingToClose ?? 0) + (cocCount?.waitingForAcceptance ?? 0) + (cocCount?.extendTATRequest ?? 0); workListCounter += cocFinalCount; } if (showLoading) Utils.hideLoading(context); @@ -156,12 +156,9 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { //Missing Siwpe API's & Methods Future fetchMissingSwipe(context) async { try { - GenericResponseModel? genericResponseModel = - await DashboardApiClient().getOpenMissingSwipes(); + GenericResponseModel? genericResponseModel = await DashboardApiClient().getOpenMissingSwipes(); isMissingSwipeLoading = false; - missingSwipeCounter = - genericResponseModel!.getOpenMissingSwipesList!.pOpenMissingSwipes ?? - 0; + missingSwipeCounter = genericResponseModel!.getOpenMissingSwipesList!.pOpenMissingSwipes ?? 0; notifyListeners(); } catch (ex) { isMissingSwipeLoading = false; @@ -174,12 +171,10 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { //Leave and Ticket Balance API's & Methods Future fetchLeaveTicketBalance(context, DateTime date) async { try { - accrualList = await DashboardApiClient() - .getAccrualBalances(DateFormat("MM/dd/yyyy").format(date)); + accrualList = await DashboardApiClient().getAccrualBalances(DateFormat("MM/dd/yyyy").format(date)); isLeaveTicketBalanceLoading = false; leaveBalanceAccrual = accrualList![0]; - ticketBalance = (accrualList![1].accrualNetEntitlement ?? 0.0) + - (accrualList![2].accrualNetEntitlement ?? 0.0); + ticketBalance = (accrualList![1].accrualNetEntitlement ?? 0.0) + (accrualList![2].accrualNetEntitlement ?? 0.0); notifyListeners(); } catch (ex) { isLeaveTicketBalanceLoading = false; @@ -191,37 +186,18 @@ 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(), AppRoutes.performanceEvaluation), - 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(), AppRoutes.changePassword), - ]; + List drawerMenuItemList = []; void fetchListMenu() async { try { List menuList = await DashboardApiClient().getListMenu(); - List findMyRequest = - menuList.where((element) => element.menuType == "E").toList(); + List findMyRequest = menuList.where((element) => element.menuType == "E").toList(); if (findMyRequest.isNotEmpty) { - drawerMenuItemList.insert( - 3, - DrawerMenuItem("assets/images/drawer/my_requests.svg", - LocaleKeys.myRequest.tr(), AppRoutes.myRequests)); + drawerMenuItemList.insert(3, DrawerMenuItem("assets/images/drawer/my_requests.svg", LocaleKeys.myRequest.tr(), AppRoutes.myRequests)); } - List findMyTeam = - menuList.where((element) => element.menuType == "M").toList(); + List findMyTeam = menuList.where((element) => element.menuType == "M").toList(); if (findMyTeam.isNotEmpty) { - drawerMenuItemList.insert( - 2, - DrawerMenuItem("assets/images/drawer/my_team.svg", - LocaleKeys.myTeamMembers.tr(), AppRoutes.myTeam)); + drawerMenuItemList.insert(2, DrawerMenuItem("assets/images/drawer/my_team.svg", LocaleKeys.myTeamMembers.tr(), AppRoutes.myTeam)); } } catch (ex) { logger.wtf(ex); @@ -232,19 +208,12 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { //Menu Entries API's & Methods void fetchMenuEntries() async { try { - GenericResponseModel? genericResponseModel = - await DashboardApiClient().getGetMenuEntries(); + GenericResponseModel? genericResponseModel = await DashboardApiClient().getGetMenuEntries(); getMenuEntriesList = genericResponseModel!.getMenuEntriesList; homeMenus = parseMenus(getMenuEntriesList ?? []); if (homeMenus!.isNotEmpty) { - homeMenus!.first.menuEntiesList.insert( - 0, - GetMenuEntriesList( - requestType: "MONTHLY_ATTENDANCE", - prompt: LocaleKeys.monthlyAttendance.tr())); - homeMenus!.first.menuEntiesList.add(GetMenuEntriesList( - requestType: "VACATION_RULE", - prompt: LocaleKeys.vacationRule.tr())); + homeMenus!.first.menuEntiesList.insert(0, GetMenuEntriesList(requestType: "MONTHLY_ATTENDANCE", prompt: LocaleKeys.monthlyAttendance.tr())); + homeMenus!.first.menuEntiesList.add(GetMenuEntriesList(requestType: "VACATION_RULE", prompt: LocaleKeys.vacationRule.tr())); } isServicesMenusLoading = false; notifyListeners(); @@ -272,12 +241,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { List menus = []; for (int i = 0; i < getMenuEntriesList.length; i++) { if (getMenuEntriesList[i].parentMenuName!.isEmpty) { - menus.add(Menus( - getMenuEntriesList[i], - getMenuEntriesList - .where((element) => - getMenuEntriesList[i].menuName == element.parentMenuName) - .toList())); + menus.add(Menus(getMenuEntriesList[i], getMenuEntriesList.where((element) => getMenuEntriesList[i].menuName == element.parentMenuName).toList())); } } return menus; diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 95b39e8..0d8cdfd 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -38,7 +38,8 @@ class _DashboardScreenState extends State { late DashboardProviderModel data; final GlobalKey _scaffoldState = GlobalKey(); - final RefreshController _refreshController = RefreshController(initialRefresh: false); + final RefreshController _refreshController = + RefreshController(initialRefresh: false); int currentIndex = 0; @@ -106,7 +107,9 @@ class _DashboardScreenState extends State { _scaffoldState.currentState!.openDrawer(); }); }), - Image.asset("assets/images/logos/main_mohemm_logo.png", width: 134, height: 28).expanded, + Image.asset("assets/images/logos/main_mohemm_logo.png", + width: 134, height: 28) + .expanded, SizedBox( width: 36, height: 36, @@ -119,7 +122,9 @@ class _DashboardScreenState extends State { top: 0, child: Container( padding: const EdgeInsets.only(left: 5, right: 5), - decoration: BoxDecoration(color: MyColors.redColor, borderRadius: BorderRadius.circular(17)), + decoration: BoxDecoration( + color: MyColors.redColor, + borderRadius: BorderRadius.circular(17)), child: "3".toText12(color: Colors.white), ), ) @@ -134,7 +139,9 @@ class _DashboardScreenState extends State { child: SmartRefresher( enablePullDown: true, enablePullUp: false, - header: const MaterialClassicHeader(color: MyColors.gradiantEndColor,), + header: const MaterialClassicHeader( + color: MyColors.gradiantEndColor, + ), controller: _refreshController, onRefresh: _onRefresh, child: SingleChildScrollView( @@ -143,8 +150,11 @@ class _DashboardScreenState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.goodMorning.tr().toText14(color: MyColors.grey77Color), - (AppState().memberInformationList!.eMPLOYEENAME ?? "").toText24(isBold: true), + LocaleKeys.goodMorning + .tr() + .toText14(color: MyColors.grey77Color), + (AppState().memberInformationList!.eMPLOYEENAME ?? "") + .toText24(isBold: true), 16.height, Row( children: [ @@ -154,99 +164,210 @@ class _DashboardScreenState extends State { child: Consumer( builder: (context, model, child) { return (model.isAttendanceTrackingLoading - ? GetAttendanceTrackingShimmer() - : Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - gradient: const LinearGradient(transform: GradientRotation(.46), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ - MyColors.gradiantEndColor, - MyColors.gradiantStartColor, - ]), - ), - child: Stack( - alignment: Alignment.center, - children: [ - if (model.isTimeRemainingInSeconds == 0) SvgPicture.asset("assets/images/thumb.svg"), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, + ? GetAttendanceTrackingShimmer() + : Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(15), + gradient: + const LinearGradient( + transform: + GradientRotation( + .46), + begin: Alignment + .topRight, + end: Alignment + .bottomLeft, + colors: [ + MyColors + .gradiantEndColor, + MyColors + .gradiantStartColor, + ]), + ), + child: Stack( + alignment: Alignment.center, children: [ - LocaleKeys.markAttendance.tr().toText14(color: Colors.white, isBold: true), - if (model.isTimeRemainingInSeconds == 0) "01-02-2022".toText12(color: Colors.white), - if (model.isTimeRemainingInSeconds != 0) - Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - 9.height, - CountdownTimer( - endTime: model.endTime, - onEnd: null, - endWidget: "00:00:00".toText14(color: Colors.white, isBold: true), - textStyle: TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold), - ), - LocaleKeys.timeLeftToday.tr().toText12(color: Colors.white), - 9.height, - ClipRRect( - borderRadius: BorderRadius.all( - Radius.circular(20), - ), - child: LinearProgressIndicator( - value: model.progress, - minHeight: 8, - valueColor: const AlwaysStoppedAnimation(Colors.white), - backgroundColor: const Color(0xff196D73), - ), - ), - ], - ), - ], - ).paddingOnly(top: 12, right: 15, left: 12), - ), - Row( - children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, + if (model + .isTimeRemainingInSeconds == + 0) + SvgPicture.asset( + "assets/images/thumb.svg"), + Column( + crossAxisAlignment: + CrossAxisAlignment + .start, children: [ - LocaleKeys.checkIn.tr().toText12(color: Colors.white), - (model.attendanceTracking!.pSwipeIn == null ? "--:--" : model.attendanceTracking!.pSwipeIn) - .toString() - .toText14(color: Colors.white, isBold: true), - 4.height, + Expanded( + child: Column( + mainAxisSize: + MainAxisSize + .min, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + LocaleKeys + .markAttendance + .tr() + .toText14( + color: Colors + .white, + isBold: + true), + if (model + .isTimeRemainingInSeconds == + 0) + "01-02-2022".toText12( + color: Colors + .white), + if (model + .isTimeRemainingInSeconds != + 0) + Column( + mainAxisSize: + MainAxisSize + .min, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + 9.height, + CountdownTimer( + endTime: model + .endTime, + onEnd: + null, + endWidget: "00:00:00".toText14( + color: Colors + .white, + isBold: + true), + textStyle: TextStyle( + color: Colors + .white, + fontSize: + 14, + letterSpacing: + -0.48, + fontWeight: + FontWeight.bold), + ), + LocaleKeys + .timeLeftToday + .tr() + .toText12( + color: + Colors.white), + 9.height, + ClipRRect( + borderRadius: + BorderRadius + .all( + Radius.circular( + 20), + ), + child: + LinearProgressIndicator( + value: model + .progress, + minHeight: + 8, + valueColor: + const AlwaysStoppedAnimation(Colors.white), + backgroundColor: + const Color(0xff196D73), + ), + ), + ], + ), + ], + ).paddingOnly( + top: 12, + right: 15, + left: 12), + ), + Row( + children: [ + Expanded( + child: Column( + mainAxisSize: + MainAxisSize + .min, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + LocaleKeys + .checkIn + .tr() + .toText12( + color: + Colors.white), + (model.attendanceTracking!.pSwipeIn == + null + ? "--:--" + : model + .attendanceTracking! + .pSwipeIn) + .toString() + .toText14( + color: Colors + .white, + isBold: + true), + 4.height, + ], + ).paddingOnly( + left: 12), + ), + Container( + width: 45, + height: 45, + padding: + const EdgeInsets + .only( + left: 14, + right: + 14), + decoration: + const BoxDecoration( + color: Color( + 0xff259EA4), + borderRadius: + BorderRadius + .only( + bottomRight: Radius + .circular( + 15), + ), + ), + child: SvgPicture.asset( + model.isTimeRemainingInSeconds == + 0 + ? "assets/images/play.svg" + : "assets/images/stop.svg"), + ).onPress(() { + showMyBottomSheet( + context, + child: + MarkAttendanceWidget( + model)); + }), + ], + ), ], - ).paddingOnly(left: 12), - ), - Container( - width: 45, - height: 45, - padding: const EdgeInsets.only(left: 14, right: 14), - decoration: const BoxDecoration( - color: Color(0xff259EA4), - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(15), - ), ), - child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/play.svg" : "assets/images/stop.svg"), - ).onPress(() { - showMyBottomSheet(context, child: MarkAttendanceWidget(model)); - }), - ], - ), - ], - ), - ], - ), - ).onPress( - () { - Navigator.pushNamed(context, AppRoutes.todayAttendance); - }, - )) + ], + ), + ).onPress( + () { + Navigator.pushNamed( + context, + AppRoutes + .todayAttendance); + }, + )) .animatedSwither(); }, ), @@ -267,8 +388,11 @@ class _DashboardScreenState extends State { padding: const EdgeInsets.only(top: 31), decoration: BoxDecoration( color: Colors.white, - borderRadius: const BorderRadius.only(topRight: Radius.circular(50), topLeft: Radius.circular(50)), - border: Border.all(color: MyColors.lightGreyEDColor, width: 1), + borderRadius: const BorderRadius.only( + topRight: Radius.circular(50), + topLeft: Radius.circular(50)), + border: Border.all( + color: MyColors.lightGreyEDColor, width: 1), ), child: Column( mainAxisSize: MainAxisSize.min, @@ -284,22 +408,32 @@ class _DashboardScreenState extends State { LocaleKeys.offers.tr().toText12(), Row( children: [ - LocaleKeys.discounts.tr().toText24(isBold: true), + LocaleKeys.discounts + .tr() + .toText24(isBold: true), 6.width, Container( - padding: const EdgeInsets.only(left: 8, right: 8), + padding: const EdgeInsets.only( + left: 8, right: 8), decoration: BoxDecoration( color: MyColors.yellowColor, - borderRadius: BorderRadius.circular(10), + borderRadius: + BorderRadius.circular(10), ), - child: LocaleKeys.newString.tr().toText10(isBold: true)), + child: LocaleKeys.newString + .tr() + .toText10(isBold: true)), ], ), ], ), ), - LocaleKeys.viewAllOffers.tr().toText12(isUnderLine: true).onPress(() { - Navigator.pushNamed(context, AppRoutes.offersAndDiscounts); + LocaleKeys.viewAllOffers + .tr() + .toText12(isUnderLine: true) + .onPress(() { + Navigator.pushNamed( + context, AppRoutes.offersAndDiscounts); }) ], ).paddingOnly(left: 21, right: 21), @@ -310,53 +444,86 @@ class _DashboardScreenState extends State { child: ListView.separated( shrinkWrap: true, physics: const BouncingScrollPhysics(), - padding: const EdgeInsets.only(left: 21, right: 21, top: 13), + padding: const EdgeInsets.only( + left: 21, right: 21, top: 13), scrollDirection: Axis.horizontal, itemBuilder: (cxt, index) { return model.isOffersLoading ? const OffersShimmerWidget() : InkWell( - onTap: () { - navigateToDetails(data.getOffersList[index]); - }, - child: SizedBox( - width: 73, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( + onTap: () { + navigateToDetails( + data.getOffersList[index]); + }, + child: SizedBox( width: 73, - height: 73, - decoration: BoxDecoration( - borderRadius: const BorderRadius.all( - Radius.circular(100), - ), - border: Border.all(color: MyColors.lightGreyE3Color, width: 1), - ), - child: ClipRRect( - borderRadius: const BorderRadius.all( - Radius.circular(50), - ), - child: Hero( - tag: "ItemImage" + data.getOffersList[index].rowID!, - transitionOnUserGestures: true, - child: Image.network( - data.getOffersList[index].bannerImage!, - fit: BoxFit.contain, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Container( + width: 73, + height: 73, + decoration: BoxDecoration( + borderRadius: + const BorderRadius + .all( + Radius.circular(100), + ), + border: Border.all( + color: MyColors + .lightGreyE3Color, + width: 1), + ), + child: ClipRRect( + borderRadius: + const BorderRadius + .all( + Radius.circular(50), + ), + child: Hero( + tag: "ItemImage" + + data + .getOffersList[ + index] + .rowID!, + transitionOnUserGestures: + true, + child: Image.network( + data + .getOffersList[ + index] + .bannerImage!, + fit: BoxFit.contain, + ), + ), + ), ), - ), + 4.height, + Expanded( + child: AppState() + .isArabic(context) + ? data + .getOffersList[ + index] + .titleAR! + .toText12( + isCenter: + true, + maxLine: 1) + : data + .getOffersList[ + index] + .title! + .toText12( + isCenter: + true, + maxLine: 1), + ), + ], ), ), - 4.height, - Expanded( - child: AppState().isArabic(context) - ? data.getOffersList[index].titleAR!.toText12(isCenter: true, maxLine: 1) - : data.getOffersList[index].title!.toText12(isCenter: true, maxLine: 1), - ), - ], - ), - ), - ); + ); }, separatorBuilder: (cxt, index) => 8.width, itemCount: 6), @@ -383,14 +550,18 @@ class _DashboardScreenState extends State { BottomNavigationBarItem( icon: SvgPicture.asset( "assets/icons/home.svg", - color: currentIndex == 0 ? MyColors.grey3AColor : MyColors.grey98Color, + color: currentIndex == 0 + ? MyColors.grey3AColor + : MyColors.grey98Color, ).paddingAll(4), label: LocaleKeys.home.tr(), ), BottomNavigationBarItem( icon: SvgPicture.asset( "assets/icons/create_req.svg", - color: currentIndex == 1 ? MyColors.grey3AColor : MyColors.grey98Color, + color: currentIndex == 1 + ? MyColors.grey3AColor + : MyColors.grey98Color, ).paddingAll(4), label: LocaleKeys.createRequest.tr(), ), @@ -400,7 +571,9 @@ class _DashboardScreenState extends State { children: [ SvgPicture.asset( "assets/icons/work_list.svg", - color: currentIndex == 2 ? MyColors.grey3AColor : MyColors.grey98Color, + color: currentIndex == 2 + ? MyColors.grey3AColor + : MyColors.grey98Color, ).paddingAll(4), Consumer( builder: (cxt, data, child) { @@ -413,8 +586,12 @@ class _DashboardScreenState extends State { child: Container( padding: const EdgeInsets.only(left: 4, right: 4), alignment: Alignment.center, - decoration: BoxDecoration(color: MyColors.redColor, borderRadius: BorderRadius.circular(17)), - child: data.workListCounter.toString().toText10(color: Colors.white), + decoration: BoxDecoration( + color: MyColors.redColor, + borderRadius: BorderRadius.circular(17)), + child: data.workListCounter + .toString() + .toText10(color: Colors.white), ), ); }, @@ -426,19 +603,29 @@ class _DashboardScreenState extends State { BottomNavigationBarItem( icon: SvgPicture.asset( "assets/icons/item_for_sale.svg", - color: currentIndex == 3 ? MyColors.grey3AColor : MyColors.grey98Color, + color: currentIndex == 3 + ? MyColors.grey3AColor + : MyColors.grey98Color, ).paddingAll(4), label: LocaleKeys.itemsForSale.tr(), ), ], currentIndex: currentIndex, - selectedLabelStyle: const TextStyle(fontSize: 10, color: MyColors.grey3AColor, fontWeight: FontWeight.w600), - unselectedLabelStyle: const TextStyle(fontSize: 10, color: MyColors.grey98Color, fontWeight: FontWeight.w600), + selectedLabelStyle: const TextStyle( + fontSize: 10, + color: MyColors.grey3AColor, + fontWeight: FontWeight.w600), + unselectedLabelStyle: const TextStyle( + fontSize: 10, + color: MyColors.grey98Color, + fontWeight: FontWeight.w600), type: BottomNavigationBarType.fixed, selectedItemColor: MyColors.grey3AColor, backgroundColor: MyColors.backgroundColor, - selectedIconTheme: const IconThemeData(color: MyColors.grey3AColor, size: 28), - unselectedIconTheme: const IconThemeData(color: MyColors.grey98Color, size: 28), + selectedIconTheme: + const IconThemeData(color: MyColors.grey3AColor, size: 28), + unselectedIconTheme: + const IconThemeData(color: MyColors.grey98Color, size: 28), onTap: (int index) { if (index == 1) { Navigator.pushNamed(context, AppRoutes.mowadhafhi); @@ -469,6 +656,7 @@ class _DashboardScreenState extends State { } }); - Navigator.pushNamed(context, AppRoutes.offersAndDiscountsDetails, arguments: getOffersDetailList); + Navigator.pushNamed(context, AppRoutes.offersAndDiscountsDetails, + arguments: getOffersDetailList); } } diff --git a/lib/ui/login/verify_last_login_screen.dart b/lib/ui/login/verify_last_login_screen.dart index 6dfaaae..4d653ed 100644 --- a/lib/ui/login/verify_last_login_screen.dart +++ b/lib/ui/login/verify_last_login_screen.dart @@ -57,21 +57,30 @@ class _VerifyLastLoginScreenState extends State { @override Widget build(BuildContext context) { - mobileLoginInfoListModel ??= ModalRoute.of(context)!.settings.arguments as GetMobileLoginInfoListModel; - String empName = AppState().isArabic(context) ? AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEAr! : AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEEn!; + mobileLoginInfoListModel ??= ModalRoute.of(context)!.settings.arguments + as GetMobileLoginInfoListModel; + String empName = AppState().isArabic(context) + ? AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEAr! + : AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEEn!; return Scaffold( appBar: AppBar( backgroundColor: Colors.transparent, automaticallyImplyLeading: false, title: (mobileLoginInfoListModel?.businessCardPrivilege ?? false) - ? LocaleKeys.viewBusinessCard.tr().toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() { + ? LocaleKeys.viewBusinessCard + .tr() + .toText12(color: MyColors.textMixColor, isUnderLine: true) + .onPress(() { showMDialog(context, child: BusinessCardDialog()); }) : null, actions: [ Center( - child: LocaleKeys.employeeDigitalID.tr().toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() { + child: LocaleKeys.employeeDigitalID + .tr() + .toText12(color: MyColors.textMixColor, isUnderLine: true) + .onPress(() { showMDialog(context, child: EmployeeDigitialIdDialog()); })), 21.width @@ -90,9 +99,12 @@ class _VerifyLastLoginScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ LocaleKeys.welcomeBack.tr().toText12(), - mobileLoginInfoListModel!.employeeName!.toText24(isBold: true), + mobileLoginInfoListModel!.employeeName! + .toText24(isBold: true), 10.height, - LocaleKeys.wouldYouLikeToLoginWithCurrentUsername.tr().toText16(), + LocaleKeys.wouldYouLikeToLoginWithCurrentUsername + .tr() + .toText16(), Container( height: 72, margin: const EdgeInsets.only(top: 23, bottom: 23), @@ -114,26 +126,42 @@ class _VerifyLastLoginScreenState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ LocaleKeys.lastLoginDetails.tr().toText16(), - DateUtil.formatDateToDate(DateUtil.convertStringToDate(mobileLoginInfoListModel!.editedOn!), false).toText12(), + DateUtil.formatDateToDate( + DateUtil.convertStringToDate( + mobileLoginInfoListModel!.editedOn!), + false) + .toText12(), ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ - LocaleKeys.verificationType.tr().toText10(color: MyColors.grey57Color), - getVerificationType(mobileLoginInfoListModel!.loginType!).toText12(), + LocaleKeys.verificationType + .tr() + .toText10(color: MyColors.grey57Color), + getVerificationType( + mobileLoginInfoListModel!.loginType!) + .toText12(), Expanded(child: SizedBox()), - DateUtil.formatDateToTime(DateUtil.convertStringToDate(mobileLoginInfoListModel!.editedOn!)).toText12(), + DateUtil.formatDateToTime( + DateUtil.convertStringToDate( + mobileLoginInfoListModel!.editedOn!)) + .toText12(), ], ) ], ), ), LocaleKeys.pleaseVerify.tr().toText16(), - if (isNeedVerifyWithFaceIDAndBiometrics) LocaleKeys.pleaseVerifyForBio.tr().toText12(), + if (isNeedVerifyWithFaceIDAndBiometrics) + LocaleKeys.pleaseVerifyForBio.tr().toText12(), GridView( - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9), + gridDelegate: + const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 13, + mainAxisSpacing: 9), physics: const NeverScrollableScrollPhysics(), padding: const EdgeInsets.only(top: 9), shrinkWrap: true, @@ -186,7 +214,9 @@ class _VerifyLastLoginScreenState extends State { DefaultButton( LocaleKeys.useAnotherAccount.tr(), () { - Navigator.pushNamedAndRemoveUntil(context, AppRoutes.login, (Route route) => false, arguments: false); + Navigator.pushNamedAndRemoveUntil( + context, AppRoutes.login, (Route route) => false, + arguments: false); }, ).insideContainer, ], @@ -218,11 +248,19 @@ class _VerifyLastLoginScreenState extends State { } Future loginWithFaceIDAndBiometrics() async { - IOSAuthMessages iosStrings = - const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID'); + IOSAuthMessages iosStrings = const IOSAuthMessages( + cancelButton: 'cancel', + goToSettingsButton: 'settings', + goToSettingsDescription: 'Please set up your Touch ID.', + lockOut: 'Please reenable your Touch ID'); bool authenticated = false; try { - authenticated = await auth.authenticate(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, biometricOnly: true, iOSAuthStrings: iosStrings); + authenticated = await auth.authenticate( + localizedReason: 'Scan your fingerprint to authenticate', + useErrorDialogs: true, + stickyAuth: true, + biometricOnly: true, + iOSAuthStrings: iosStrings); } on PlatformException catch (e) { print(e); Utils.hideLoading(context); @@ -231,8 +269,11 @@ class _VerifyLastLoginScreenState extends State { return authenticated; } - Widget _loginOptionButton(String _title, String _icon, int _flag, int? _loginIndex) { - bool isDisable = ((_flag == 3 && !checkBiometricIsAvailable(BiometricType.face)) || (_flag == 4 && !checkBiometricIsAvailable(BiometricType.fingerprint))); + Widget _loginOptionButton( + String _title, String _icon, int _flag, int? _loginIndex) { + bool isDisable = ((_flag == 3 && + !checkBiometricIsAvailable(BiometricType.face)) || + (_flag == 4 && !checkBiometricIsAvailable(BiometricType.fingerprint))); return InkWell( onTap: isDisable ? null @@ -243,18 +284,21 @@ class _VerifyLastLoginScreenState extends State { }); } else { if (_flag == 3 || _flag == 4) { - bool authenticateWithFaceAndTouchID = await loginWithFaceIDAndBiometrics(); + bool authenticateWithFaceAndTouchID = + await loginWithFaceIDAndBiometrics(); if (!authenticateWithFaceAndTouchID) { return; } else { - if (mobileLoginInfoListModel!.loginType == 3 || mobileLoginInfoListModel!.loginType == 4) { + if (mobileLoginInfoListModel!.loginType == 3 || + mobileLoginInfoListModel!.loginType == 4) { // bool authenticateWithFaceAndTouchID = await loginWithFaceIDAndBiometrics(); // if (!authenticateWithFaceAndTouchID) { // return; // } else { // performApiCall(_title, _icon, _flag, isDirectLogin: true); // } - performApiCall(_title, _icon, _flag, _flag, isDirectLogin: true); + performApiCall(_title, _icon, _flag, _flag, + isDirectLogin: true); } else { isNeedVerifyWithFaceIDAndBiometrics = true; selectedFlag = _flag; @@ -272,7 +316,8 @@ class _VerifyLastLoginScreenState extends State { } }, child: Container( - padding: const EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), + padding: + const EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), color: isDisable ? Colors.grey.withOpacity(0.3) : Colors.white, @@ -298,13 +343,23 @@ class _VerifyLastLoginScreenState extends State { Widget getButton(int flag) { switch (flag) { case 1: - return _loginOptionButton(LocaleKeys.verifyThroughSMS.tr(), 'assets/images/login/verify_sms.svg', flag, null); + return _loginOptionButton(LocaleKeys.verifyThroughSMS.tr(), + 'assets/images/login/verify_sms.svg', flag, null); case 2: - return _loginOptionButton(LocaleKeys.verifyThroughWhatsapp.tr(), 'assets/images/login/verify_whatsapp.svg', flag, null); + return _loginOptionButton(LocaleKeys.verifyThroughWhatsapp.tr(), + 'assets/images/login/verify_whatsapp.svg', flag, null); case 3: - return _loginOptionButton(LocaleKeys.verifyThroughFace.tr(), 'assets/images/login/verify_face.svg', flag, BiometricType.face.index); + return _loginOptionButton( + LocaleKeys.verifyThroughFace.tr(), + 'assets/images/login/verify_face.svg', + flag, + BiometricType.face.index); case 4: - return _loginOptionButton(LocaleKeys.verifyThroughFingerprint.tr(), 'assets/images/login/verify_thumb.svg', flag, BiometricType.fingerprint.index); + return _loginOptionButton( + LocaleKeys.verifyThroughFingerprint.tr(), + 'assets/images/login/verify_thumb.svg', + flag, + BiometricType.fingerprint.index); default: return const SizedBox(); } @@ -321,7 +376,9 @@ class _VerifyLastLoginScreenState extends State { return isAvailable; } - Future performApiCall(String _title, String _icon, int _flag, int sendVerificationFlat, {bool isDirectLogin = false}) async { + Future performApiCall( + String _title, String _icon, int _flag, int sendVerificationFlat, + {bool isDirectLogin = false}) async { try { if (isDirectLogin) setState(() { @@ -330,10 +387,16 @@ class _VerifyLastLoginScreenState extends State { else Utils.showLoading(context); await LoginApiClient().checkMobileAppVersion(); - await LoginApiClient().memberLogin(AppState().getUserName!, AppState().password!); + await LoginApiClient() + .memberLogin(AppState().getUserName!, AppState().password!); if (!isDirectLogin) BasicMemberInformationModel? memberInformationModel = - await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName); + await LoginApiClient() + .mohemmSendActivationCodeByOTPNotificationType( + 0, + AppState().memberLoginList?.pMOBILENUMBER, + sendVerificationFlat, + AppState().getUserName); if (isDirectLogin) performDirectApiCall(_title, _icon, _flag, ""); if (!isDirectLogin) Utils.hideLoading(context); if (!isDirectLogin) @@ -355,25 +418,34 @@ class _VerifyLastLoginScreenState extends State { } } - Future performDirectApiCall(String _title, String _icon, int _flag, String value, {bool isDirectLogin = false}) async { + Future performDirectApiCall( + String _title, String _icon, int _flag, String value, + {bool isDirectLogin = false}) async { try { - GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(false, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName); - GenericResponseModel? genericResponseModel1 = await LoginApiClient().insertMobileLoginInfoNEW( - AppState().memberLoginList?.pEMAILADDRESS ?? "", - genericResponseModel?.pSESSIONID ?? 0, - genericResponseModel?.memberInformationList![0].eMPLOYEENAME ?? "", - _flag, - AppState().memberLoginList?.pMOBILENUMBER ?? "", - AppState().getUserName!, - mobileLoginInfoListModel!.deviceToken!, - Platform.isAndroid ? "android" : "ios"); + GenericResponseModel? genericResponseModel = await LoginApiClient() + .checkActivationCode(false, AppState().memberLoginList?.pMOBILENUMBER, + value, AppState().getUserName); + GenericResponseModel? genericResponseModel1 = await LoginApiClient() + .insertMobileLoginInfoNEW( + AppState().memberLoginList?.pEMAILADDRESS ?? "", + genericResponseModel?.pSESSIONID ?? 0, + genericResponseModel?.memberInformationList![0].eMPLOYEENAME ?? + "", + _flag, + AppState().memberLoginList?.pMOBILENUMBER ?? "", + AppState().getUserName!, + mobileLoginInfoListModel!.deviceToken!, + Platform.isAndroid ? "android" : "ios"); + AppState().setMemberInformationListModel = + genericResponseModel!.memberInformationList?.first; if (genericResponseModel?.errorMessage != null) { Utils.showToast(genericResponseModel?.errorMessage ?? ""); // Navigator.pop(context); } Utils.hideLoading(context); Navigator.pop(context); - Navigator.pushNamedAndRemoveUntil(context, AppRoutes.dashboard, (Route route) => false); + Navigator.pushNamedAndRemoveUntil( + context, AppRoutes.dashboard, (Route route) => false); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); diff --git a/lib/ui/my_team/my_team.dart b/lib/ui/my_team/my_team.dart index 2187960..bbdce84 100644 --- a/lib/ui/my_team/my_team.dart +++ b/lib/ui/my_team/my_team.dart @@ -67,17 +67,23 @@ class _MyTeamState extends State { Row( children: [ TextField( - onChanged: dropdownValue == "name" + onChanged: dropdownValue.toLowerCase() == "name" ? (String value) { getEmployeeSListOnSearch = getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEENAME!.toLowerCase().contains(value.toLowerCase())).toList(); setState(() {}); } - : (String value) { - getEmployeeSListOnSearch = - getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEEEMAILADDRESS!.toLowerCase().contains(value.toLowerCase())).toList(); - setState(() {}); - }, + : dropdownValue.toLowerCase() == "username" + ? (String value) { + getEmployeeSListOnSearch = + getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEENUMBER!.toLowerCase().contains(value.toLowerCase())).toList(); + setState(() {}); + } + : (String value) { + getEmployeeSListOnSearch = + getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEEEMAILADDRESS!.toLowerCase().contains(value.toLowerCase())).toList(); + setState(() {}); + }, style: const TextStyle( fontSize: 14.0, color: MyColors.grey3AColor, @@ -113,9 +119,9 @@ class _MyTeamState extends State { shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), padding: const EdgeInsets.only(top: 12), - separatorBuilder: (BuildContext cxt,int index) => 12.height, + separatorBuilder: (BuildContext cxt, int index) => 12.height, itemCount: _textEditingController!.text.isNotEmpty ? getEmployeeSListOnSearch.length : getEmployeeSubordinatesList.length, - itemBuilder: (BuildContext cxt,int index) { + itemBuilder: (BuildContext cxt, int index) { var phoneNumber = Uri.parse('tel:${getEmployeeSListOnSearch[index].eMPLOYEEMOBILENUMBER}'); return InkWell( onTap: () async { @@ -177,7 +183,7 @@ class _MyTeamState extends State { } // todo @fatima add translation for below list - List list = [LocaleKeys.name.tr(), LocaleKeys.email.tr()]; + List list = [LocaleKeys.name.tr(), LocaleKeys.email.tr(), LocaleKeys.username.tr()]; Widget dropDown() { return PopupMenuButton( itemBuilder: (_) => >[ diff --git a/lib/ui/profile/dynamic_screens/dynamic_input_basic_details_screen.dart b/lib/ui/profile/dynamic_screens/dynamic_input_basic_details_screen.dart index 923d3a8..3127bec 100644 --- a/lib/ui/profile/dynamic_screens/dynamic_input_basic_details_screen.dart +++ b/lib/ui/profile/dynamic_screens/dynamic_input_basic_details_screen.dart @@ -67,11 +67,17 @@ class _DynamicInputScreenState extends State { getBasicDetColsStructureList = genericResponseModel?.getBasicDetColsStructureList ?? []; if (dynamicParams!.correctOrNew == 1) { - getBasicDetDffStructureList?.forEach((element) { - element.userBasicDetail = dynamicParams!.getEmployeeBasicDetailsList!.singleWhere((userDetail) => userDetail.aPPLICATIONCOLUMNNAME == element.aPPLICATIONCOLUMNNAME); + getBasicDetDffStructureList?.forEach((GetBasicDetDffStructureList element) { + element.userBasicDetail = + dynamicParams!.getEmployeeBasicDetailsList!.singleWhere((GetEmployeeBasicDetailsList userDetail) => userDetail.aPPLICATIONCOLUMNNAME == element.aPPLICATIONCOLUMNNAME); }); - getBasicDetColsStructureList?.forEach((element) { - element.userBasicDetail = dynamicParams!.getEmployeeBasicDetailsList!.singleWhere((userDetail) => userDetail.aPPLICATIONCOLUMNNAME == element.aPPLICATIONCOLUMNNAME); + getBasicDetColsStructureList?.forEach((GetBasicDetColsStructureList element) { + element.userBasicDetail = + dynamicParams!.getEmployeeBasicDetailsList!.singleWhere((GetEmployeeBasicDetailsList userDetail) => userDetail.aPPLICATIONCOLUMNNAME == element.aPPLICATIONCOLUMNNAME); + if (element.objectValuesList != null) { + ObjectValuesList dropDownListValue = element.objectValuesList!.singleWhere((ObjectValuesList dropdown) => dropdown.cODE == element.userBasicDetail!.vARCHAR2VALUE); + element.userBasicDetail!.sEGMENTVALUEDSP = dropDownListValue.mEANING; + } }); } else { getBasicDetDffStructureList?.forEach((element) { From eaae618f25e09233b27ffe3ab11e638b250b57e1 Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Thu, 13 Oct 2022 15:41:44 +0300 Subject: [PATCH 2/2] bug fixes --- lib/ui/profile/widgets/profile_info.dart | 34 ++++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/ui/profile/widgets/profile_info.dart b/lib/ui/profile/widgets/profile_info.dart index 1ac5f93..73635d8 100644 --- a/lib/ui/profile/widgets/profile_info.dart +++ b/lib/ui/profile/widgets/profile_info.dart @@ -42,23 +42,23 @@ class ProfileInFo extends StatelessWidget { appreciationTime(LocaleKeys.day.tr(), memberInfo.sERVICEDAYS.toString()), ]).paddingOnly(bottom: 12, top: 12), const Divider(height: 8, thickness: 8, color: MyColors.lightGreyEFColor), - Column( - // mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - (LocaleKeys.profile_profileCompletionPer.tr() + ' 75%').toText16(), - 8.height, - Row( - children: [ - for (var i = 0; i < 4; i++) - if (i < 3) Expanded(child: drawSlider(Color(0xff2BB8A6))) else Expanded(child: drawSlider(const Color(0xffefefef))) - ], - ), - 14.height, - LocaleKeys.profile_completeProfile.tr().toText16(color: MyColors.textMixColor, isUnderLine: true), - ], - ).paddingOnly(left: 21, right: 21, bottom: 18, top: 12), - const Divider(height: 8, thickness: 8, color: MyColors.lightGreyEFColor), + // Column( + // // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // (LocaleKeys.profile_profileCompletionPer.tr() + ' 75%').toText16(), + // 8.height, + // Row( + // children: [ + // for (var i = 0; i < 4; i++) + // if (i < 3) Expanded(child: drawSlider(Color(0xff2BB8A6))) else Expanded(child: drawSlider(const Color(0xffefefef))) + // ], + // ), + // 14.height, + // LocaleKeys.profile_completeProfile.tr().toText16(color: MyColors.textMixColor, isUnderLine: true), + // ], + // ).paddingOnly(left: 21, right: 21, bottom: 18, top: 12), + // const Divider(height: 8, thickness: 8, color: MyColors.lightGreyEFColor), ListView.separated( padding: EdgeInsets.zero, shrinkWrap: true,