diff --git a/lib/classes/colors.dart b/lib/classes/colors.dart index 70e46da..eb25c48 100644 --- a/lib/classes/colors.dart +++ b/lib/classes/colors.dart @@ -46,7 +46,7 @@ class MyColors { static const Color grey3AColor = Color(0xff2E303A); static const Color darkColor = Color(0xff000015); static const Color lightGrayColor = Color(0xff808080); - static const Color DarkRedColor = Color(0xffD02127); + static const Color darkRedColor = Color(0xffD02127); static const Color lightGreyColor = Color(0xffC7C7C7); static const Color green69Color = Color(0xff1FA169); static const Color redA3Color = Color(0xffCA3332); diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 0d8cdfd..b6f3599 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -38,8 +38,7 @@ 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; @@ -107,29 +106,9 @@ class _DashboardScreenState extends State { _scaffoldState.currentState!.openDrawer(); }); }), - Image.asset("assets/images/logos/main_mohemm_logo.png", - width: 134, height: 28) - .expanded, - SizedBox( - width: 36, - height: 36, - child: Stack( - alignment: Alignment.centerLeft, - children: [ - SvgPicture.asset("assets/images/announcements.svg"), - Positioned( - right: 0, - top: 0, - child: Container( - padding: const EdgeInsets.only(left: 5, right: 5), - decoration: BoxDecoration( - color: MyColors.redColor, - borderRadius: BorderRadius.circular(17)), - child: "3".toText12(color: Colors.white), - ), - ) - ], - ), + Image.asset("assets/images/logos/main_mohemm_logo.png", width: 134, height: 28).expanded, + SvgPicture.asset( + "assets/images/announcements.svg", ).onPress(() async { await Navigator.pushNamed(context, AppRoutes.announcements); }) @@ -150,11 +129,8 @@ 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: [ @@ -167,192 +143,84 @@ class _DashboardScreenState extends State { ? 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, - ]), + 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"), + if (model.isTimeRemainingInSeconds == 0) SvgPicture.asset("assets/images/thumb.svg"), Column( - crossAxisAlignment: - CrossAxisAlignment - .start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: Column( - mainAxisSize: - MainAxisSize - .min, - crossAxisAlignment: - CrossAxisAlignment - .start, + 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) + 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, + 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), + 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), + LocaleKeys.timeLeftToday.tr().toText12(color: Colors.white), 9.height, ClipRRect( - borderRadius: - BorderRadius - .all( - Radius.circular( - 20), + borderRadius: BorderRadius.all( + Radius.circular(20), ), - child: - LinearProgressIndicator( - value: model - .progress, - minHeight: - 8, - valueColor: - const AlwaysStoppedAnimation(Colors.white), - backgroundColor: - const Color(0xff196D73), + child: LinearProgressIndicator( + value: model.progress, + minHeight: 8, + valueColor: const AlwaysStoppedAnimation(Colors.white), + backgroundColor: const Color(0xff196D73), ), ), ], ), ], - ).paddingOnly( - top: 12, - right: 15, - left: 12), + ).paddingOnly(top: 12, right: 15, left: 12), ), Row( children: [ Expanded( child: Column( - mainAxisSize: - MainAxisSize - .min, - crossAxisAlignment: - CrossAxisAlignment - .start, + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys - .checkIn - .tr() - .toText12( - color: - Colors.white), - (model.attendanceTracking!.pSwipeIn == - null - ? "--:--" - : model - .attendanceTracking! - .pSwipeIn) + LocaleKeys.checkIn.tr().toText12(color: Colors.white), + (model.attendanceTracking!.pSwipeIn == null ? "--:--" : model.attendanceTracking!.pSwipeIn) .toString() - .toText14( - color: Colors - .white, - isBold: - true), + .toText14(color: Colors.white, isBold: true), 4.height, ], - ).paddingOnly( - left: 12), + ).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), + 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"), + child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/play.svg" : "assets/images/stop.svg"), ).onPress(() { - showMyBottomSheet( - context, - child: - MarkAttendanceWidget( - model)); + showMyBottomSheet(context, child: MarkAttendanceWidget(model)); }), ], ), @@ -362,10 +230,7 @@ class _DashboardScreenState extends State { ), ).onPress( () { - Navigator.pushNamed( - context, - AppRoutes - .todayAttendance); + Navigator.pushNamed(context, AppRoutes.todayAttendance); }, )) .animatedSwither(); @@ -388,11 +253,8 @@ 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, @@ -408,32 +270,22 @@ 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), @@ -444,56 +296,38 @@ 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]); + navigateToDetails(data.getOffersList[index]); }, child: SizedBox( width: 73, child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( width: 73, height: 73, decoration: BoxDecoration( - borderRadius: - const BorderRadius - .all( + borderRadius: const BorderRadius.all( Radius.circular(100), ), - border: Border.all( - color: MyColors - .lightGreyE3Color, - width: 1), + border: Border.all(color: MyColors.lightGreyE3Color, width: 1), ), child: ClipRRect( - borderRadius: - const BorderRadius - .all( + borderRadius: const BorderRadius.all( Radius.circular(50), ), child: Hero( - tag: "ItemImage" + - data - .getOffersList[ - index] - .rowID!, - transitionOnUserGestures: - true, + tag: "ItemImage" + data.getOffersList[index].rowID!, + transitionOnUserGestures: true, child: Image.network( - data - .getOffersList[ - index] - .bannerImage!, + data.getOffersList[index].bannerImage!, fit: BoxFit.contain, ), ), @@ -501,24 +335,9 @@ class _DashboardScreenState extends State { ), 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), + child: AppState().isArabic(context) + ? data.getOffersList[index].titleAR!.toText12(isCenter: true, maxLine: 1) + : data.getOffersList[index].title!.toText12(isCenter: true, maxLine: 1), ), ], ), @@ -550,18 +369,14 @@ 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(), ), @@ -571,9 +386,7 @@ 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) { @@ -586,12 +399,8 @@ 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), ), ); }, @@ -603,29 +412,19 @@ 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); @@ -656,7 +455,6 @@ class _DashboardScreenState extends State { } }); - Navigator.pushNamed(context, AppRoutes.offersAndDiscountsDetails, - arguments: getOffersDetailList); + Navigator.pushNamed(context, AppRoutes.offersAndDiscountsDetails, arguments: getOffersDetailList); } } diff --git a/lib/ui/landing/widget/menus_widget.dart b/lib/ui/landing/widget/menus_widget.dart index 6e550ec..60b194a 100644 --- a/lib/ui/landing/widget/menus_widget.dart +++ b/lib/ui/landing/widget/menus_widget.dart @@ -18,6 +18,7 @@ class MenusWidget extends StatelessWidget { return Consumer( builder: (cxt, data, child) { + print("data.workListCounter:${data.workListCounter}"); return GridView( gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 2 / 2, crossAxisSpacing: 9, mainAxisSpacing: 9), padding: EdgeInsets.zero, @@ -44,11 +45,7 @@ class MenusWidget extends StatelessWidget { Expanded( child: data.workListCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), ), - RotatedBox( - quarterTurns: AppState().isArabic(context) ? 2:4, - child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) - ), - + RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), ], ) ], @@ -75,10 +72,7 @@ class MenusWidget extends StatelessWidget { Expanded( child: data.missingSwipeCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), ), - RotatedBox( - quarterTurns: AppState().isArabic(context) ? 2:4, - child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) - ), + RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), ], ) ], @@ -105,10 +99,7 @@ class MenusWidget extends StatelessWidget { Expanded( child: data.leaveBalance.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), ), - RotatedBox( - quarterTurns: AppState().isArabic(context) ? 2:4, - child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) - ), + RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), ], ) ], @@ -135,10 +126,7 @@ class MenusWidget extends StatelessWidget { Expanded( child: data.ticketBalance.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), ), - RotatedBox( - quarterTurns: AppState().isArabic(context) ? 2:4, - child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) - ), + RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), ], ) ], diff --git a/lib/ui/work_list/itg_detail_screen.dart b/lib/ui/work_list/itg_detail_screen.dart index e0c256c..b1deae8 100644 --- a/lib/ui/work_list/itg_detail_screen.dart +++ b/lib/ui/work_list/itg_detail_screen.dart @@ -123,9 +123,7 @@ class _ItgDetailScreenState extends State { }, children: [ RequestDetailFragment(fields: itgRequest?.fieldGoups?[1].fields ?? []), - ApprovalLevelfragment( - wFHistory: itgRequest?.wFHistory ?? [], - ), + ApprovalLevelfragment(wFHistory: itgRequest?.wFHistory ?? []), RequestDetailFragment(fields: itgRequest?.fieldGoups?[0].fields ?? []), ], ).expanded, diff --git a/lib/ui/work_list/itg_fragments/approval_level_fragment.dart b/lib/ui/work_list/itg_fragments/approval_level_fragment.dart index 027d8ca..4ffca44 100644 --- a/lib/ui/work_list/itg_fragments/approval_level_fragment.dart +++ b/lib/ui/work_list/itg_fragments/approval_level_fragment.dart @@ -112,16 +112,18 @@ class ApprovalLevelfragment extends StatelessWidget { } Color getStatusColor(String code) { - if (code == "SUBMIT") { - return const Color(0xff2E303A); - } else if (code == "REJECTED") { - return const Color(0xffD02127); - } else if (code == "APPROVED" || code == "Requested Information") { - return const Color(0xff1FA269); - } else if (code == "REQUEST_INFO") { - return const Color(0xff2E303A); + if (code == "Submit") { + return MyColors.grey3AColor; + } else if (code == "Pending") { + return MyColors.yellowColor; + } else if (code == "Not Doable" || code == "Rejected") { + return MyColors.redColor; + } else if (code == "APPROVED") { + return MyColors.greenColor; + } else if (code == "Requested Information") { + return MyColors.orange; } else { - return const Color(0xff2E303A); + return MyColors.yellowColor; } } } diff --git a/lib/ui/work_list/sheets/delegate_sheet.dart b/lib/ui/work_list/sheets/delegate_sheet.dart index b0cfef1..1dbc30c 100644 --- a/lib/ui/work_list/sheets/delegate_sheet.dart +++ b/lib/ui/work_list/sheets/delegate_sheet.dart @@ -441,7 +441,7 @@ class _DelegateSheetState extends State { onTap: () { showMyBottomSheet(context, child: SelectedItemSheet( - "Comment", + LocaleKeys.comments.tr(), apiMode: widget.apiMode, replacementList: actionHistory, notificationID: widget.notificationID, diff --git a/lib/ui/work_list/work_list_screen.dart b/lib/ui/work_list/work_list_screen.dart index 6169b47..1eaac3e 100644 --- a/lib/ui/work_list/work_list_screen.dart +++ b/lib/ui/work_list/work_list_screen.dart @@ -62,14 +62,7 @@ class _WorkListScreenState extends State { key: 'POAPPRV', disable: false), WorkListItemTypeModelData( - value: 0, - name: 'ITG', - fullName: LocaleKeys.ITGForms.tr(), - active: false, - color: [Color(0xffEB8C90), Color(0xffDE6C70)], - icon: "assets/images/miss_swipe.svg", - key: 'ITG', - disable: false), + value: 0, name: 'ITG', fullName: LocaleKeys.ITGForms.tr(), active: false, color: [Color(0xffEB8C90), Color(0xffDE6C70)], icon: "assets/images/miss_swipe.svg", key: 'ITG', disable: false), WorkListItemTypeModelData( value: 0, name: 'IC', @@ -80,23 +73,9 @@ class _WorkListScreenState extends State { key: 'INVITEM', disable: false), WorkListItemTypeModelData( - value: 0, - name: 'STAMP', - fullName: LocaleKeys.stamp.tr(), - active: false, - color: [Color(0xff32D892), Color(0xff1AB170)], - icon: "assets/images/miss_swipe.svg", - key: 'STAMP', - disable: false), + value: 0, name: 'STAMP', fullName: LocaleKeys.stamp.tr(), active: false, color: [Color(0xff32D892), Color(0xff1AB170)], icon: "assets/images/miss_swipe.svg", key: 'STAMP', disable: false), WorkListItemTypeModelData( - value: 0, - name: 'COC', - fullName: LocaleKeys.itemCreation.tr(), - active: false, - color: [Color(0xff787299), Color(0xff1AB170)], - icon: "assets/images/miss_swipe.svg", - key: 'COC', - disable: true) + value: 0, name: 'COC', fullName: LocaleKeys.itemCreation.tr(), active: false, color: [Color(0xff787299), Color(0xff1AB170)], icon: "assets/images/miss_swipe.svg", key: 'COC', disable: true) ]; int workListItemIndex = 0; @@ -111,7 +90,6 @@ class _WorkListScreenState extends State { @override void initState() { super.initState(); - providerData = Provider.of(context, listen: false); calculateCounter(); getWorkList(); @@ -124,10 +102,7 @@ class _WorkListScreenState extends State { } else if (workListElement.key == "COC") { workListElement.value = providerData.cocFinalCount; } else { - var tempList = providerData.getOpenNotificationsList - ?.where((notificationElement) => - notificationElement.itemType == workListElement.key) - .toList(); + var tempList = providerData.getOpenNotificationsList?.where((notificationElement) => notificationElement.itemType == workListElement.key).toList(); if (tempList!.isNotEmpty) { workListElement.value = tempList.first.openNtfNumber ?? 0; } @@ -138,47 +113,50 @@ class _WorkListScreenState extends State { ItgFormsModel? itgFormsModel; int? itgRequestTypeIndex; - void getWorkList() async { + Future getWorkList({bool showLoading = true}) async { try { - Utils.showLoading(context); + if (showLoading) Utils.showLoading(context); if (workListItemTypes[workListItemIndex].key == "ITG") { itgFormsModel = await WorkListApiClient().getITGTaskCountRequestType(); List requestAllList = []; for (int i = 0; i < (itgFormsModel?.requestType!.length ?? 0); i++) { itgFormsModel?.requestType![i].requestDetails?.forEach((element) { - element.requestType = - itgFormsModel?.requestType![i].requestTypeCode; + element.requestType = itgFormsModel?.requestType![i].requestTypeCode; }); - requestAllList = requestAllList + - (itgFormsModel?.requestType![i].requestDetails ?? []); + requestAllList = requestAllList + (itgFormsModel?.requestType![i].requestDetails ?? []); } AppState().setRequestAllList = requestAllList; - itgFormsModel?.requestType!.insert( - 0, - RequestType( - requestDetails: requestAllList, - requestTypeCode: "all", - requestTypeName: "All")); + itgFormsModel?.requestType!.insert(0, RequestType(requestDetails: requestAllList, requestTypeCode: "all", requestTypeName: "All")); if ((itgFormsModel?.requestType?.length ?? 0) > 0) { itgRequestTypeIndex = 0; } } else { itgRequestTypeIndex = null; - workList = await WorkListApiClient() - .getWorkList(pageNumber, workListItemTypes[workListItemIndex].key); + workList = await WorkListApiClient().getWorkList(pageNumber, workListItemTypes[workListItemIndex].key); AppState().setWorkList = workList; } - Utils.hideLoading(context); - setState(() {}); + if (showLoading) Utils.hideLoading(context); + if (showLoading) setState(() {}); } catch (ex) { - Utils.hideLoading(context); - Utils.handleException(ex, context, null); + if (showLoading) Utils.hideLoading(context); + if (showLoading) Utils.handleException(ex, context, null); } } void _onRefresh() async { - getWorkList(); - _refreshController.refreshCompleted(); + try { + _refreshController.refreshCompleted(); + Utils.showLoading(context); + List dataOnRefresh = await Future.wait([ + providerData.fetchWorkListCounter(context, showLoading: false), + getWorkList(showLoading: false), + ]); + calculateCounter(); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } } @override @@ -207,23 +185,13 @@ class _WorkListScreenState extends State { child: ListView.separated( itemBuilder: (context, index) { return Container( - padding: const EdgeInsets.only( - left: 21, right: 21, top: 8, bottom: 8), + padding: const EdgeInsets.only(left: 21, right: 21, top: 8, bottom: 8), alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6), - color: workListItemIndex == index - ? MyColors.darkIconColor - : MyColors.lightGreyEAColor), - child: - ("${workListItemTypes[index].name} ${workListItemTypes[index].value > 0 ? "(${workListItemTypes[index].value})" : ""}") - .toText12( - color: workListItemIndex == index - ? MyColors.white - : MyColors.black), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(6), color: workListItemIndex == index ? MyColors.darkIconColor : MyColors.lightGreyEAColor), + child: ("${workListItemTypes[index].name} ${workListItemTypes[index].value > 0 ? "(${workListItemTypes[index].value})" : ""}") + .toText12(color: workListItemIndex == index ? MyColors.white : MyColors.black), ).onPress(() { - if (workListItemIndex != index && - !workListItemTypes[index].disable) { + if (workListItemIndex != index && !workListItemTypes[index].disable) { workListItemIndex = index; if (workListItemTypes[index].value == 0) { workList = []; @@ -316,17 +284,14 @@ class _WorkListScreenState extends State { ); } - Widget itgRowItem(WorkListItemTypeModelData data, - RequestDetails requestDetails, int index) { + Widget itgRowItem(WorkListItemTypeModelData data, RequestDetails requestDetails, int index) { return InkWell( onTap: () async { AppState().setItgWorkListIndex = index; - var shouldReloadData = - await Navigator.pushNamed(context, AppRoutes.itgDetail); + var shouldReloadData = await Navigator.pushNamed(context, AppRoutes.itgDetail); if (shouldReloadData != null) { if (shouldReloadData.toString() == "delegate_reload") { - providerData.itgFormsModel!.totalCount = - providerData.itgFormsModel!.totalCount! - 1; + providerData.itgFormsModel!.totalCount = providerData.itgFormsModel!.totalCount! - 1; calculateCounter(); getWorkList(); } @@ -350,8 +315,7 @@ class _WorkListScreenState extends State { }, child: Container( width: double.infinity, - padding: - const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), + padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), @@ -370,20 +334,11 @@ class _WorkListScreenState extends State { Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), - gradient: LinearGradient( - transform: GradientRotation(.218), - begin: Alignment.topRight, - end: Alignment.bottomRight, - colors: data.color), + gradient: LinearGradient(transform: GradientRotation(.218), begin: Alignment.topRight, end: Alignment.bottomRight, colors: data.color), ), child: Column( crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SvgPicture.asset("assets/images/miss_swipe.svg", - width: 20, height: 20, color: Colors.white), - 2.height, - data.name.toText10(color: Colors.white) - ], + children: [SvgPicture.asset("assets/images/miss_swipe.svg", width: 20, height: 20, color: Colors.white), 2.height, data.name.toText10(color: Colors.white)], ).paddingAll(6), ), 8.width, @@ -409,15 +364,12 @@ class _WorkListScreenState extends State { ); } - Widget rowItem(WorkListItemTypeModelData data, WorkListResponseModel workData, - int index) { + Widget rowItem(WorkListItemTypeModelData data, WorkListResponseModel workData, int index) { return InkWell( onTap: () async { AppState().setWorkListIndex = index; var data = workList![index]; - var shouldReloadData = await Navigator.pushNamed( - context, AppRoutes.workListDetail, - arguments: workData); + var shouldReloadData = await Navigator.pushNamed(context, AppRoutes.workListDetail, arguments: workData); if (shouldReloadData != null) { if (shouldReloadData.toString() == "delegate_reload") { calculateCounter(); @@ -442,8 +394,7 @@ class _WorkListScreenState extends State { }, child: Container( width: double.infinity, - padding: - const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), + padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), @@ -462,20 +413,11 @@ class _WorkListScreenState extends State { Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), - gradient: LinearGradient( - transform: GradientRotation(.218), - begin: Alignment.topRight, - end: Alignment.bottomRight, - colors: data.color), + gradient: LinearGradient(transform: GradientRotation(.218), begin: Alignment.topRight, end: Alignment.bottomRight, colors: data.color), ), child: Column( crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SvgPicture.asset("assets/images/miss_swipe.svg", - width: 20, height: 20, color: Colors.white), - 2.height, - data.name.toText10(color: Colors.white) - ], + children: [SvgPicture.asset("assets/images/miss_swipe.svg", width: 20, height: 20, color: Colors.white), 2.height, data.name.toText10(color: Colors.white)], ).paddingAll(6), ), 8.width, diff --git a/lib/ui/work_list/worklist_detail_screen.dart b/lib/ui/work_list/worklist_detail_screen.dart index 9a32d30..94c7208 100644 --- a/lib/ui/work_list/worklist_detail_screen.dart +++ b/lib/ui/work_list/worklist_detail_screen.dart @@ -135,9 +135,28 @@ class _WorkListDetailScreenState extends State { if (getNotificationRespondAttributes.isNotEmpty) { notificationNoteInput = getNotificationRespondAttributes.first; } - notificationButtonsList = await WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!); - actionHistoryList = await WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!); - getAttachmentList = await WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!); + + List dataToFetch = await Future.wait([ + WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!), + WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!), + WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!), + ]); + + notificationButtonsList = dataToFetch[0]; + actionHistoryList = dataToFetch[1]; + getAttachmentList = dataToFetch[2]; + + // List futureRequest = []; + // List futureObject = []; + // + // addRequestInFuture(notificationButtonsList, WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!)); + // addRequestInFuture(actionHistoryList, WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!)); + // addRequestInFuture(getAttachmentList, WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!)); + + // List dataToFetch = await Future.wait(futureRequest); + // for(int i=0;i element.bUTTONACTION == "CLOSE"); @@ -152,6 +171,14 @@ class _WorkListDetailScreenState extends State { } } + List futureRequest = []; + List futureObject = []; + + void addRequestInFuture(data, request) { + futureObject.add(data); + futureRequest.add(request); + } + void getDataFromState() { if (workListData == null) { workListData = AppState().workList![AppState().workListIndex!]; // ModalRoute.of(context)!.settings.arguments as WorkListResponseModel; @@ -196,6 +223,7 @@ class _WorkListDetailScreenState extends State { ], ), ), + if ((workListData?.sUBJECT ?? "").isNotEmpty) workListData!.sUBJECT!.toText14().paddingOnly(top: 20, right: 21, left: 21), PageView( controller: controller, onPageChanged: (pageIndex) { diff --git a/lib/ui/work_list/worklist_fragments/actions_fragment.dart b/lib/ui/work_list/worklist_fragments/actions_fragment.dart index bc97c79..3663cc5 100644 --- a/lib/ui/work_list/worklist_fragments/actions_fragment.dart +++ b/lib/ui/work_list/worklist_fragments/actions_fragment.dart @@ -8,6 +8,7 @@ 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/get_action_history_list_model.dart'; import 'package:mohem_flutter_app/ui/work_list/sheets/delegate_sheet.dart'; +import 'package:mohem_flutter_app/ui/work_list/sheets/selected_item_sheet.dart'; import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; import 'package:mohem_flutter_app/widgets/circular_avatar.dart'; @@ -77,11 +78,11 @@ class ActionsFragment extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ actionHistory.nAME!.toText16(), - if ((actionHistory.nOTE ?? "").isNotEmpty) actionHistory.nOTE!.toText12(color: MyColors.grey57Color), + if ((actionHistory.nOTE ?? "").isNotEmpty) "Note: ${actionHistory.nOTE!}".toText12(color: MyColors.grey57Color), 4.height, Row( children: [ - actionHistory.aCTION!.toText10(), + actionHistory.aCTION!.toText10(color: getStatusColor(actionHistory.aCTIONCODE!)), 8.width, if (actionHistory.nOTIFICATIONDATE!.isNotEmpty) DateUtil.formatDateToDate(DateUtil.convertSimpleStringDateToDateddMMyyyy(actionHistory.nOTIFICATIONDATE!), false).toText12(color: MyColors.lightTextColor), @@ -100,7 +101,15 @@ class ActionsFragment extends StatelessWidget { }).expanded, Container(width: 1, height: 30, color: MyColors.lightGreyEFColor), LocaleKeys.delegate.tr().toText12(color: MyColors.gradiantEndColor).center.paddingOnly(top: 6, bottom: 6).onPress(() { - showMyBottomSheet(context, child: DelegateSheet(title: "Delegate", apiMode: "DELEGATE", notificationID: notificationID, actionHistoryList: actionHistoryList)); + showMyBottomSheet( + context, + child: SelectedItemSheet( + LocaleKeys.comments.tr(), + apiMode: "DELEGATE", + actionHistoryList: actionHistory, + notificationID: notificationID, + ), + ); }).expanded, ], ), diff --git a/lib/ui/work_list/worklist_fragments/attachments_fragment.dart b/lib/ui/work_list/worklist_fragments/attachments_fragment.dart index ebc3db9..b351683 100644 --- a/lib/ui/work_list/worklist_fragments/attachments_fragment.dart +++ b/lib/ui/work_list/worklist_fragments/attachments_fragment.dart @@ -4,6 +4,7 @@ import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.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'; @@ -21,18 +22,18 @@ class AttachmentsFragment extends StatelessWidget { return ListView.separated( itemCount: getAttachmentList.length, itemBuilder: (context, index) { + return Row( children: [ SvgPicture.asset(determineFileIcon(getAttachmentList[index].fILECONTENTTYPE ?? "")), 12.width, - (getAttachmentList[index].fILENAME?.capitalizeFirstofEach ?? "").toText16().expanded, + (getAttachmentList[index].fILENAME ?? "").toText16().expanded, ], ).objectContainerView().onPress(() async { try { String path = await _createFileFromString(getAttachmentList[index].fILEDATA ?? "", getAttachmentList[index].fILECONTENTTYPE ?? ""); OpenFile.open(path); - } catch (ex) { - debugPrint("FileErorr:$ex"); + } catch (ex) {Utils.showToast("Cannot open file."); } }); },