From 6d39b20e0b481426bd94348b91fdee3790a77439 Mon Sep 17 00:00:00 2001 From: WaseemAbbasi22 Date: Mon, 4 Aug 2025 15:42:54 +0300 Subject: [PATCH 01/13] dark mode implementation --- lib/controllers/api_routes/urls.dart | 8 +- lib/dashboard_latest/dashboard_view.dart | 4 +- .../widgets/progress_fragment.dart | 2 +- .../widgets/requests_fragment.dart | 4 +- lib/extensions/widget_extensions.dart | 21 +-- .../action_button/footer_action_button.dart | 37 ++++- .../components/activities_list_view.dart | 1 + .../views/components/asset_detail_card.dart | 148 +++++++++--------- .../service_request_bottomsheet.dart | 7 +- .../views/components/history_log_view.dart | 4 +- .../views/components/initial_visit_card.dart | 68 ++++---- .../service_request_detail_view.dart | 4 +- .../forms/asset_retired/asset_retired.dart | 1 + .../asset_retired/verify_asset_detail.dart | 2 +- .../forms/cost/cost_detail_form_screen.dart | 2 +- .../components/assistant_employee_list.dart | 25 +-- .../components/external_request.dart | 15 +- .../components/internal_request.dart | 17 +- .../maintenance_request_main.dart | 3 +- .../forms/spare_part/spare_part_request.dart | 1 + .../views/nurse/create_new_request_view.dart | 5 +- .../service_request_detail_main_view.dart | 2 +- .../ppm_calibration_tools_form.dart | 4 +- .../update_ppm/ppm_external_details_form.dart | 14 +- .../update_ppm/ppm_pm_check_list_form.dart | 1 + .../ppm_wo/update_ppm/ppm_pm_kits_form.dart | 2 +- .../ppm_wo/update_ppm/update_ppm.dart | 9 +- .../ppm_wo/update_ppm/wo_info_form.dart | 22 +-- .../recurrent_work_order_view.dart | 2 + .../tm_module/tasks_wo/create_task_view.dart | 1 + .../tasks_wo/update_task_request_view.dart | 46 +++--- lib/new_views/app_style/app_color.dart | 5 + .../common_widgets/app_bottom_nav_bar.dart | 3 +- .../common_widgets/app_filled_button.dart | 4 +- .../common_widgets/app_text_form_field.dart | 4 +- .../single_item_drop_down_menu.dart | 4 +- lib/new_views/common_widgets/tab_button.dart | 7 +- .../pages/gas_refill_request_form.dart | 22 +-- .../calender_fragments/monthly_fragment.dart | 4 +- .../create_request-type_bottomsheet.dart | 7 +- lib/new_views/pages/login_page.dart | 8 +- .../dialoge/acknowledge_work_dialog.dart | 8 +- .../create__device_transfer_request.dart | 19 +-- .../update_device_transfer.dart | 27 ++-- .../gas_refill/update_gas_refill_request.dart | 16 +- .../requests/create_service_request_page.dart | 4 +- .../bottom_sheets/selection_bottom_sheet.dart | 3 + lib/views/widgets/equipment/asset_picker.dart | 6 +- .../notifications/notification_item.dart | 10 +- .../parts/auto_complete_parts_field.dart | 4 +- .../pentry/calibration_tool_asset_picker.dart | 2 +- lib/views/widgets/timer/app_timer.dart | 11 +- 52 files changed, 355 insertions(+), 305 deletions(-) diff --git a/lib/controllers/api_routes/urls.dart b/lib/controllers/api_routes/urls.dart index cb7f9347..5c68ebc8 100644 --- a/lib/controllers/api_routes/urls.dart +++ b/lib/controllers/api_routes/urls.dart @@ -3,14 +3,14 @@ class URLs { static const String appReleaseBuildNumber = "21"; - static const host1 = "https://atomsm.hmg.com"; // production url + // static const host1 = "https://atomsm.hmg.com"; // production url // static const host1 = "https://atomsmdev.hmg.com"; // local DEV url - // static const host1 = "https://atomsmuat.hmg.com"; // local UAT url + static const host1 = "https://atomsmuat.hmg.com"; // local UAT url // static String _baseUrl = "$_host/mobile"; // static final String _baseUrl = "$_host/v2/mobile"; // new V2 apis - // static final String _baseUrl = "$_host/mobile"; // host local UAT - static final String _baseUrl = "$_host/v3/mobile"; // v3 for new CM,PM,TM + static final String _baseUrl = "$_host/mobile"; // host local UAT + // static final String _baseUrl = "$_host/v3/mobile"; // v3 for new CM,PM,TM static String _host = host1; diff --git a/lib/dashboard_latest/dashboard_view.dart b/lib/dashboard_latest/dashboard_view.dart index 01ef9b67..149a9e24 100644 --- a/lib/dashboard_latest/dashboard_view.dart +++ b/lib/dashboard_latest/dashboard_view.dart @@ -147,7 +147,7 @@ class _DashboardViewState extends State { height: 100.toScreenHeight, decoration: BoxDecoration( shape: BoxShape.circle, - color: AppColor.white10, + color: AppColor.background(context), border: Border.all(color: AppColor.primary10.withOpacity(0.5), width: 2), ), child: Consumer(builder: (context, userProvider, child) { @@ -159,7 +159,7 @@ class _DashboardViewState extends State { 8.height, Text( ("${context.translation.checkIn}\n${userProvider.swipeTransactionModel.swipeTime != null ? SwipeGeneralUtils.instance.formatTimeOnly(userProvider.swipeTransactionModel.swipeTime!) : '--:--'}"), - style: AppTextStyles.bodyText2.copyWith(color: AppColor.white936, fontWeight: FontWeight.w500, fontFamily: "Poppins"), + style: AppTextStyles.bodyText2.copyWith(color: AppColor.textColor(context), fontWeight: FontWeight.w500, fontFamily: "Poppins"), ), ], ); diff --git a/lib/dashboard_latest/widgets/progress_fragment.dart b/lib/dashboard_latest/widgets/progress_fragment.dart index b7329fd3..f6533c91 100644 --- a/lib/dashboard_latest/widgets/progress_fragment.dart +++ b/lib/dashboard_latest/widgets/progress_fragment.dart @@ -248,7 +248,7 @@ class ProgressFragment extends StatelessWidget { showChartValuesOutside: false, decimalPlaces: 1, ), - ).toShimmer(isShow: snapshot.isAllCountLoading, radius: 250).paddingAll(0).toShadowContainer(context), + ).toShimmer(isShow: snapshot.isAllCountLoading, radius: 250,context: context).paddingAll(0).toShadowContainer(context), ], ), ), diff --git a/lib/dashboard_latest/widgets/requests_fragment.dart b/lib/dashboard_latest/widgets/requests_fragment.dart index f5cbdd1b..ba45b3f5 100644 --- a/lib/dashboard_latest/widgets/requests_fragment.dart +++ b/lib/dashboard_latest/widgets/requests_fragment.dart @@ -60,7 +60,7 @@ class RequestsFragment extends StatelessWidget { CustomBadge( value: isLoading ? 0 : value, child: Container( - child: (icon ?? "").toSvgAsset(height: 26, width: 26, color: iconColor).toShimmer(isShow: isLoading), + child: (icon ?? "").toSvgAsset(height: 26, width: 26, color: iconColor).toShimmer(isShow: isLoading,context: context), ).toShadowCircleContainer(context, padding: 17), ), 10.height, @@ -70,7 +70,7 @@ class RequestsFragment extends StatelessWidget { style: AppTextStyles.tinyFont.copyWith( color: context.isDark ? AppColor.neutral30 : AppColor.black20, ), - ).toShimmer(isShow: isLoading), + ).toShimmer(isShow: isLoading,context: context), ], ), ); diff --git a/lib/extensions/widget_extensions.dart b/lib/extensions/widget_extensions.dart index f13316a2..b9770dda 100644 --- a/lib/extensions/widget_extensions.dart +++ b/lib/extensions/widget_extensions.dart @@ -75,14 +75,15 @@ extension WidgetExtensions on Widget { child: this): this; } - Widget toShimmer({bool isShow = true, double radius = 20}) => isShow + Widget toShimmer({bool isShow = true, double radius = 20,required BuildContext context}) => isShow ? Shimmer.fromColors( - baseColor: const Color(0xffe8eff0), - highlightColor: Colors.white, + // baseColor: const Color(0xffe8eff0), + baseColor: Theme.of(context).scaffoldBackgroundColor, + highlightColor: AppColor.background(context), child: ClipRRect( borderRadius: BorderRadius.circular(radius), child: Container( - color: Colors.white, + color: AppColor.background(context), child: this, ), ), @@ -93,20 +94,21 @@ extension WidgetExtensions on Widget { ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - const SizedBox(width: 250, height: 24).toShimmer(isShow: isShow), + const SizedBox(width: 250, height: 24).toShimmer(isShow: isShow,context: context), 8.height, - const SizedBox(width: 160, height: 16).toShimmer(isShow: isShow), + const SizedBox(width: 160, height: 16).toShimmer(isShow: isShow,context: context), 8.height, - const SizedBox(width: 120, height: 18).toShimmer(isShow: isShow).toShimmer(isShow: isShow), + const SizedBox(width: 120, height: 18).toShimmer(isShow: isShow,context: context).toShimmer(isShow: isShow,context: context), ], ).toShadowContainer(context) : this; Widget toShadowContainer(BuildContext context, - {bool showShadow = true, double borderRadius = 14, bool withShadow = true, Color? backgroundColor, Color borderColor = Colors.transparent, double padding = 16, EdgeInsets? paddingObject}) => + {bool showShadow = true, double borderRadius = 14, bool withShadow = true, Color? backgroundColor, Color borderColor = Colors.transparent, double padding = 16, EdgeInsets? paddingObject, EdgeInsets? margin,}) => withShadow ? Container( padding: paddingObject ?? EdgeInsets.all(padding), + margin: margin, width: double.infinity, decoration: ShapeDecoration( color: backgroundColor ?? AppColor.background(context), @@ -121,7 +123,8 @@ extension WidgetExtensions on Widget { clipBehavior: Clip.antiAlias, margin: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), decoration: BoxDecoration( - color: AppColor.background(context), + // color: AppColor.background(context), + color: Theme.of(context).scaffoldBackgroundColor, borderRadius: const BorderRadius.only(topRight: Radius.circular(20), topLeft: Radius.circular(20)), ), padding: padding ?? EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight), diff --git a/lib/modules/cm_module/views/components/action_button/footer_action_button.dart b/lib/modules/cm_module/views/components/action_button/footer_action_button.dart index 9c3ed0bd..448ff6ba 100644 --- a/lib/modules/cm_module/views/components/action_button/footer_action_button.dart +++ b/lib/modules/cm_module/views/components/action_button/footer_action_button.dart @@ -23,12 +23,12 @@ import 'package:test_sa/new_views/swipe_module/dialoge/acknowledge_work_dialog.d import 'package:test_sa/providers/service_request_providers/reject_reason_provider.dart'; class FooterActionButton { - static Widget footerContainer({required Widget child}) { + static Widget footerContainer({required Widget child,required BuildContext context}) { return Align( alignment: Alignment.bottomCenter, child: Container( padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 16.toScreenHeight), - color: AppColor.white10, + color: AppColor.background(context), child: child, ), ); @@ -51,6 +51,7 @@ class FooterActionButton { switch (workOrderNextStepStatus) { case WorkOrderNextStepEnum.assignToMe: return footerContainer( + context: context, child: AppFilledButton( label: 'Assign To Me', // maxWidth: true, @@ -66,9 +67,11 @@ class FooterActionButton { case WorkOrderNextStepEnum.endWorkFlow: if (requestDetailProvider.isReadOnlyRequest) { return footerContainer( + context: context, child: AppFilledButton( label: context.translation.activities, buttonColor: AppColor.neutral50, + textColor: context.isDark ? AppColor.neutral30 : Colors.white, onPressed: () async { Navigator.push(context, MaterialPageRoute(builder: (context) => const ActivitiesListView())); }, @@ -76,6 +79,7 @@ class FooterActionButton { ); } return footerContainer( + context: context, child: AppFilledButton( label: context.translation.close, // maxWidth: true, @@ -87,9 +91,11 @@ class FooterActionButton { case WorkOrderNextStepEnum.nTakeAction: if (requestDetailProvider.isReadOnlyRequest) { return footerContainer( + context: context, child: AppFilledButton( label: context.translation.activities, buttonColor: AppColor.neutral50, + textColor: context.isDark ? AppColor.neutral30 : Colors.white, onPressed: () async { Navigator.push(context, MaterialPageRoute(builder: (context) => const ActivitiesListView())); }, @@ -97,6 +103,7 @@ class FooterActionButton { ); } return footerContainer( + context: context, child: AppFilledButton( label: context.translation.close, // maxWidth: true, @@ -107,6 +114,7 @@ class FooterActionButton { )); case WorkOrderNextStepEnum.eRejectAccept: return footerContainer( + context: context, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.min, @@ -114,7 +122,8 @@ class FooterActionButton { AppFilledButton( label: context.translation.reject, maxWidth: true, - buttonColor: Colors.white54, + buttonColor:AppColor.background(context), + // textColor: context.isDark ? AppColor.neutral30 : Colors.white, textColor: AppColor.red30, showBorder: true, onPressed: () async { @@ -142,6 +151,7 @@ class FooterActionButton { )); case WorkOrderNextStepEnum.eFixRemotelyNeedVisit: return footerContainer( + context: context, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.min, @@ -171,6 +181,7 @@ class FooterActionButton { )); case WorkOrderNextStepEnum.eArrived: return footerContainer( + context: context, child: AppFilledButton( label: context.translation.iHaveArrived, showIcon: true, @@ -182,6 +193,7 @@ class FooterActionButton { )); case WorkOrderNextStepEnum.verifyAssetDetail: return footerContainer( + context: context, child: AppFilledButton( label: context.translation.updateAssetDetails, // maxWidth: true, @@ -192,11 +204,13 @@ class FooterActionButton { )); case WorkOrderNextStepEnum.activity: return footerContainer( + context: context, child: Column( children: [ AppFilledButton( label: context.translation.activities, // maxWidth: true, + textColor: context.isDark ? AppColor.neutral30 : Colors.white, buttonColor: AppColor.neutral50, onPressed: () async { // ServiceRequestBottomSheet.activityTypeBottomSheet(context: context); @@ -239,22 +253,26 @@ class FooterActionButton { case WorkOrderNextStepEnum.assetRetirementManagementApproval: return footerContainer( + context: context, child: AppFilledButton( label: context.translation.assetRetiredPendingOpManagementApproval, - buttonColor: AppColor.neutral140, - textColor: AppColor.neutral150, + buttonColor: AppColor.background(context), + textColor: context.isDark ? Colors.white: AppColor.neutral150, fontSize: 12.toScreenWidth, )); case WorkOrderNextStepEnum.waitingForRequesterToConfirm: return footerContainer( + context: context, child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ AppFilledButton( label: 'Waiting for requester to verify', - buttonColor: AppColor.neutral140, - textColor: AppColor.neutral150, + buttonColor: AppColor.background(context), + textColor: context.isDark ? Colors.white: AppColor.neutral150, + // buttonColor: AppColor.neutral140, + // textColor: AppColor.neutral150, fontSize: 12.toScreenWidth, ), 12.height, @@ -290,6 +308,7 @@ class FooterActionButton { )); case WorkOrderNextStepEnum.eFixRemotely: return footerContainer( + context: context, child: AppFilledButton( label: context.translation.fixedRemotely, maxWidth: true, @@ -302,9 +321,11 @@ class FooterActionButton { ); case WorkOrderNextStepEnum.eNeedVisit: return footerContainer( + context: context, child: AppFilledButton( label: context.translation.needAVisit, maxWidth: true, + textColor: context.isDark ? AppColor.neutral30 : Colors.white, buttonColor: AppColor.neutral50, onPressed: () async { requestDetailProvider.needVisitHelperModel = NeedVisitHelperModel(); @@ -315,6 +336,7 @@ class FooterActionButton { } else { if (workOrderNextStepStatus == WorkOrderNextStepEnum.nTakeAction) { return footerContainer( + context: context, child: AppFilledButton( label: context.translation.takeAction, // maxWidth: true, @@ -326,6 +348,7 @@ class FooterActionButton { } if (workOrderNextStepStatus == WorkOrderNextStepEnum.waitingForRequesterToConfirm) { return footerContainer( + context: context, child: AppFilledButton( label: context.translation.takeAction, // maxWidth: true, diff --git a/lib/modules/cm_module/views/components/activities_list_view.dart b/lib/modules/cm_module/views/components/activities_list_view.dart index c40f5c81..883f7782 100644 --- a/lib/modules/cm_module/views/components/activities_list_view.dart +++ b/lib/modules/cm_module/views/components/activities_list_view.dart @@ -94,6 +94,7 @@ class _ActivitiesListViewState extends State { if (userProvider.user!.type == UsersTypes.engineer && (requestDetailProvider.currentWorkOrder?.data?.status?.value != 5 && requestDetailProvider.currentWorkOrder?.data?.status?.value != 3)) FooterActionButton.footerContainer( + context: context, child: AppFilledButton( label: context.translation.createNewActivity, maxWidth: true, diff --git a/lib/modules/cm_module/views/components/asset_detail_card.dart b/lib/modules/cm_module/views/components/asset_detail_card.dart index c8ac1c3b..ae9b888b 100644 --- a/lib/modules/cm_module/views/components/asset_detail_card.dart +++ b/lib/modules/cm_module/views/components/asset_detail_card.dart @@ -17,96 +17,88 @@ class AssetDetailCard extends StatelessWidget { @override Widget build(BuildContext context) { return Consumer(builder: (context, ServiceRequestDetailProvider requestDetailProvider, snapshot) { - return Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(14), - color: AppColor.white10, - ), - padding: EdgeInsets.symmetric(horizontal: 12.toScreenWidth, vertical: 14.toScreenHeight), - margin: EdgeInsets.only(top: 10.toScreenHeight), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - children: [ - StatusLabel( - label: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.equipmentStatus?.name, - id: requestDetailProvider.engineerUpdateWorkOrderHelperModel!.equipmentStatus!.id ?? 0, - radius: 4, - textColor: AppColor.white10, - backgroundColor: AppColor.getEquipmentStatusColor(context, requestDetailProvider.engineerUpdateWorkOrderHelperModel!.equipmentStatus!.id ?? 0), - ), - if(requestDetailProvider.engineerUpdateWorkOrderHelperModel?.cmFrameId!=null)...[ - 6.width, - StatusLabel( - label: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.cmFrameId?.name, - id: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.cmFrameId?.id ?? 0, - radius: 4, - textColor: AppColor.getActivityTypeTextColor(requestDetailProvider.engineerUpdateWorkOrderHelperModel!.cmFrameId?.name ?? ''), - backgroundColor: AppColor.getActivityTypeBgColor(requestDetailProvider.engineerUpdateWorkOrderHelperModel!.cmFrameId?.name ?? ''), - ), - ], + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Row( + children: [ + StatusLabel( + label: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.equipmentStatus?.name, + id: requestDetailProvider.engineerUpdateWorkOrderHelperModel!.equipmentStatus!.id ?? 0, + radius: 4, + textColor: AppColor.white10, + backgroundColor: AppColor.getEquipmentStatusColor(context, requestDetailProvider.engineerUpdateWorkOrderHelperModel!.equipmentStatus!.id ?? 0), + ), + if(requestDetailProvider.engineerUpdateWorkOrderHelperModel?.cmFrameId!=null)...[ 6.width, StatusLabel( - label: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.serviceType?.name, - id: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.serviceType?.id ?? 0, + label: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.cmFrameId?.name, + id: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.cmFrameId?.id ?? 0, radius: 4, - textColor: AppColor.getActivityTypeTextColor(requestDetailProvider.engineerUpdateWorkOrderHelperModel!.serviceType?.name ?? ''), - backgroundColor: AppColor.getActivityTypeBgColor(requestDetailProvider.engineerUpdateWorkOrderHelperModel!.serviceType?.name ?? ''), + textColor: AppColor.getActivityTypeTextColor(requestDetailProvider.engineerUpdateWorkOrderHelperModel!.cmFrameId?.name ?? ''), + backgroundColor: AppColor.getActivityTypeBgColor(requestDetailProvider.engineerUpdateWorkOrderHelperModel!.cmFrameId?.name ?? ''), ), ], - ), - //hide if status is closed or complete . - if (!requestDetailProvider.isReadOnlyRequest) - "edit_icon".toSvgAsset(height: 21, width: 21).onPress(() async { - requestDetailProvider.refreshTimer = false; - await Navigator.push(context, MaterialPageRoute(builder: (context) => VerifyAssetDetails(isEdit: true))); - requestDetailProvider.refreshTimer = true; - }), - ]), - 6.height, - Text( - "Work Order Details", - style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50), - ), - Text( - '${context.translation.returnToService}: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.returnToService?.toAssetDetailsFormat ?? '-'}', - style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), - ), - Text( - 'EDD: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.edd?.toAssetDetailsFormat ?? '-'}', - style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), - ), - Text( - '${context.translation.loanAvailability}: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.loanAvailability?.name ?? '-'}', - style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), - ), - Text( - '${context.translation.failureReason}: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.failureReason?.name ?? '-'}', - style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), + 6.width, + StatusLabel( + label: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.serviceType?.name, + id: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.serviceType?.id ?? 0, + radius: 4, + textColor: AppColor.getActivityTypeTextColor(requestDetailProvider.engineerUpdateWorkOrderHelperModel!.serviceType?.name ?? ''), + backgroundColor: AppColor.getActivityTypeBgColor(requestDetailProvider.engineerUpdateWorkOrderHelperModel!.serviceType?.name ?? ''), + ), + ], ), + //hide if status is closed or complete . + if (!requestDetailProvider.isReadOnlyRequest) + "edit_icon".toSvgAsset(height: 21, width: 21).onPress(() async { + requestDetailProvider.refreshTimer = false; + await Navigator.push(context, MaterialPageRoute(builder: (context) => VerifyAssetDetails(isEdit: true))); + requestDetailProvider.refreshTimer = true; + }), + ]), + 6.height, + Text( + "Work Order Details", + style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50), + ), + Text( + '${context.translation.returnToService}: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.returnToService?.toAssetDetailsFormat ?? '-'}', + style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), + ), + Text( + 'EDD: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.edd?.toAssetDetailsFormat ?? '-'}', + style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), + ), + Text( + '${context.translation.loanAvailability}: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.loanAvailability?.name ?? '-'}', + style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), + ), + Text( + '${context.translation.failureReason}: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.failureReason?.name ?? '-'}', + style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), + ), + Text( + '${context.translation.faultDescription}: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.faultDescription?.name ?? '-'}', + style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), + ), + Text( + '${context.translation.solutions}: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.solution ?? '-'}', + style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), + ), + if (Provider.of(context, listen: false).isUserFMS) ...[ Text( - '${context.translation.faultDescription}: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.faultDescription?.name ?? '-'}', + 'Description of Finding: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.descriptionOfFinding ?? '-'}', style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), ), Text( - '${context.translation.solutions}: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.solution ?? '-'}', + 'Action Taken: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.actionTaken ?? '-'}', style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), ), - if (Provider.of(context, listen: false).isUserFMS) ...[ - Text( - 'Description of Finding: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.descriptionOfFinding ?? '-'}', - style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), - ), - Text( - 'Action Taken: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.actionTaken ?? '-'}', - style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), - ), - ] - ], - ), - ); + ] + ], + ).toShadowContainer(context,); }); } } diff --git a/lib/modules/cm_module/views/components/bottom_sheets/service_request_bottomsheet.dart b/lib/modules/cm_module/views/components/bottom_sheets/service_request_bottomsheet.dart index 7ff4f8a6..3011bc8c 100644 --- a/lib/modules/cm_module/views/components/bottom_sheets/service_request_bottomsheet.dart +++ b/lib/modules/cm_module/views/components/bottom_sheets/service_request_bottomsheet.dart @@ -385,7 +385,7 @@ class ServiceRequestBottomSheet { ], ); }, - ).toShimmer(isShow: snapshot.loading); + ).toShimmer(isShow: snapshot.loading,context: context); }); } @@ -649,7 +649,8 @@ class ServiceRequestBottomSheet { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(14), // Circular border radius ), - color: AppColor.neutral80, + // color: AppColor.neutral80, + color: AppColor.background(context), child: Row( crossAxisAlignment: CrossAxisAlignment.start, // Align items at the top children: [ @@ -668,7 +669,7 @@ class ServiceRequestBottomSheet { children: [ Text( heading, - style: AppTextStyles.heading6.copyWith(color: AppColor.neutral50), + style: AppTextStyles.heading6.copyWith(color: AppColor.textColor(context)), ), 7.height, Text( diff --git a/lib/modules/cm_module/views/components/history_log_view.dart b/lib/modules/cm_module/views/components/history_log_view.dart index 4d1073be..ddcf5c0d 100644 --- a/lib/modules/cm_module/views/components/history_log_view.dart +++ b/lib/modules/cm_module/views/components/history_log_view.dart @@ -136,8 +136,8 @@ class HistoryLogView extends StatelessWidget { ); }), ], - title.bodyText(context).custom(color: AppColor.black10), - object.timeDifference.isNotEmpty ? object.timeDifference.tinyFont(context).custom(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120) : const SizedBox(), + title.bodyText(context).custom(color: AppColor.textColor(context)), + object.timeDifference.isNotEmpty ? object.timeDifference.tinyFont(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120) : const SizedBox(), ], ), diff --git a/lib/modules/cm_module/views/components/initial_visit_card.dart b/lib/modules/cm_module/views/components/initial_visit_card.dart index 898e44a9..f957ca46 100644 --- a/lib/modules/cm_module/views/components/initial_visit_card.dart +++ b/lib/modules/cm_module/views/components/initial_visit_card.dart @@ -27,44 +27,36 @@ class _InitialVisitCardState extends State { @override Widget build(BuildContext context) { return Consumer(builder: (context, ServiceRequestDetailProvider requestDetailProvider, snapshot) { - return Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(14), - color: AppColor.white10, - ), - padding: EdgeInsets.symmetric(horizontal: 12.toScreenWidth, vertical: 14.toScreenHeight), - margin: EdgeInsets.only(top: 10.toScreenHeight), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - requestDetailProvider.needVisitHelperModel!.visitDate != null ? requestDetailProvider.needVisitHelperModel!.visitDate.toString().toInitialVisitCardFormat : '', - textAlign: TextAlign.end, - style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10), - ), - Row( - children: [ - "reminder_icon".toSvgAsset(height: 21, width: 21).onPress(() { - ServiceRequestBottomSheet.getReminderTimeList(context: context); - ServiceRequestBottomSheet.initialVisitReminderBottomSheet(context: context, reminder: requestDetailProvider.currentWorkOrder?.data?.setReminder); - }), - 24.width, - "edit_icon".toSvgAsset(height: 21, width: 21).onPress(() { - ServiceRequestBottomSheet.initialVisitBottomSheet(context: context); - }), - ], - ), - ]), - 2.height, - context.translation.visitDateAndTime.bodyText2(context).custom(color: AppColor.neutral120), - 12.height, - if (requestDetailProvider.needVisitHelperModel?.comment != null) ...[ - requestDetailProvider.needVisitHelperModel!.comment!.bodyText2(context).custom(color: AppColor.neutral120), - ] - ], - ), - ); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Text( + requestDetailProvider.needVisitHelperModel!.visitDate != null ? requestDetailProvider.needVisitHelperModel!.visitDate.toString().toInitialVisitCardFormat : '', + textAlign: TextAlign.end, + style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10), + ), + Row( + children: [ + "reminder_icon".toSvgAsset(height: 21, width: 21).onPress(() { + ServiceRequestBottomSheet.getReminderTimeList(context: context); + ServiceRequestBottomSheet.initialVisitReminderBottomSheet(context: context, reminder: requestDetailProvider.currentWorkOrder?.data?.setReminder); + }), + 24.width, + "edit_icon".toSvgAsset(height: 21, width: 21).onPress(() { + ServiceRequestBottomSheet.initialVisitBottomSheet(context: context); + }), + ], + ), + ]), + 2.height, + context.translation.visitDateAndTime.bodyText2(context).custom(color: AppColor.neutral120), + 12.height, + if (requestDetailProvider.needVisitHelperModel?.comment != null) ...[ + requestDetailProvider.needVisitHelperModel!.comment!.bodyText2(context).custom(color: AppColor.neutral120), + ] + ], + ).toShadowContainer(context,margin:const EdgeInsets.only(top: 12)); }); } } diff --git a/lib/modules/cm_module/views/components/service_request_detail_view.dart b/lib/modules/cm_module/views/components/service_request_detail_view.dart index 52ceea18..f77b48fd 100644 --- a/lib/modules/cm_module/views/components/service_request_detail_view.dart +++ b/lib/modules/cm_module/views/components/service_request_detail_view.dart @@ -73,6 +73,7 @@ class _ServiceRequestDetailViewState extends State { children: [ workOrderDetailCard(context, requestProvider.currentWorkOrder!.data!, _userProvider, requestProvider), initialVisitCard(requestDetailProvider: requestProvider, userProvider: _userProvider), + 12.height, assetDetailCard(requestDetailProvider: requestProvider, userProvider: _userProvider), 12.height, if (context.userProvider.user!.type == UsersTypes.engineer && @@ -495,7 +496,8 @@ class _ServiceRequestDetailViewState extends State { style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50), ).expanded, if (!provider.isReadOnlyRequest) - "edit_icon".toSvgAsset(height: 21, width: 21).onPress(() async { + "edit_icon".toSvgAsset(height: 21, width: 21, + ).onPress(() async { provider.refreshTimer = false; await Navigator.push(context, MaterialPageRoute(builder: (context) => CostDetailFormScreen(isEdit: true))); provider.refreshTimer = true; diff --git a/lib/modules/cm_module/views/forms/asset_retired/asset_retired.dart b/lib/modules/cm_module/views/forms/asset_retired/asset_retired.dart index 283ed269..4ede727b 100644 --- a/lib/modules/cm_module/views/forms/asset_retired/asset_retired.dart +++ b/lib/modules/cm_module/views/forms/asset_retired/asset_retired.dart @@ -113,6 +113,7 @@ class _AssetRetiredState extends State with TickerProviderStateMix ).paddingAll(16), ).expanded, FooterActionButton.footerContainer( + context: context, child: AppFilledButton( label: context.translation.submit, buttonColor: AppColor.primary10, diff --git a/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart b/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart index 142c2f19..6552fc11 100644 --- a/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart +++ b/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart @@ -408,7 +408,7 @@ class _VerifyAssetDetailsState extends State with TickerProv ], ) ], - ).toShimmer(isShow: snapshot.loading), + ).toShimmer(isShow: snapshot.loading,context: context), ], ); }); diff --git a/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart b/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart index c8f99451..3fd23394 100644 --- a/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart +++ b/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart @@ -234,7 +234,7 @@ class _CostDetailFormScreenState extends State with Ticker ], ) ], - ).toShimmer(isShow: snapshot.loading), + ).toShimmer(isShow: snapshot.loading,context: context), ], ); }); diff --git a/lib/modules/cm_module/views/forms/maintenance_request/components/assistant_employee_list.dart b/lib/modules/cm_module/views/forms/maintenance_request/components/assistant_employee_list.dart index 3c09f7bd..1cbedee1 100644 --- a/lib/modules/cm_module/views/forms/maintenance_request/components/assistant_employee_list.dart +++ b/lib/modules/cm_module/views/forms/maintenance_request/components/assistant_employee_list.dart @@ -14,13 +14,13 @@ import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart'; import 'package:test_sa/views/widgets/date_and_time/date_picker.dart'; import 'package:test_sa/views/widgets/status/report/service_report_assistant_employee_menu.dart'; -class AssistantEmployeeList extends StatefulWidget { +class ServiceRequestAssistantEmployeeList extends StatefulWidget { final List? assistantEmployeeList; final ValueChanged>? onListChanged; final double? cardPadding; final dynamic assetId; - const AssistantEmployeeList({ + const ServiceRequestAssistantEmployeeList({ super.key, this.assistantEmployeeList, this.onListChanged, @@ -29,10 +29,10 @@ class AssistantEmployeeList extends StatefulWidget { }); @override - State createState() => _AssistantEmployeeListState(); + State createState() => _ServiceRequestAssistantEmployeeListState(); } -class _AssistantEmployeeListState extends State { +class _ServiceRequestAssistantEmployeeListState extends State { late List _list; late List _controllers; @@ -80,7 +80,7 @@ class _AssistantEmployeeListState extends State { child: AppFilledButton( label: "Add Assistant Employee".addTranslation, maxWidth: true, - textColor: AppColor.black10, + textColor: AppColor.textColor(context), buttonColor: context.isDark ? AppColor.neutral60 : AppColor.white10, icon: Icon(Icons.add_circle, color: AppColor.blueStatus(context)), showIcon: true, @@ -132,7 +132,7 @@ class EmployeeCard extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - context.translation.assistantEmployee.bodyText(context).custom(color: AppColor.black20), + context.translation.assistantEmployee.bodyText(context).custom(color: AppColor.textColor(context)), if (!isReadOnly) Container( height: 32, @@ -148,7 +148,7 @@ class EmployeeCard extends StatelessWidget { children: [ ServiceReportAssistantEmployeeMenu( title: context.translation.select, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), assetId: assetId, initialValue: model.employee, onSelect: (employee) { @@ -170,7 +170,7 @@ class EmployeeCard extends StatelessWidget { ADatePicker( label: context.translation.startTime, hideShadow: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), date: model.startDate, formatDateWithTime: true, from: requestedDate, @@ -215,7 +215,7 @@ class EmployeeCard extends StatelessWidget { ADatePicker( label: context.translation.endTime, hideShadow: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), date: model.endDate, formatDateWithTime: true, from: requestedDate, @@ -261,20 +261,21 @@ class EmployeeCard extends StatelessWidget { 8.height, AppTextFormField( labelText: context.translation.workingHours, - backgroundColor: AppColor.neutral80, + backgroundColor: AppColor.fieldBgColor(context), + // backgroundColor: AppColor.neutral80, controller: workingHoursController, suffixIcon: "clock".toSvgAsset(width: 20, color: context.isDark ? AppColor.neutral10 : null).paddingOnly(end: 16), textAlign: TextAlign.center, enable: false, showShadow: false, - labelStyle: AppTextStyles.textFieldLabelStyle, + labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)), style: Theme.of(context).textTheme.titleMedium, ), 8.height, AppTextFormField( initialValue: model.technicalComment, labelText: context.translation.technicalComment, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, labelStyle: AppTextStyles.textFieldLabelStyle, alignLabelWithHint: true, diff --git a/lib/modules/cm_module/views/forms/maintenance_request/components/external_request.dart b/lib/modules/cm_module/views/forms/maintenance_request/components/external_request.dart index b6843244..e6cb952d 100644 --- a/lib/modules/cm_module/views/forms/maintenance_request/components/external_request.dart +++ b/lib/modules/cm_module/views/forms/maintenance_request/components/external_request.dart @@ -60,7 +60,7 @@ class _ExternalMaintenanceRequestState extends State SingleItemDropDownMenu( context: context, title: context.translation.supplier, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), initialValue: requestDetailProvider.activityMaintenanceHelperModel?.supplier, showAsBottomSheet: true, showShadow: false, @@ -76,7 +76,7 @@ class _ExternalMaintenanceRequestState extends State children: [ SingleItemDropDownMenu( context: context, - backgroundColor: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? AppColor.neutral40 : AppColor.neutral100, + backgroundColor: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? context.isDark ? AppColor.neutral20 : AppColor.neutral40 : AppColor.fieldBgColor(context), title: context.translation.supplierEngineer, showShadow: false, enabled: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppPersons?.isNotEmpty ?? false, @@ -106,7 +106,8 @@ class _ExternalMaintenanceRequestState extends State height: 56.toScreenHeight, width: 60.toScreenWidth, decoration: BoxDecoration( - color: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? AppColor.neutral40 : AppColor.neutral100, + // color: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? AppColor.neutral40 : AppColor.neutral100, + color: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? context.isDark ? AppColor.neutral20 : AppColor.neutral40 : AppColor.fieldBgColor(context), borderRadius: BorderRadius.circular(10), //boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)], ), @@ -135,7 +136,7 @@ class _ExternalMaintenanceRequestState extends State ADatePicker( label: context.translation.startTime, hideShadow: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), date: requestDetailProvider.activityMaintenanceHelperModel?.supplierStartTime, from: requestDetailProvider.currentWorkOrder?.data?.requestedDate, formatDateWithTime: true, @@ -177,7 +178,7 @@ class _ExternalMaintenanceRequestState extends State ADatePicker( label: context.translation.endTime, hideShadow: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), from: requestDetailProvider.currentWorkOrder?.data?.requestedDate, to: DateTime.now(), enable: requestDetailProvider.activityMaintenanceHelperModel?.supplierStartTime != null, @@ -240,13 +241,13 @@ class _ExternalMaintenanceRequestState extends State 8.height, AppTextFormField( labelText: context.translation.workingHours, - backgroundColor: AppColor.neutral80, + backgroundColor: AppColor.fieldBgColor(context), controller: _workingHoursController, suffixIcon: "clock".toSvgAsset(width: 20, color: context.isDark ? AppColor.neutral10 : null).paddingOnly(end: 16), initialValue: requestDetailProvider.activityMaintenanceHelperModel?.supplierWorkingHour != null ? requestDetailProvider.activityMaintenanceHelperModel?.supplierWorkingHour.toString() : '', textAlign: TextAlign.center, - labelStyle: AppTextStyles.textFieldLabelStyle, + labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)), enable: false, showShadow: false, style: Theme.of(context).textTheme.titleMedium, diff --git a/lib/modules/cm_module/views/forms/maintenance_request/components/internal_request.dart b/lib/modules/cm_module/views/forms/maintenance_request/components/internal_request.dart index a214591d..d65026e6 100644 --- a/lib/modules/cm_module/views/forms/maintenance_request/components/internal_request.dart +++ b/lib/modules/cm_module/views/forms/maintenance_request/components/internal_request.dart @@ -88,7 +88,8 @@ class _InternalMaintenanceRequestState extends State height: 56.toScreenHeight, title: context.translation.activityStatus, showShadow: false, - backgroundColor: AppColor.neutral100, + // backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showAsBottomSheet: true, initialValue: requestDetailProvider.activityMaintenanceHelperModel?.activityStatus, onSelect: (status) { @@ -210,7 +211,7 @@ class _InternalMaintenanceRequestState extends State padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth), alignment: Alignment.centerLeft, decoration: BoxDecoration( - color: context.isDark ? AppColor.neutral40 : AppColor.background(context), + color: AppColor.fieldBgColor(context), borderRadius: BorderRadius.circular(10), boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)], ), @@ -249,7 +250,7 @@ class _InternalMaintenanceRequestState extends State AppTextFormField( labelText: context.translation.travelingHours, controller: _travellingHoursController, - backgroundColor: AppColor.neutral100, + backgroundColor:AppColor.fieldBgColor(context), showShadow: false, labelStyle: AppTextStyles.textFieldLabelStyle, suffixIcon: "clock".toSvgAsset(width: 20, color: context.isDark ? AppColor.neutral10 : null).paddingOnly(end: 16), @@ -268,7 +269,7 @@ class _InternalMaintenanceRequestState extends State 16.height, AppTextFormField( labelText: context.translation.assignedEmployee, - backgroundColor: AppColor.neutral80, + backgroundColor: AppColor.fieldBgColor(context), initialValue: requestDetailProvider.activityMaintenanceHelperModel?.assignedEmployee?.userName, textAlign: TextAlign.center, labelStyle: AppTextStyles.textFieldLabelStyle, @@ -280,7 +281,7 @@ class _InternalMaintenanceRequestState extends State AppTextFormField( initialValue: requestDetailProvider.activityMaintenanceHelperModel?.technicalComment, labelText: context.translation.technicalComment, - backgroundColor: AppColor.neutral100, + backgroundColor:AppColor.fieldBgColor(context), showShadow: false, labelStyle: AppTextStyles.textFieldLabelStyle, alignLabelWithHint: true, @@ -295,7 +296,7 @@ class _InternalMaintenanceRequestState extends State ], ), ).toShadowContainer(context).paddingOnly(start: 13, end: 14, top: 12), - AssistantEmployeeList( + ServiceRequestAssistantEmployeeList( assetId: requestDetailProvider.currentWorkOrder?.data?.asset?.id, assistantEmployeeList: requestDetailProvider.activityMaintenanceHelperModel?.assistantEmployList, onListChanged: (updatedList) { @@ -325,7 +326,7 @@ class _InternalMaintenanceRequestState extends State crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - context.translation.repairLocation.bodyText(context).custom(color: AppColor.black20), + context.translation.repairLocation.bodyText(context).custom(color: AppColor.textColor(context)), 8.height, Wrap( runSpacing: 8, @@ -357,7 +358,7 @@ class _InternalMaintenanceRequestState extends State ], ) ], - ).toShimmer(isShow: snapshot.isLoading), + ).toShimmer(isShow: snapshot.isLoading,context: context), ], ); }); diff --git a/lib/modules/cm_module/views/forms/maintenance_request/maintenance_request_main.dart b/lib/modules/cm_module/views/forms/maintenance_request/maintenance_request_main.dart index f6397770..d344b7e9 100644 --- a/lib/modules/cm_module/views/forms/maintenance_request/maintenance_request_main.dart +++ b/lib/modules/cm_module/views/forms/maintenance_request/maintenance_request_main.dart @@ -51,7 +51,7 @@ class _MaintenanceRequestFormState extends State with Si return Consumer(builder: (context, ServiceRequestDetailProvider requestDetailProvider, child) { bool isUpdate = requestDetailProvider.activityMaintenanceHelperModel?.id != 0; return Scaffold( - backgroundColor: AppColor.neutral110, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, appBar: DefaultAppBar( title: "CM Activity", onWillPopScope: requestDetailProvider.isReadOnlyRequest @@ -104,6 +104,7 @@ class _MaintenanceRequestFormState extends State with Si ), if (!requestDetailProvider.isReadOnlyRequest) FooterActionButton.footerContainer( + context: context, child: AppFilledButton( label: requestDetailProvider.activityMaintenanceHelperModel?.id != 0 ? context.translation.update : context.translation.addActivity, // Use the dynamic label buttonColor: AppColor.primary10, diff --git a/lib/modules/cm_module/views/forms/spare_part/spare_part_request.dart b/lib/modules/cm_module/views/forms/spare_part/spare_part_request.dart index 41bc6dd0..a3c412a3 100644 --- a/lib/modules/cm_module/views/forms/spare_part/spare_part_request.dart +++ b/lib/modules/cm_module/views/forms/spare_part/spare_part_request.dart @@ -307,6 +307,7 @@ class _SparePartRequestState extends State with TickerProvider ).paddingAll(12).expanded, if (!requestDetailProvider.isReadOnlyRequest) FooterActionButton.footerContainer( + context: context, child: AppFilledButton( label: _requestDetailProvider?.sparePartHelperModel?.id == 0 ? context.translation.addSparePartActivity : context.translation.updateSparePartActivity, buttonColor: AppColor.green70, diff --git a/lib/modules/cm_module/views/nurse/create_new_request_view.dart b/lib/modules/cm_module/views/nurse/create_new_request_view.dart index 6c276072..6f47c47a 100644 --- a/lib/modules/cm_module/views/nurse/create_new_request_view.dart +++ b/lib/modules/cm_module/views/nurse/create_new_request_view.dart @@ -169,6 +169,7 @@ class _CreateNewRequestState extends State with TickerProvider ), ).expanded, FooterActionButton.footerContainer( + context: context, child: AppFilledButton( // label: context.translation.submitRequest, buttonColor: AppColor.primary10, @@ -235,7 +236,7 @@ class _CreateNewRequestState extends State with TickerProvider ], ) ], - ).toShimmer(isShow: snapshot.loading), + ).toShimmer(isShow: snapshot.loading,context: context), ], ); }); @@ -277,7 +278,7 @@ class _CreateNewRequestState extends State with TickerProvider _serviceRequest.priority = snapshot.items.firstWhere((element) => element.value == 0, orElse: null); } setState(() {}); - }).toShimmer(isShow: snapshot.loading); + }).toShimmer(isShow: snapshot.loading,context: context); }), ], ); diff --git a/lib/modules/cm_module/views/service_request_detail_main_view.dart b/lib/modules/cm_module/views/service_request_detail_main_view.dart index 294c284b..bd89910c 100644 --- a/lib/modules/cm_module/views/service_request_detail_main_view.dart +++ b/lib/modules/cm_module/views/service_request_detail_main_view.dart @@ -73,7 +73,7 @@ class _ServiceRequestDetailMainState extends State { return true; }, child: Scaffold( - backgroundColor: AppColor.neutral100, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, appBar: DefaultAppBar( title: context.translation.cmDetails, onBackPress: () { diff --git a/lib/modules/pm_module/ppm_wo/update_ppm/ppm_calibration_tools_form.dart b/lib/modules/pm_module/ppm_wo/update_ppm/ppm_calibration_tools_form.dart index fd3d3913..848731f9 100644 --- a/lib/modules/pm_module/ppm_wo/update_ppm/ppm_calibration_tools_form.dart +++ b/lib/modules/pm_module/ppm_wo/update_ppm/ppm_calibration_tools_form.dart @@ -43,7 +43,7 @@ class _PpmCalibrationToolsFormState extends State { child: AppFilledButton( label: "Add More Calibration Tools".addTranslation, maxWidth: true, - textColor: AppColor.black10, + textColor: AppColor.headingTextColor(context), buttonColor: context.isDark ? AppColor.neutral60 : AppColor.white10, icon: Icon(Icons.add_circle, color: AppColor.blueStatus(context)), showIcon: true, @@ -107,7 +107,7 @@ class _PpmCalibrationToolsFormState extends State { label: context.translation.calibrationDate, date: DateTime.tryParse(model.calibrationDateOfTesters ?? ""), from: DateTime.now().subtract(const Duration(days: 90)), - backgroundColor: context.isDark ? AppColor.neutral50 : AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), withBorder: false, hideShadow: true, onDatePicker: (date) { diff --git a/lib/modules/pm_module/ppm_wo/update_ppm/ppm_external_details_form.dart b/lib/modules/pm_module/ppm_wo/update_ppm/ppm_external_details_form.dart index b689b26a..8b1be526 100644 --- a/lib/modules/pm_module/ppm_wo/update_ppm/ppm_external_details_form.dart +++ b/lib/modules/pm_module/ppm_wo/update_ppm/ppm_external_details_form.dart @@ -66,7 +66,7 @@ class _PpmExternalDetailsFormState extends State { child: AppFilledButton( label: "Add More External Details".addTranslation, maxWidth: true, - textColor: AppColor.black10, + textColor: AppColor.headingTextColor(context), buttonColor: context.isDark ? AppColor.neutral60 : AppColor.white10, icon: Icon(Icons.add_circle, color: AppColor.blueStatus(context)), showIcon: true, @@ -150,7 +150,7 @@ class _ExternalDetailItemState extends State { context: context, title: context.translation.supplier, initialValue: widget.model.supplier, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showAsBottomSheet: true, showShadow: false, showCancel: true, @@ -168,7 +168,7 @@ class _ExternalDetailItemState extends State { context: context, title: context.translation.supplierEngineer, enabled: widget.model.supplier != null, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), initialValue: widget.model.suppPerson, staticData: widget.model.supplier?.suppPersons, showAsBottomSheet: true, @@ -184,7 +184,7 @@ class _ExternalDetailItemState extends State { height: 56.toScreenHeight, width: 60.toScreenWidth, decoration: BoxDecoration( - color: AppColor.neutral100, + color: AppColor.fieldBgColor(context), borderRadius: BorderRadius.circular(10), //boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)], ), @@ -217,7 +217,7 @@ class _ExternalDetailItemState extends State { ADatePicker( label: context.translation.startTime, hideShadow: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), date: widget.model.startDateTime, formatDateWithTime: true, from: DateTime.tryParse(_ppmProvider?.planPreventiveVisit?.createdDate ?? ''), @@ -260,7 +260,7 @@ class _ExternalDetailItemState extends State { ADatePicker( label: context.translation.endTime, hideShadow: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), date: widget.model.endDateTime, enable: widget.model.startDateTime != null, formatDateWithTime: true, @@ -303,7 +303,7 @@ class _ExternalDetailItemState extends State { 8.height, AppTextFormField( labelText: context.translation.workingHours, - backgroundColor: AppColor.neutral80, + backgroundColor: AppColor.fieldBgColor(context), controller: controller, textAlign: TextAlign.center, enable: false, diff --git a/lib/modules/pm_module/ppm_wo/update_ppm/ppm_pm_check_list_form.dart b/lib/modules/pm_module/ppm_wo/update_ppm/ppm_pm_check_list_form.dart index 7d6e727e..9f5b0e63 100644 --- a/lib/modules/pm_module/ppm_wo/update_ppm/ppm_pm_check_list_form.dart +++ b/lib/modules/pm_module/ppm_wo/update_ppm/ppm_pm_check_list_form.dart @@ -55,6 +55,7 @@ class _PpmPmChecklistFormState extends State { ], AppTextFormField( labelText: "Task".addTranslation, + labelStyle: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120, fontWeight: FontWeight.w500), initialValue: list[index].instructionText?.text ?? "", enable: false, diff --git a/lib/modules/pm_module/ppm_wo/update_ppm/ppm_pm_kits_form.dart b/lib/modules/pm_module/ppm_wo/update_ppm/ppm_pm_kits_form.dart index e7ca9f0d..a25e4d4a 100644 --- a/lib/modules/pm_module/ppm_wo/update_ppm/ppm_pm_kits_form.dart +++ b/lib/modules/pm_module/ppm_wo/update_ppm/ppm_pm_kits_form.dart @@ -40,7 +40,7 @@ class _PpmPMKitsFormState extends State { child: AppFilledButton( label: "Add More PM Kits".addTranslation, maxWidth: true, - textColor: AppColor.black10, + textColor: AppColor.headingTextColor(context), buttonColor: context.isDark ? AppColor.neutral60 : AppColor.white10, icon: Icon(Icons.add_circle, color: AppColor.blueStatus(context)), showIcon: true, diff --git a/lib/modules/pm_module/ppm_wo/update_ppm/update_ppm.dart b/lib/modules/pm_module/ppm_wo/update_ppm/update_ppm.dart index 16899bb9..9dcdad42 100644 --- a/lib/modules/pm_module/ppm_wo/update_ppm/update_ppm.dart +++ b/lib/modules/pm_module/ppm_wo/update_ppm/update_ppm.dart @@ -122,7 +122,7 @@ class _UpdatePpmState extends State with TickerProviderStateMixin { @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: AppColor.neutral110, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, appBar: DefaultAppBar( title: context.translation.preventiveMaintenance, onWillPopScope: ppmProvider.isReadOnly @@ -204,6 +204,7 @@ class _UpdatePpmState extends State with TickerProviderStateMixin { if (tabIndex == 1) ...[ AppFilledButton( buttonColor: _tabController!.index == 0 ? null : AppColor.background(context), + // buttonColor: _tabController!.index == 0 ? null : AppColor.background(context), textColor: _tabController!.index == 0 ? null : AppColor.blueStatus(context), showBorder: true, disableButton: _tabController!.index == 0, @@ -221,8 +222,10 @@ class _UpdatePpmState extends State with TickerProviderStateMixin { ], if (!ppmProvider.isReadOnly) ...[ AppFilledButton( - buttonColor: AppColor.white60, - textColor: AppColor.neutral50, + // buttonColor: AppColor.white60, + // textColor: AppColor.neutral50, + buttonColor: context.isDark?AppColor.neutral50:AppColor.white60, + textColor: context.isDark ? Colors.white: AppColor.neutral150, onPressed: () { _onSubmit(status: 0); }, diff --git a/lib/modules/pm_module/ppm_wo/update_ppm/wo_info_form.dart b/lib/modules/pm_module/ppm_wo/update_ppm/wo_info_form.dart index 0e12c5dc..0e126823 100644 --- a/lib/modules/pm_module/ppm_wo/update_ppm/wo_info_form.dart +++ b/lib/modules/pm_module/ppm_wo/update_ppm/wo_info_form.dart @@ -82,7 +82,7 @@ class _WoInfoFormState extends State { backgroundColor: AppColor.getRequestStatusColorByName(context, widget.planPreventiveVisit.visitStatus?.name), ), 8.height, - widget.planPreventiveVisit.planName!.bodyText(context).custom(color: AppColor.black10), + widget.planPreventiveVisit.planName!.bodyText(context).custom(color: AppColor.headingTextColor(context)), 2.height, '${context.translation.pmPlanNo}: ${widget.planPreventiveVisit.planNo}'.bodyText2(context).custom(color: AppColor.neutral120), //need to add in translation it's suggestion from ahmed.. @@ -107,7 +107,7 @@ class _WoInfoFormState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - widget.planPreventiveVisit.assetName!.bodyText(context).custom(color: AppColor.black10).expanded, + widget.planPreventiveVisit.assetName!.bodyText(context).custom(color: AppColor.headingTextColor(context)).expanded, "info_icon".toSvgAsset(height: 17, width: 17).onPress( () { // There is only limited information for asset is returned from backend to show all info need to return the whole model from backend... @@ -127,8 +127,8 @@ class _WoInfoFormState extends State { ], ), 2.height, - '${context.translation.assetNo}: ${widget.planPreventiveVisit.asset?.assetNumber}'.bodyText2(context).custom(color: AppColor.neutral120), - '${context.translation.model}: ${widget.planPreventiveVisit.model}'.bodyText2(context).custom(color: AppColor.neutral120), + '${context.translation.assetNo}: ${widget.planPreventiveVisit.asset?.assetNumber}'.bodyText2(context).custom(color: AppColor.lightTextColor(context)), + '${context.translation.model}: ${widget.planPreventiveVisit.model}'.bodyText2(context).custom(color: AppColor.lightTextColor(context)), ], ).toShadowContainer(context), @@ -172,7 +172,7 @@ class _WoInfoFormState extends State { initialValue: widget.planPreventiveVisit.taskStatus == null ? null : Lookup(name: widget.planPreventiveVisit.taskStatus?.name ?? "", id: widget.planPreventiveVisit.taskStatus?.id), title: context.translation.pmTestResult, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), onSelect: (value) { if (value != null) { widget.planPreventiveVisit.taskStatus = value; @@ -183,7 +183,7 @@ class _WoInfoFormState extends State { ADatePicker( label: context.translation.actualVisit, hideShadow: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), date: widget.planPreventiveVisit.acutalDateOfVisit, from: DateTime.tryParse(widget.planPreventiveVisit.creationDate ?? ''), formatDateWithTime: true, @@ -230,7 +230,7 @@ class _WoInfoFormState extends State { 8.height, SingleItemDropDownMenu( context: context, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, initialValue: widget.planPreventiveVisit.safety?.id == null ? null : Lookup(name: widget.planPreventiveVisit.safety?.name ?? "", id: widget.planPreventiveVisit.safety?.id), title: "Electrical Safety", @@ -243,7 +243,7 @@ class _WoInfoFormState extends State { 8.height, SingleItemDropDownMenu( context: context, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, initialValue: widget.planPreventiveVisit.assetAvailability == null ? null @@ -258,7 +258,7 @@ class _WoInfoFormState extends State { 8.height, SingleItemDropDownMenu( context: context, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, initialValue: widget.planPreventiveVisit.typeOfService == null ? null @@ -281,7 +281,7 @@ class _WoInfoFormState extends State { 8.height, AppTextFormField( labelText: context.translation.comment, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, initialValue: (widget.planPreventiveVisit.comments ?? "").toString(), textAlign: TextAlign.center, @@ -359,7 +359,7 @@ class _WoInfoFormState extends State { children: [ AppTimer( label: context.translation.workingHours, - decoration: BoxDecoration(color: AppColor.neutral100, borderRadius: BorderRadius.circular(10)), + decoration: BoxDecoration(color: AppColor.fieldBgColor(context), borderRadius: BorderRadius.circular(10)), width: double.infinity, timer: widget.planPreventiveVisit.tbsTimer, pickerTimer: widget.planPreventiveVisit.ppMTimePicker, diff --git a/lib/modules/pm_module/recurrent_wo/recurrent_work_order_view.dart b/lib/modules/pm_module/recurrent_wo/recurrent_work_order_view.dart index 66381ccd..45d485a0 100644 --- a/lib/modules/pm_module/recurrent_wo/recurrent_work_order_view.dart +++ b/lib/modules/pm_module/recurrent_wo/recurrent_work_order_view.dart @@ -79,6 +79,8 @@ class _RecurrentWorkOrderViewState extends State { ).paddingOnly(bottom: 85), if (requestProvider.recurrentWoData?.status?.value != 1) ...[ FooterActionButton.footerContainer( + context: context, + child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ diff --git a/lib/modules/tm_module/tasks_wo/create_task_view.dart b/lib/modules/tm_module/tasks_wo/create_task_view.dart index 95b9d17a..6713de2f 100644 --- a/lib/modules/tm_module/tasks_wo/create_task_view.dart +++ b/lib/modules/tm_module/tasks_wo/create_task_view.dart @@ -122,6 +122,7 @@ class _CreateTaskViewState extends State with TickerProviderStat ).toShadowContainer(context).paddingAll(16), ).expanded, FooterActionButton.footerContainer( + context: context, child: AppFilledButton( buttonColor: AppColor.primary10, label: context.translation.submitRequest, diff --git a/lib/modules/tm_module/tasks_wo/update_task_request_view.dart b/lib/modules/tm_module/tasks_wo/update_task_request_view.dart index 4bae9bd5..0750e03b 100644 --- a/lib/modules/tm_module/tasks_wo/update_task_request_view.dart +++ b/lib/modules/tm_module/tasks_wo/update_task_request_view.dart @@ -125,7 +125,8 @@ class _UpdateTaskRequestState extends State { initialValue: "", labelText: context.translation.technicalComment, textInputType: TextInputType.multiline, - backgroundColor: AppColor.neutral90, + backgroundColor: AppColor.fieldBgColor(context), + labelStyle: TextStyle(color: AppColor.textColor(context)), showShadow: false, alignLabelWithHint: true, onChange: (value) { @@ -150,6 +151,7 @@ class _UpdateTaskRequestState extends State { ), ).paddingOnly(bottom: 85), FooterActionButton.footerContainer( + context: context, child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ @@ -263,7 +265,7 @@ class _UpdateTaskRequestState extends State { ADatePicker( label: context.translation.installationDate, hideShadow: true, - backgroundColor: AppColor.neutral90, + backgroundColor: AppColor.fieldBgColor(context), date: DateTime.tryParse(taskModel.installationDate ?? ""), formatDateWithTime: false, onDatePicker: (selectedDate) { @@ -289,7 +291,7 @@ class _UpdateTaskRequestState extends State { 8.height, AppTextFormField( labelText: context.translation.serialNo, - backgroundColor: AppColor.neutral90, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, labelStyle: AppTextStyles.textFieldLabelStyle, initialValue: taskModel.serialNo ?? '', @@ -305,7 +307,7 @@ class _UpdateTaskRequestState extends State { initialValue: taskModel.site, loading: _taskProvider?.isSiteLoading, showAsBottomSheet: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, enabled: false, onSelect: (value) { @@ -323,7 +325,7 @@ class _UpdateTaskRequestState extends State { SingleItemDropDownMenu( context: context, title: 'Installation Building', - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showAsBottomSheet: true, loading: _taskProvider?.isSiteLoading, showShadow: false, @@ -344,7 +346,7 @@ class _UpdateTaskRequestState extends State { SingleItemDropDownMenu( context: context, showAsBottomSheet: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), loading: _taskProvider?.isSiteLoading, showShadow: false, title: 'Installation Floor', @@ -364,7 +366,7 @@ class _UpdateTaskRequestState extends State { SingleItemDropDownMenu( context: context, title: 'Installation Department', - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), loading: _taskProvider?.isSiteLoading, showAsBottomSheet: true, showShadow: false, @@ -424,7 +426,7 @@ class _UpdateTaskRequestState extends State { height: 56.toScreenHeight, title: context.translation.completedActions, showShadow: false, - backgroundColor: AppColor.neutral90, + backgroundColor: AppColor.fieldBgColor(context), enabled: false, showAsBottomSheet: true, initialValue: taskModel.actionNeeded, @@ -439,7 +441,7 @@ class _UpdateTaskRequestState extends State { height: 56.toScreenHeight, title: context.translation.impactStatus, showShadow: false, - backgroundColor: AppColor.neutral90, + backgroundColor: AppColor.fieldBgColor(context), showAsBottomSheet: true, initialValue: taskModel.impactStatus, onSelect: (status) { @@ -463,7 +465,7 @@ class _UpdateTaskRequestState extends State { height: 56.toScreenHeight, title: context.translation.completedActions, showShadow: false, - backgroundColor: AppColor.neutral90, + backgroundColor: AppColor.fieldBgColor(context), enabled: false, showAsBottomSheet: true, initialValue: taskModel.actionNeeded, @@ -478,7 +480,7 @@ class _UpdateTaskRequestState extends State { height: 56.toScreenHeight, title: context.translation.impactStatus, showShadow: false, - backgroundColor: AppColor.neutral90, + backgroundColor: AppColor.fieldBgColor(context), showAsBottomSheet: true, initialValue: taskModel.impactStatus, onSelect: (status) { @@ -510,7 +512,7 @@ class _UpdateTaskRequestState extends State { width: double.infinity, enabled: isTimerEnable, decoration: BoxDecoration( - color: AppColor.neutral90, + color: AppColor.fieldBgColor(context), borderRadius: BorderRadius.circular(10), ), pickerTimer: taskProvider.taskRequestModel?.taskTimePicker, @@ -529,11 +531,11 @@ class _UpdateTaskRequestState extends State { crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start, children: [ - 'Total Working Time:'.bodyText2(context).custom(color: AppColor.neutral50), + 'Total Working Time:'.bodyText2(context).custom(color: AppColor.textColor(context)), 8.width, Text( ServiceRequestUtils.formatTimerDuration(totalWorkingHours.round()), - style: AppTextStyles.bodyText.copyWith(color: AppColor.neutral50, fontWeight: FontWeight.w600), + style: AppTextStyles.bodyText.copyWith(color: AppColor.textColor(context), fontWeight: FontWeight.w600), ), ], ), @@ -630,7 +632,7 @@ class _AssistantEmployeeCardState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - context.translation.assistantEmployee.heading6(context).custom(color: AppColor.black10), + context.translation.assistantEmployee.heading6(context).custom(color: AppColor.textColor(context)), Icon(isExpanded ? Icons.keyboard_arrow_up_rounded : Icons.keyboard_arrow_down_rounded), ], ), @@ -645,7 +647,7 @@ class _AssistantEmployeeCardState extends State { children: [ ServiceReportAssistantEmployeeMenu( title: context.translation.select, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), initialValue: (taskModel?.assistantEmployees?.isNotEmpty ?? false) ? taskModel?.assistantEmployees?.first : null, onSelect: (employee) { if (employee == null) { @@ -663,7 +665,7 @@ class _AssistantEmployeeCardState extends State { ADatePicker( label: context.translation.startTime, hideShadow: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), date: taskModel?.modelAssistantEmployees?.startDate, // from: taskModel?.d, formatDateWithTime: true, @@ -703,7 +705,7 @@ class _AssistantEmployeeCardState extends State { ADatePicker( label: context.translation.endTime, hideShadow: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), date: taskModel?.modelAssistantEmployees?.endDate, enable: taskModel?.modelAssistantEmployees?.startDate != null, formatDateWithTime: true, @@ -757,12 +759,12 @@ class _AssistantEmployeeCardState extends State { 8.height, AppTextFormField( labelText: context.translation.workingHours, - backgroundColor: AppColor.neutral80, + backgroundColor: AppColor.fieldBgColor(context), controller: _workingHoursController, suffixIcon: "clock".toSvgAsset(width: 20, color: context.isDark ? AppColor.neutral10 : null).paddingOnly(end: 16), initialValue: taskModel?.modelAssistantEmployees?.workingHours != null ? taskModel!.modelAssistantEmployees!.workingHours?.toStringAsFixed(2) : '', textAlign: TextAlign.center, - labelStyle: AppTextStyles.textFieldLabelStyle, + labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)), enable: false, showShadow: false, style: Theme.of(context).textTheme.titleMedium, @@ -771,9 +773,9 @@ class _AssistantEmployeeCardState extends State { AppTextFormField( initialValue: taskModel?.modelAssistantEmployees?.comment, labelText: context.translation.comment, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, - labelStyle: AppTextStyles.textFieldLabelStyle, + labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)), alignLabelWithHint: true, textInputType: TextInputType.multiline, onChange: (value) { diff --git a/lib/new_views/app_style/app_color.dart b/lib/new_views/app_style/app_color.dart index 847b6b59..65b5ee15 100644 --- a/lib/new_views/app_style/app_color.dart +++ b/lib/new_views/app_style/app_color.dart @@ -96,6 +96,11 @@ class AppColor { static Color yellowIcon(BuildContext context) => context.isDark ? const Color(0xffFFC945) : orange70; static Color background(BuildContext context) => context.isDark ? neutral60 : Colors.white; + static Color textColor(BuildContext context) =>context.isDark ? AppColor.neutral30 : AppColor.neutral50; + static Color headingTextColor(BuildContext context) =>context.isDark ? AppColor.neutral30 : AppColor.black10; + static Color lightTextColor(BuildContext context) =>AppColor.neutral120; + static Color iconColor(BuildContext context) =>context.isDark ? AppColor.neutral30 : AppColor.neutral50; + static Color fieldBgColor(BuildContext context) => context.isDark ? AppColor.neutral20 : AppColor.neutral100; static Color selectedButtonColor(BuildContext context) => context.isDark ? neutral60 : neutral30; diff --git a/lib/new_views/common_widgets/app_bottom_nav_bar.dart b/lib/new_views/common_widgets/app_bottom_nav_bar.dart index 0d4211e6..13736b36 100644 --- a/lib/new_views/common_widgets/app_bottom_nav_bar.dart +++ b/lib/new_views/common_widgets/app_bottom_nav_bar.dart @@ -33,7 +33,8 @@ class AppBottomNavigationBar extends StatelessWidget { boxShadow: [boxShadowR14], ), child: BottomNavigationBar( - backgroundColor: Colors.white, + // backgroundColor: Colors.white, + backgroundColor: AppColor.background(context), items: [ for (int i = 0; i < navItems.length; i++) navBarItem(context, index: navItems[i].index, iconName: navItems[i].iconName, label: navItems[i].label, showLabel: navItems[i].showLabel), ], diff --git a/lib/new_views/common_widgets/app_filled_button.dart b/lib/new_views/common_widgets/app_filled_button.dart index 87376c27..8e1e67f2 100644 --- a/lib/new_views/common_widgets/app_filled_button.dart +++ b/lib/new_views/common_widgets/app_filled_button.dart @@ -1,7 +1,9 @@ import 'package:flutter/material.dart'; +import 'package:test_sa/extensions/context_extension.dart'; import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart'; +import 'package:test_sa/models/new_models/gas_refill_model.dart'; import 'package:test_sa/new_views/app_style/app_color.dart'; class AppFilledButton extends StatelessWidget { @@ -43,7 +45,7 @@ class AppFilledButton extends StatelessWidget { alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), - color: disableButton ? AppColor.neutral140 : (buttonColor ?? AppColor.blueStatus(context)), + color: disableButton ?context.isDark ?AppColor.neutral20 :AppColor.neutral140 : (buttonColor ?? AppColor.blueStatus(context)), border: showBorder ? Border.all(color: textColor ?? AppColor.background(context)) : null, ), child: loading diff --git a/lib/new_views/common_widgets/app_text_form_field.dart b/lib/new_views/common_widgets/app_text_form_field.dart index e607c105..2434230c 100644 --- a/lib/new_views/common_widgets/app_text_form_field.dart +++ b/lib/new_views/common_widgets/app_text_form_field.dart @@ -188,7 +188,7 @@ class _AppTextFormFieldState extends State { controller: widget.controller, textInputAction: widget.textInputType == TextInputType.multiline ? null : widget.textInputAction ?? TextInputAction.next, onEditingComplete: widget.onAction ?? () => FocusScope.of(context).nextFocus(), - style: widget.style ?? AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500,color: AppColor.black10), + style: widget.style ?? AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500,color:context.isDark?AppColor.white10: AppColor.black10), onTap: widget.onTap, decoration: InputDecoration( alignLabelWithHint: widget.alignLabelWithHint, @@ -208,7 +208,7 @@ class _AppTextFormFieldState extends State { ? (widget.enableColor ?? AppColor.neutral40) : AppColor.background(context)), errorStyle: AppTextStyle.tiny.copyWith(color: context.isDark ? AppColor.red50 : AppColor.red60), - floatingLabelStyle: AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? null : AppColor.neutral20), + floatingLabelStyle: AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? AppColor.white10 : AppColor.neutral20), hintText: widget.hintText ?? "", labelText: (widget.showSpeechToText && _speechToText.isListening) ? "Listening..." : widget.labelText ?? "", labelStyle: widget.labelStyle, diff --git a/lib/new_views/common_widgets/single_item_drop_down_menu.dart b/lib/new_views/common_widgets/single_item_drop_down_menu.dart index e552af1c..404269fa 100644 --- a/lib/new_views/common_widgets/single_item_drop_down_menu.dart +++ b/lib/new_views/common_widgets/single_item_drop_down_menu.dart @@ -112,7 +112,7 @@ class _SingleItemDropDownMenuState { context: context, title: context.translation.gasType, initialValue: _currentDetails.gasType, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, showAsBottomSheet: true, onSelect: (value) { @@ -92,7 +92,7 @@ class _GasRefillRequestFormState extends State { context: context, title: context.translation.cylinderType, initialValue: _currentDetails.cylinderType, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, onSelect: (value) { _currentDetails.cylinderType = value; @@ -104,7 +104,7 @@ class _GasRefillRequestFormState extends State { title: context.translation.cylinderSize, initialValue: _currentDetails.cylinderSize, showAsBottomSheet: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, onSelect: (value) { _currentDetails.cylinderSize = value; @@ -117,7 +117,7 @@ class _GasRefillRequestFormState extends State { showAsBottomSheet: true, initialValue: _requestedQuantity, staticData: gasQuantity, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, onSelect: (value) { _requestedQuantity = value; @@ -132,7 +132,7 @@ class _GasRefillRequestFormState extends State { title: context.translation.site, initialValue: _gasModel.mapSite, showAsBottomSheet: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, onSelect: (value) { setState(() { @@ -151,7 +151,7 @@ class _GasRefillRequestFormState extends State { enabled: _gasModel.mapSite?.buildings?.isNotEmpty ?? false, staticData: _gasModel.mapSite?.buildings ?? [], showAsBottomSheet: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, onSelect: (value) { setState(() { @@ -173,7 +173,7 @@ class _GasRefillRequestFormState extends State { enabled: _gasModel.mappedBuilding?.floors?.isNotEmpty ?? false, staticData: _gasModel.mappedBuilding?.floors ?? [], showAsBottomSheet: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, onSelect: (value) { setState(() { @@ -190,7 +190,7 @@ class _GasRefillRequestFormState extends State { enabled: _gasModel.mappedFloor?.departments?.isNotEmpty ?? false, staticData: _gasModel.mappedFloor?.departments ?? [], showAsBottomSheet: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, onSelect: (value) { _gasModel.mappedDepartment = value; @@ -201,10 +201,10 @@ class _GasRefillRequestFormState extends State { 8.height, AppTextFormField( labelText: context.translation.callComments, - labelStyle: AppTextStyles.tinyFont.copyWith(color: AppColor.neutral120), + labelStyle: AppTextStyles.tinyFont.copyWith(color: AppColor.textColor(context)), textInputType: TextInputType.multiline, alignLabelWithHint: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, controller: _commentController, onChange: (value) { @@ -224,7 +224,7 @@ class _GasRefillRequestFormState extends State { ).toShadowContainer(context, padding: 10).paddingOnly(start: 16, end: 16, top: 16), ).expanded, 16.height, - FooterActionButton.footerContainer(child: AppFilledButton(label: context.translation.submitRequest, maxWidth: true, onPressed: _submit)), + FooterActionButton.footerContainer(context: context, child: AppFilledButton(label: context.translation.submitRequest, maxWidth: true, onPressed: _submit)), ], ), ); diff --git a/lib/new_views/pages/land_page/calender_fragments/monthly_fragment.dart b/lib/new_views/pages/land_page/calender_fragments/monthly_fragment.dart index d30c90c1..a65bf77b 100644 --- a/lib/new_views/pages/land_page/calender_fragments/monthly_fragment.dart +++ b/lib/new_views/pages/land_page/calender_fragments/monthly_fragment.dart @@ -76,10 +76,10 @@ class _MonthlyFragmentState extends State { day: day, fill: snapshot.calendarRequests?.requestsDetails?.firstWhere( (element) => (element.date != null) && (DateTime.tryParse(element.date!)?.difference(dateTime).inDays == 0), - orElse: null, + orElse: null, ) != null, - ).toShimmer(isShow: snapshot.isCalendarLoading); + ).toShimmer(isShow: snapshot.isCalendarLoading, context: context); }, ), daysOfWeekHeight: 35.toScreenHeight, diff --git a/lib/new_views/pages/land_page/create_request-type_bottomsheet.dart b/lib/new_views/pages/land_page/create_request-type_bottomsheet.dart index 89bcbcf9..ee9b70db 100644 --- a/lib/new_views/pages/land_page/create_request-type_bottomsheet.dart +++ b/lib/new_views/pages/land_page/create_request-type_bottomsheet.dart @@ -23,6 +23,7 @@ class CreateRequestTypeBottomSheet extends StatelessWidget { return Container( padding: const EdgeInsets.all(16.0), width: double.infinity, + color: AppColor.background(context), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, @@ -63,13 +64,13 @@ class CreateRequestTypeBottomSheet extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - const Icon( + Icon( Icons.add_circle, - color: AppColor.neutral120, + color: AppColor.iconColor(context), size: 32, ), //24.height, - label.bodyText2(context).custom(color: AppColor.black20), + label.bodyText2(context).custom(color:context.isDark?Colors.white: AppColor.black20), ], ), ), diff --git a/lib/new_views/pages/login_page.dart b/lib/new_views/pages/login_page.dart index 53ac8d78..d689ad41 100644 --- a/lib/new_views/pages/login_page.dart +++ b/lib/new_views/pages/login_page.dart @@ -107,11 +107,11 @@ class _LoginPageState extends State { AppTextFormField( initialValue: _user.userName ?? "", controller: userNameController, - backgroundColor: AppColor.white20, + backgroundColor: AppColor.fieldBgColor(context), validator: (value) => Validator.hasValue(value!) ? null : context.translation.requiredField, labelText: context.translation.username, - style: TextStyle(fontWeight: FontWeight.w500, fontSize: 12, color: Color(0xff3B3D4A)), - labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 11, color: Color(0xff767676)), + style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 12, color: Color(0xff3B3D4A)), + labelStyle: const TextStyle(fontWeight: FontWeight.w500, fontSize: 11, color: Color(0xff767676)), textInputType: TextInputType.text, showWithoutDecoration: true, contentPadding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 12.toScreenHeight), @@ -124,7 +124,7 @@ class _LoginPageState extends State { initialValue: _user.password ?? "", showWithoutDecoration: true, labelText: context.translation.password, - backgroundColor: AppColor.white20, + backgroundColor: AppColor.fieldBgColor(context), style: TextStyle(fontWeight: FontWeight.w500, fontSize: 12, color: Color(0xff3B3D4A)), labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 11, color: Color(0xff767676)), contentPadding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 12.toScreenHeight), diff --git a/lib/new_views/swipe_module/dialoge/acknowledge_work_dialog.dart b/lib/new_views/swipe_module/dialoge/acknowledge_work_dialog.dart index b89f22af..916d1b06 100644 --- a/lib/new_views/swipe_module/dialoge/acknowledge_work_dialog.dart +++ b/lib/new_views/swipe_module/dialoge/acknowledge_work_dialog.dart @@ -21,7 +21,7 @@ class AcknowledgeWorkDialog extends StatelessWidget { @override Widget build(BuildContext context) { return Dialog( - backgroundColor: Colors.white, + backgroundColor: AppColor.background(context), shape: const RoundedRectangleBorder(), insetPadding: const EdgeInsets.only(left: 21, right: 21), child: Padding( @@ -30,11 +30,11 @@ class AcknowledgeWorkDialog extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - const Text( + Text( "Confirm", - style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: Colors.black87, height: 35 / 24, letterSpacing: -0.96), + style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: AppColor.headingTextColor(context), height: 35 / 24, letterSpacing: -0.96), ).paddingOnly(top: 16, bottom: 8), - message != null ? message!.heading5(context).custom(color: AppColor.neutral50) : const SizedBox(), + message != null ? message!.heading5(context).custom(color: AppColor.textColor(context)) : const SizedBox(), 28.height, Row( children: [ diff --git a/lib/views/pages/device_transfer/create__device_transfer_request.dart b/lib/views/pages/device_transfer/create__device_transfer_request.dart index 1e6a727f..859109da 100644 --- a/lib/views/pages/device_transfer/create__device_transfer_request.dart +++ b/lib/views/pages/device_transfer/create__device_transfer_request.dart @@ -144,7 +144,7 @@ class _CreateDeviceTransferRequestState extends State { labelText: context.translation.technicalComment, labelStyle: AppTextStyles.tinyFont.copyWith(color: AppColor.neutral20), textInputType: TextInputType.multiline, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, alignLabelWithHint: true, onSaved: (value) { @@ -288,13 +288,14 @@ class _UpdateDeviceTransferState extends State { ), ).expanded, FooterActionButton.footerContainer( + context: context, child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ AppFilledButton( label: context.translation.save, - buttonColor: AppColor.white60, - textColor: AppColor.black10, + buttonColor: context.isDark?AppColor.neutral70:AppColor.white60, + textColor: context.isDark?AppColor.white10:AppColor.black10, onPressed: () => _update(status: 0), ).expanded, 12.width, @@ -344,7 +345,7 @@ class _UpdateDeviceTransferState extends State { width: double.infinity, enabled: isTimerEnable, decoration: BoxDecoration( - color: AppColor.neutral100, + color: AppColor.fieldBgColor(context), borderRadius: BorderRadius.circular(10), ), pickerTimer: _formModel.deviceTimePicker, @@ -371,7 +372,7 @@ class _UpdateDeviceTransferState extends State { 8.width, Text( ServiceRequestUtils.formatTimerDuration(totalWorkingHours.round()), - style: AppTextStyles.bodyText.copyWith(color: AppColor.neutral50, fontWeight: FontWeight.w600), + style: AppTextStyles.bodyText.copyWith(color: context.isDark?AppColor.white10: AppColor.neutral50, fontWeight: FontWeight.w600), ), ], ), @@ -450,7 +451,7 @@ class _DeviceTransferAssistantEmployeeListState extends State onUpdate((model) => model.techComment = value), diff --git a/lib/views/pages/user/gas_refill/update_gas_refill_request.dart b/lib/views/pages/user/gas_refill/update_gas_refill_request.dart index 5931c58e..790ce607 100644 --- a/lib/views/pages/user/gas_refill/update_gas_refill_request.dart +++ b/lib/views/pages/user/gas_refill/update_gas_refill_request.dart @@ -232,7 +232,7 @@ class _UpdateGasRefillRequestState extends State { SingleItemDropDownMenu( context: context, title: context.translation.quantity, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, showAsBottomSheet: true, initialValue: _deliveredQuantity, @@ -248,8 +248,10 @@ class _UpdateGasRefillRequestState extends State { AppTextFormField( labelText: context.translation.technicalComment, textInputType: TextInputType.multiline, + hintStyle: TextStyle(color: context.isDark?AppColor.white10:AppColor.black10), + labelStyle: TextStyle(color: context.isDark?AppColor.white10:AppColor.black10), alignLabelWithHint: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, controller: _commentController, onChange: (value) { @@ -270,13 +272,14 @@ class _UpdateGasRefillRequestState extends State { ).toShadowContainer(context), ).expanded, FooterActionButton.footerContainer( + context: context, child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ AppFilledButton( label: context.translation.save, - buttonColor: AppColor.white60, - textColor: AppColor.black10, + buttonColor: context.isDark?AppColor.neutral70:AppColor.white60, + textColor: context.isDark?AppColor.white10:AppColor.black10, onPressed: () => _onSubmit(context, 0), ).expanded, 12.width, @@ -313,7 +316,8 @@ class _UpdateGasRefillRequestState extends State { }, width: double.infinity, decoration: BoxDecoration( - color: AppColor.neutral100, + color: AppColor.fieldBgColor(context), + // color: AppColor.neutral100, borderRadius: BorderRadius.circular(10), ), timerProgress: (isRunning) {}, @@ -332,7 +336,7 @@ class _UpdateGasRefillRequestState extends State { 8.width, Text( ServiceRequestUtils.formatTimerDuration(totalWorkingHours.round()), - style: AppTextStyles.bodyText.copyWith(color: AppColor.neutral50, fontWeight: FontWeight.w600), + style: AppTextStyles.bodyText.copyWith(color:context.isDark?AppColor.white10: AppColor.neutral50, fontWeight: FontWeight.w600), ), ], ), diff --git a/lib/views/pages/user/requests/create_service_request_page.dart b/lib/views/pages/user/requests/create_service_request_page.dart index 791c5b57..617cb4fa 100644 --- a/lib/views/pages/user/requests/create_service_request_page.dart +++ b/lib/views/pages/user/requests/create_service_request_page.dart @@ -190,7 +190,7 @@ class CreateServiceRequestPageState extends State { _serviceRequest.priority = snapshot.items.firstWhere((element) => element.value == 0, orElse: null); } setState(() {}); - }).toShimmer(isShow: snapshot.loading), + }).toShimmer(isShow: snapshot.loading,context: context), ); }), ], @@ -239,7 +239,7 @@ class CreateServiceRequestPageState extends State { ], ) ], - ).toShimmer(isShow: snapshot.loading), + ).toShimmer(isShow: snapshot.loading,context: context), ], ); }), diff --git a/lib/views/widgets/bottom_sheets/selection_bottom_sheet.dart b/lib/views/widgets/bottom_sheets/selection_bottom_sheet.dart index 8c7561da..e04a97b3 100644 --- a/lib/views/widgets/bottom_sheets/selection_bottom_sheet.dart +++ b/lib/views/widgets/bottom_sheets/selection_bottom_sheet.dart @@ -94,6 +94,8 @@ class _SelectionBottomSheetState extends State> { decoration: InputDecoration( hintText: 'Search by name', labelText: 'Search', + filled: true, + focusColor: AppColor.fieldBgColor(context), hintStyle: const TextStyle(fontSize: 14), focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: AppColor.blueStatus(context), width: 2.0), @@ -119,6 +121,7 @@ class _SelectionBottomSheetState extends State> { contentPadding: EdgeInsets.zero, groupValue: _selectedValue, activeColor: Colors.black87, + onChanged: (value) { _selectedValue = value; searchFocusNode.unfocus(); diff --git a/lib/views/widgets/equipment/asset_picker.dart b/lib/views/widgets/equipment/asset_picker.dart index 8a3b35e2..a9d8e5f0 100644 --- a/lib/views/widgets/equipment/asset_picker.dart +++ b/lib/views/widgets/equipment/asset_picker.dart @@ -164,7 +164,7 @@ class AssetPicker extends StatelessWidget { color: Colors.black87, decoration: TextDecoration.none, ), - ).toShimmer(isShow: showLoading).expanded, + ).toShimmer(isShow: showLoading,context: context).expanded, const Icon( Icons.info, color: Color(0xff7D859A), @@ -195,10 +195,10 @@ class AssetPicker extends StatelessWidget { ], ), 8.height, - "${context.translation.assetNo}: ${device!.assetNumber}".bodyText2(context).toShimmer(isShow: showLoading), + "${context.translation.assetNo}: ${device!.assetNumber}".bodyText2(context).toShimmer(isShow: showLoading,context: context), 2.height, // "${context.translation.manufacture}: ${device.modelDefinition?.manufacturerName}".bodyText(context), - "${context.translation.model}: ${device!.modelDefinition?.modelName}".bodyText2(context).toShimmer(isShow: showLoading), + "${context.translation.model}: ${device!.modelDefinition?.modelName}".bodyText2(context).toShimmer(isShow: showLoading,context: context), // "${context.translation.serialNumber}: ${device.assetNumber}".bodyText(context), // const Divider().defaultStyle(context), // "${context.translation.department}: ${device.department?.departmentName}".bodyText(context), diff --git a/lib/views/widgets/notifications/notification_item.dart b/lib/views/widgets/notifications/notification_item.dart index 682deea7..89fef4b5 100644 --- a/lib/views/widgets/notifications/notification_item.dart +++ b/lib/views/widgets/notifications/notification_item.dart @@ -28,14 +28,14 @@ class NotificationItem extends StatelessWidget { label: notification.priorityName, textColor: AppColor.getRequestStatusTextColorByName(context, notification.priorityName!), backgroundColor: AppColor.getRequestStatusColorByName(context, notification.priorityName!), - ).toShimmer(isShow: isLoading), + ).toShimmer(isShow: isLoading,context: context), 8.width, if ((notification.statusName ?? "").isNotEmpty && notification.sourceName != "Asset Transfer") StatusLabel( label: notification.statusName ?? "", textColor: AppColor.getRequestStatusTextColorByName(context, notification.statusName ?? ""), backgroundColor: AppColor.getRequestStatusColorByName(context, notification.statusName ?? ""), - ).toShimmer(isShow: isLoading), + ).toShimmer(isShow: isLoading,context: context), ], ), 8.height, @@ -47,7 +47,7 @@ class NotificationItem extends StatelessWidget { style: AppTextStyles.heading6.copyWith( color: context.isDark ? AppColor.neutral30 : AppColor.neutral50, ), - ).toShimmer(isShow: isLoading).expanded, + ).toShimmer(isShow: isLoading,context: context).expanded, 8.width, Text( notification.createdOn?.toServiceRequestCardFormat ?? "", @@ -55,7 +55,7 @@ class NotificationItem extends StatelessWidget { style: AppTextStyles.tinyFont.copyWith( color: context.isDark ? AppColor.neutral20 : AppColor.neutral50, ), - ).toShimmer(isShow: isLoading), + ).toShimmer(isShow: isLoading,context: context), ], ), Text( @@ -63,7 +63,7 @@ class NotificationItem extends StatelessWidget { style: AppTextStyles.bodyText2.copyWith( color: context.isDark ? AppColor.neutral10 : const Color(0xFF757575), ), - ).toShimmer(isShow: isLoading), + ).toShimmer(isShow: isLoading,context: context), ], ).onPress(() { onPressed(notification); diff --git a/lib/views/widgets/parts/auto_complete_parts_field.dart b/lib/views/widgets/parts/auto_complete_parts_field.dart index 649d2d38..566c0b8f 100644 --- a/lib/views/widgets/parts/auto_complete_parts_field.dart +++ b/lib/views/widgets/parts/auto_complete_parts_field.dart @@ -88,11 +88,11 @@ class _AutoCompletePartsFieldState extends State { constraints: const BoxConstraints(), suffixIconConstraints: const BoxConstraints(minWidth: 0), filled: true, - fillColor: (context.isDark ? AppColor.neutral50 : AppColor.neutral100), + fillColor: AppColor.fieldBgColor(context), errorStyle: AppTextStyle.tiny.copyWith(color: context.isDark ? AppColor.red50 : AppColor.red60), floatingLabelStyle: AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? null : AppColor.neutral20), labelText: widget.byName ? context.translation.partName : context.translation.partNumber, - labelStyle: AppTextStyles.tinyFont.copyWith(color: AppColor.neutral120), + labelStyle: AppTextStyles.tinyFont.copyWith(color: AppColor.textColor(context)), ), textInputAction: TextInputAction.search, onChanged: (text) { diff --git a/lib/views/widgets/pentry/calibration_tool_asset_picker.dart b/lib/views/widgets/pentry/calibration_tool_asset_picker.dart index bad35478..740c6f58 100644 --- a/lib/views/widgets/pentry/calibration_tool_asset_picker.dart +++ b/lib/views/widgets/pentry/calibration_tool_asset_picker.dart @@ -64,7 +64,7 @@ class _CalibrationToolAssetPickerState extends State PickAsset( showAssetInfo: false, forPPM: true, - cardColor: AppColor.neutral100, + cardColor: AppColor.fieldBgColor(context), device: widget.initialValue == null ? null : Asset( diff --git a/lib/views/widgets/timer/app_timer.dart b/lib/views/widgets/timer/app_timer.dart index 090f6913..93270c9e 100644 --- a/lib/views/widgets/timer/app_timer.dart +++ b/lib/views/widgets/timer/app_timer.dart @@ -162,7 +162,7 @@ class _AppTimerState extends State { ADatePicker( label: context.translation.startTime, hideShadow: true, - backgroundColor: AppColor.neutral100, + backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, date: _pickerStartAt, from: widget.pickerFromDate, enable: widget.enabled ? _tempPickerTimer == null : false, @@ -195,7 +195,7 @@ class _AppTimerState extends State { ADatePicker( label: context.translation.endTime, hideShadow: true, - backgroundColor: AppColor.neutral100, + backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, enable: widget.enabled ? _pickerStartAt != null : false, from: _pickerStartAt, date: _pickerEndAt, @@ -256,8 +256,9 @@ class _AppTimerState extends State { color: context.isDark && !widget.enabled ? AppColor.neutral60 : !widget.enabled + // backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, ? AppColor.neutral40 - : AppColor.background(context), + : AppColor.fieldBgColor(context), borderRadius: BorderRadius.circular(10), boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)], ), @@ -355,7 +356,7 @@ class _AppTimerState extends State { // ADatePicker( // label: context.translation.startTime, // hideShadow: true, -// backgroundColor: AppColor.neutral100, +// backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, // date: _pickerStartAt, // enable: _tempPickerTimer == null, // formatDateWithTime: true, @@ -375,7 +376,7 @@ class _AppTimerState extends State { // ADatePicker( // label: context.translation.endTime, // hideShadow: true, -// backgroundColor: AppColor.neutral100, +// backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, // enable: _pickerStartAt != null, // date: _pickerEndAt, // formatDateWithTime: true, From 4ce0504ab723ff9de11df78c42b3f910b0e35bb8 Mon Sep 17 00:00:00 2001 From: WaseemAbbasi22 Date: Sun, 10 Aug 2025 12:11:28 +0300 Subject: [PATCH 02/13] dark mode implementation --- lib/controllers/api_routes/urls.dart | 8 ++++---- .../cm_module/views/components/verify_arrival_view.dart | 4 ++-- .../views/forms/asset_retired/verify_asset_detail.dart | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/controllers/api_routes/urls.dart b/lib/controllers/api_routes/urls.dart index 5c68ebc8..cb7f9347 100644 --- a/lib/controllers/api_routes/urls.dart +++ b/lib/controllers/api_routes/urls.dart @@ -3,14 +3,14 @@ class URLs { static const String appReleaseBuildNumber = "21"; - // static const host1 = "https://atomsm.hmg.com"; // production url + static const host1 = "https://atomsm.hmg.com"; // production url // static const host1 = "https://atomsmdev.hmg.com"; // local DEV url - static const host1 = "https://atomsmuat.hmg.com"; // local UAT url + // static const host1 = "https://atomsmuat.hmg.com"; // local UAT url // static String _baseUrl = "$_host/mobile"; // static final String _baseUrl = "$_host/v2/mobile"; // new V2 apis - static final String _baseUrl = "$_host/mobile"; // host local UAT - // static final String _baseUrl = "$_host/v3/mobile"; // v3 for new CM,PM,TM + // static final String _baseUrl = "$_host/mobile"; // host local UAT + static final String _baseUrl = "$_host/v3/mobile"; // v3 for new CM,PM,TM static String _host = host1; diff --git a/lib/modules/cm_module/views/components/verify_arrival_view.dart b/lib/modules/cm_module/views/components/verify_arrival_view.dart index 73d171a2..aedb85d4 100644 --- a/lib/modules/cm_module/views/components/verify_arrival_view.dart +++ b/lib/modules/cm_module/views/components/verify_arrival_view.dart @@ -80,7 +80,7 @@ class _VerifyArrivalViewState extends State { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(14), // Circular border radius ), - color: Colors.white, + color: AppColor.background(context), child: Row( crossAxisAlignment: CrossAxisAlignment.center, // Align items at the top children: [ @@ -93,7 +93,7 @@ class _VerifyArrivalViewState extends State { children: [ Text( heading, - style: AppTextStyles.heading6.copyWith(color: AppColor.neutral50), + style: AppTextStyles.heading6.copyWith(color: AppColor.textColor(context)), ), 6.height, Text( diff --git a/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart b/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart index 6552fc11..197c85cd 100644 --- a/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart +++ b/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart @@ -330,7 +330,7 @@ class _VerifyAssetDetailsState extends State with TickerProv ], Container( padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 16.toScreenHeight), - color: AppColor.white10, + color: AppColor.background(context), child: AppFilledButton( label: context.translation.updateAssetDetails, buttonColor: AppColor.primary10, From 7ecccf8bf8afb3534b308710903e2bc6a981941f Mon Sep 17 00:00:00 2001 From: WaseemAbbasi22 Date: Sun, 10 Aug 2025 14:44:27 +0300 Subject: [PATCH 03/13] improvements --- lib/new_views/pages/login_page.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/new_views/pages/login_page.dart b/lib/new_views/pages/login_page.dart index d689ad41..304daf92 100644 --- a/lib/new_views/pages/login_page.dart +++ b/lib/new_views/pages/login_page.dart @@ -110,8 +110,8 @@ class _LoginPageState extends State { backgroundColor: AppColor.fieldBgColor(context), validator: (value) => Validator.hasValue(value!) ? null : context.translation.requiredField, labelText: context.translation.username, - style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 12, color: Color(0xff3B3D4A)), - labelStyle: const TextStyle(fontWeight: FontWeight.w500, fontSize: 11, color: Color(0xff767676)), + style: TextStyle(fontWeight: FontWeight.w500, fontSize: 12, color:context .isDark?Colors.white: const Color(0xff3B3D4A)), + labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 11, color:context .isDark?Colors.white:const Color(0xff767676)), textInputType: TextInputType.text, showWithoutDecoration: true, contentPadding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 12.toScreenHeight), @@ -125,8 +125,8 @@ class _LoginPageState extends State { showWithoutDecoration: true, labelText: context.translation.password, backgroundColor: AppColor.fieldBgColor(context), - style: TextStyle(fontWeight: FontWeight.w500, fontSize: 12, color: Color(0xff3B3D4A)), - labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 11, color: Color(0xff767676)), + style: TextStyle(fontWeight: FontWeight.w500, fontSize: 12, color: context .isDark?Colors.white: const Color(0xff3B3D4A)), + labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 11, color: context .isDark?Colors.white: const Color(0xff767676)), contentPadding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 12.toScreenHeight), obscureText: !_passwordVisible, suffixIcon: Icon( From 8d02ff5ec1a7a69a53fb143eb21f17aecbe725b0 Mon Sep 17 00:00:00 2001 From: WaseemAbbasi22 Date: Mon, 11 Aug 2025 09:20:25 +0300 Subject: [PATCH 04/13] mr number and exchange cost added --- lib/controllers/api_routes/urls.dart | 8 ++--- .../workorder/work_order_helper_models.dart | 6 ++-- .../new_models/work_order_detail_model.dart | 28 +++++++++-------- .../service_request_detail_view.dart | 10 ++++++- .../forms/cost/cost_detail_form_screen.dart | 30 +++++++++++++++++++ 5 files changed, 63 insertions(+), 19 deletions(-) diff --git a/lib/controllers/api_routes/urls.dart b/lib/controllers/api_routes/urls.dart index cb7f9347..69f699fb 100644 --- a/lib/controllers/api_routes/urls.dart +++ b/lib/controllers/api_routes/urls.dart @@ -3,14 +3,14 @@ class URLs { static const String appReleaseBuildNumber = "21"; - static const host1 = "https://atomsm.hmg.com"; // production url - // static const host1 = "https://atomsmdev.hmg.com"; // local DEV url + // static const host1 = "https://atomsm.hmg.com"; // production url + static const host1 = "https://atomsmdev.hmg.com"; // local DEV url // static const host1 = "https://atomsmuat.hmg.com"; // local UAT url // static String _baseUrl = "$_host/mobile"; - // static final String _baseUrl = "$_host/v2/mobile"; // new V2 apis + static final String _baseUrl = "$_host/v2/mobile"; // new V2 apis // static final String _baseUrl = "$_host/mobile"; // host local UAT - static final String _baseUrl = "$_host/v3/mobile"; // v3 for new CM,PM,TM + // static final String _baseUrl = "$_host/v3/mobile"; // v3 for new CM,PM,TM static String _host = host1; diff --git a/lib/models/helper_data_models/workorder/work_order_helper_models.dart b/lib/models/helper_data_models/workorder/work_order_helper_models.dart index cd302791..76bf3767 100644 --- a/lib/models/helper_data_models/workorder/work_order_helper_models.dart +++ b/lib/models/helper_data_models/workorder/work_order_helper_models.dart @@ -170,10 +170,12 @@ class WorkOrderCostModel { num? qAmount; String? prNo; String? poNo; + String? mrNo; + num? exchangeCost; - WorkOrderCostModel({this.workOrderId, this.sparePartCost, this.labourCost, this.travelCost, this.qAmount, this.poNo, this.prNo}); + WorkOrderCostModel({this.workOrderId, this.sparePartCost, this.labourCost, this.travelCost, this.qAmount, this.poNo, this.prNo,this.mrNo,this.exchangeCost}); Map toJson() { - return {'workOrderId': workOrderId, 'sparePartCost': sparePartCost, 'laborCost': labourCost, 'travelCost': travelCost, 'qAmount': qAmount, 'prNo': prNo, 'poNo': poNo}; + return {'workOrderId': workOrderId, 'sparePartCost': sparePartCost, 'laborCost': labourCost, 'travelCost': travelCost, 'qAmount': qAmount, 'prNo': prNo, 'poNo': poNo,'mrNo':mrNo,'exchangeCost':exchangeCost}; } } diff --git a/lib/models/new_models/work_order_detail_model.dart b/lib/models/new_models/work_order_detail_model.dart index 18041173..7f44edad 100644 --- a/lib/models/new_models/work_order_detail_model.dart +++ b/lib/models/new_models/work_order_detail_model.dart @@ -106,6 +106,8 @@ class WorkOrderData { this.qAmount, this.prNo, this.poNo, + this.mrNo, + this.exchangeCost, required this.workOrderHistory, required this.activities, required this.activityAssetToBeRetireds, @@ -171,6 +173,8 @@ class WorkOrderData { num? qAmount; String? prNo; String? poNo; + String? mrNo; + num? exchangeCost; List workOrderHistory; List activities; List activityAssetToBeRetireds; @@ -207,6 +211,8 @@ class WorkOrderData { qAmount: json['qAmount'], prNo: json['prNo'], poNo: json['poNo'], + mrNo: json['mrNo'], + exchangeCost: json['exchangeCost'], assetType: json["assetType"] == null ? null : Lookup.fromJson(json["assetType"]), assignedEmployee: json["assignedEmployee"] == null ? null : WorkOrderAssignedEmployee.fromJson(json["assignedEmployee"]), lastActivityStatus: json["lastActivityStatus"] != null ? Lookup.fromJson(json["lastActivityStatus"]) : null, @@ -278,6 +284,8 @@ class WorkOrderData { "comments": comments, "voiceNote": voiceNote, "edd": edd, + 'mrNo': mrNo, + 'exchangeCost': exchangeCost, "workOrderAttachments": workOrderAttachments.map((e) => e.toJson()).toList(), "returnToService": returnToService, "serviceType": serviceType?.toJson(), @@ -828,20 +836,19 @@ class ActivityMaintenanceAssistantEmployees { double? workingHours; String? technicalComment; AssignedEmployee? user; - AssistantEmployees ?employee; + AssistantEmployees? employee; - ActivityMaintenanceAssistantEmployees({this.startDate, this.endDate, this.workingHours, this.technicalComment, this.user,this.employee}); + ActivityMaintenanceAssistantEmployees({this.startDate, this.endDate, this.workingHours, this.technicalComment, this.user, this.employee}); ActivityMaintenanceAssistantEmployees.fromJson(Map json) { - Map assistEmpData={}; - + Map assistEmpData = {}; startDate = json['startDate'] != null ? DateTime.parse(json['startDate']) : null; endDate = json['endDate'] != null ? DateTime.parse(json['endDate']) : null; workingHours = json['workingHours']; technicalComment = json['technicalComment']; user = json['user'] != null ? AssignedEmployee.fromJson(json['user']) : null; - if(json['user']!=null) { + if (json['user'] != null) { assistEmpData = { 'id': null, 'user': { @@ -866,7 +873,6 @@ class ActivityMaintenanceAssistantEmployees { } } - // class ActivityMaintenanceAssistantEmployees { // DateTime? startDate; // DateTime? endDate; @@ -923,27 +929,25 @@ class ActivityMaintenanceTimers { } } - class AssistantEmployeesModel { DateTime? startDate; DateTime? endDate; double? workingHours; String? technicalComment; AssignedEmployee? user; - AssistantEmployees ?employee; + AssistantEmployees? employee; - AssistantEmployeesModel({this.startDate, this.endDate, this.workingHours, this.technicalComment, this.user,this.employee}); + AssistantEmployeesModel({this.startDate, this.endDate, this.workingHours, this.technicalComment, this.user, this.employee}); AssistantEmployeesModel.fromJson(Map json) { - Map assistEmpData={}; - + Map assistEmpData = {}; startDate = json['startDate'] != null ? DateTime.parse(json['startDate']) : null; endDate = json['endDate'] != null ? DateTime.parse(json['endDate']) : null; workingHours = json['workingHours']; technicalComment = json['technicalComment']; user = json['user'] != null ? AssignedEmployee.fromJson(json['user']) : null; - if(json['user']!=null) { + if (json['user'] != null) { assistEmpData = { 'id': null, 'user': { diff --git a/lib/modules/cm_module/views/components/service_request_detail_view.dart b/lib/modules/cm_module/views/components/service_request_detail_view.dart index 52ceea18..b366a1ce 100644 --- a/lib/modules/cm_module/views/components/service_request_detail_view.dart +++ b/lib/modules/cm_module/views/components/service_request_detail_view.dart @@ -336,7 +336,7 @@ class _ServiceRequestDetailViewState extends State { "Attachments".addTranslation, style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50), ), - FilesList(images: _attachments.map((toElement) => URLs.getFileUrl(toElement.name!)!).toList()), + FilesList(images: _attachments.map((toElement) => URLs.getFileUrl(toElement.name!)??'').toList()), ], if (!requestProvider.isReadOnlyRequest && workOrder.nextStep?.workOrderNextStepEnum == WorkOrderNextStepEnum.activity) ...[ 8.height, @@ -530,6 +530,14 @@ class _ServiceRequestDetailViewState extends State { 'PO No: ${provider.currentWorkOrder!.data?.poNo ?? '-'}', style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), ), + Text( + 'MR No: ${provider.currentWorkOrder!.data?.mrNo ?? '-'}', + style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), + ), + Text( + 'Exchange Cost: ${provider.currentWorkOrder!.data?.exchangeCost ?? '-'}', + style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), + ), ], ), ], diff --git a/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart b/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart index c8f99451..f4cbe4db 100644 --- a/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart +++ b/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart @@ -46,6 +46,8 @@ class _CostDetailFormScreenState extends State with Ticker qAmount: currentWorkOrderData.qAmount, prNo: currentWorkOrderData.prNo, poNo: currentWorkOrderData.poNo, + mrNo: currentWorkOrderData.mrNo, + exchangeCost: currentWorkOrderData.exchangeCost, ); } @@ -152,6 +154,34 @@ class _CostDetailFormScreenState extends State with Ticker }, style: Theme.of(context).textTheme.titleMedium, ), + 8.height, + AppTextFormField( + labelText: "MR No", + backgroundColor: AppColor.neutral100, + initialValue: requestDetailProvider.workOrderCostModel?.mrNo, + textAlign: TextAlign.center, + labelStyle: AppTextStyles.textFieldLabelStyle, + textInputType: TextInputType.text, + showShadow: false, + onChange: (value) { + requestDetailProvider.workOrderCostModel?.mrNo = value; + }, + style: Theme.of(context).textTheme.titleMedium, + ), + 8.height, + AppTextFormField( + labelText: "Exchange Cost", + backgroundColor: AppColor.neutral100, + initialValue: requestDetailProvider.workOrderCostModel?.exchangeCost!=null?requestDetailProvider.workOrderCostModel?.exchangeCost.toString():'', + textAlign: TextAlign.center, + labelStyle: AppTextStyles.textFieldLabelStyle, + textInputType: const TextInputType.numberWithOptions(decimal: true), + showShadow: false, + onChange: (value) { + requestDetailProvider.workOrderCostModel?.exchangeCost = num.parse(value); + }, + style: Theme.of(context).textTheme.titleMedium, + ), ], ).toShadowContainer(context).paddingAll(16), ).expanded, From 8d9aacb8701170be5cbbec44e7a788310c8da796 Mon Sep 17 00:00:00 2001 From: WaseemAbbasi22 Date: Mon, 11 Aug 2025 15:07:43 +0300 Subject: [PATCH 05/13] dark mode fixes --- .../action_button/footer_action_button.dart | 9 ++-- .../views/components/asset_detail_card.dart | 8 +-- .../service_request_detail_view.dart | 1 + .../forms/asset_retired/asset_retired.dart | 2 +- .../asset_retired/verify_asset_detail.dart | 18 +++---- .../forms/cost/cost_detail_form_screen.dart | 36 ++++++------- .../components/room_inspection_card.dart | 18 ++++--- .../components/room_tabs_widget.dart | 2 +- .../components/task_info_widget.dart | 15 +++--- .../recurrent_work_order_view.dart | 5 +- .../device_transfer_details.dart | 2 +- .../update_device_transfer.dart | 3 +- lib/views/pages/user/profile_page.dart | 2 +- .../update_user_contact_info_bottomsheet.dart | 8 +-- .../bottom_sheets/selection_bottom_sheet.dart | 47 ++++++++++------ .../selection_fullscreen_dialog.dart | 53 ++++++++++++------- 16 files changed, 132 insertions(+), 97 deletions(-) diff --git a/lib/modules/cm_module/views/components/action_button/footer_action_button.dart b/lib/modules/cm_module/views/components/action_button/footer_action_button.dart index 448ff6ba..7975fe55 100644 --- a/lib/modules/cm_module/views/components/action_button/footer_action_button.dart +++ b/lib/modules/cm_module/views/components/action_button/footer_action_button.dart @@ -94,8 +94,8 @@ class FooterActionButton { context: context, child: AppFilledButton( label: context.translation.activities, - buttonColor: AppColor.neutral50, - textColor: context.isDark ? AppColor.neutral30 : Colors.white, + buttonColor: context.isDark? AppColor.primary10:AppColor.neutral50, + textColor: context.isDark ? AppColor.black10 : Colors.white, onPressed: () async { Navigator.push(context, MaterialPageRoute(builder: (context) => const ActivitiesListView())); }, @@ -209,9 +209,8 @@ class FooterActionButton { children: [ AppFilledButton( label: context.translation.activities, - // maxWidth: true, - textColor: context.isDark ? AppColor.neutral30 : Colors.white, - buttonColor: AppColor.neutral50, + textColor: context.isDark ? AppColor.black10 : Colors.white, + buttonColor: context.isDark? AppColor.primary10:AppColor.neutral50, onPressed: () async { // ServiceRequestBottomSheet.activityTypeBottomSheet(context: context); Navigator.push(context, MaterialPageRoute(builder: (context) => const ActivitiesListView())); diff --git a/lib/modules/cm_module/views/components/asset_detail_card.dart b/lib/modules/cm_module/views/components/asset_detail_card.dart index ae9b888b..239bfd42 100644 --- a/lib/modules/cm_module/views/components/asset_detail_card.dart +++ b/lib/modules/cm_module/views/components/asset_detail_card.dart @@ -30,7 +30,7 @@ class AssetDetailCard extends StatelessWidget { textColor: AppColor.white10, backgroundColor: AppColor.getEquipmentStatusColor(context, requestDetailProvider.engineerUpdateWorkOrderHelperModel!.equipmentStatus!.id ?? 0), ), - if(requestDetailProvider.engineerUpdateWorkOrderHelperModel?.cmFrameId!=null)...[ + if (requestDetailProvider.engineerUpdateWorkOrderHelperModel?.cmFrameId != null) ...[ 6.width, StatusLabel( label: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.cmFrameId?.name, @@ -52,7 +52,7 @@ class AssetDetailCard extends StatelessWidget { ), //hide if status is closed or complete . if (!requestDetailProvider.isReadOnlyRequest) - "edit_icon".toSvgAsset(height: 21, width: 21).onPress(() async { + "edit_icon".toSvgAsset(height: 21, width: 21, color: context.isDark ? AppColor.primary10 : null).onPress(() async { requestDetailProvider.refreshTimer = false; await Navigator.push(context, MaterialPageRoute(builder: (context) => VerifyAssetDetails(isEdit: true))); requestDetailProvider.refreshTimer = true; @@ -98,7 +98,9 @@ class AssetDetailCard extends StatelessWidget { ), ] ], - ).toShadowContainer(context,); + ).toShadowContainer( + context, + ); }); } } diff --git a/lib/modules/cm_module/views/components/service_request_detail_view.dart b/lib/modules/cm_module/views/components/service_request_detail_view.dart index 38e619ab..42e2e03f 100644 --- a/lib/modules/cm_module/views/components/service_request_detail_view.dart +++ b/lib/modules/cm_module/views/components/service_request_detail_view.dart @@ -497,6 +497,7 @@ class _ServiceRequestDetailViewState extends State { ).expanded, if (!provider.isReadOnlyRequest) "edit_icon".toSvgAsset(height: 21, width: 21, + color: context.isDark?AppColor.primary10:null ).onPress(() async { provider.refreshTimer = false; await Navigator.push(context, MaterialPageRoute(builder: (context) => CostDetailFormScreen(isEdit: true))); diff --git a/lib/modules/cm_module/views/forms/asset_retired/asset_retired.dart b/lib/modules/cm_module/views/forms/asset_retired/asset_retired.dart index 4ede727b..5ecdc2f2 100644 --- a/lib/modules/cm_module/views/forms/asset_retired/asset_retired.dart +++ b/lib/modules/cm_module/views/forms/asset_retired/asset_retired.dart @@ -75,7 +75,7 @@ class _AssetRetiredState extends State with TickerProviderStateMix SingleItemDropDownMenu( context: context, title: context.translation.retirementType, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showAsBottomSheet: true, height: 56.toScreenHeight, showShadow: false, diff --git a/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart b/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart index 197c85cd..1fd163e2 100644 --- a/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart +++ b/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart @@ -131,7 +131,7 @@ class _VerifyAssetDetailsState extends State with TickerProv ADatePicker( label: context.translation.returnToService, hideShadow: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), // initialDate: DateTime.tryParse(requestDetailProvider.engineerUpdateWorkOrderHelperModel?.returnToService ?? ""), from: requestDetailProvider.currentWorkOrder?.data?.requestedDate, date: DateTime.tryParse(requestDetailProvider.engineerUpdateWorkOrderHelperModel?.returnToService ?? ""), @@ -167,7 +167,7 @@ class _VerifyAssetDetailsState extends State with TickerProv SingleItemDropDownMenu( context: context, title: "WO Frame", - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), height: 56.toScreenHeight, showShadow: false, initialValue: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.cmFrameId, @@ -181,7 +181,7 @@ class _VerifyAssetDetailsState extends State with TickerProv SingleItemDropDownMenu( context: context, title: context.translation.failureReason, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), height: 56.toScreenHeight, showShadow: false, initialValue: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.failureReason, @@ -195,7 +195,7 @@ class _VerifyAssetDetailsState extends State with TickerProv SingleItemDropDownMenu( context: context, title: context.translation.faultDescription, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), staticData: _faults, showShadow: false, initialValue: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.faultDescription, @@ -219,7 +219,7 @@ class _VerifyAssetDetailsState extends State with TickerProv SingleItemDropDownMenu( context: context, title: context.translation.loanAvailability, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), height: 56.toScreenHeight, showShadow: false, initialValue: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.loanAvailability, @@ -250,7 +250,7 @@ class _VerifyAssetDetailsState extends State with TickerProv ADatePicker( label: "EDD", hideShadow: true, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), // initialDate: DateTime.tryParse(requestDetailProvider.engineerUpdateWorkOrderHelperModel?.edd ?? ""), from: requestDetailProvider.currentWorkOrder?.data?.requestedDate, date: DateTime.tryParse(requestDetailProvider.engineerUpdateWorkOrderHelperModel?.edd ?? ""), @@ -284,10 +284,10 @@ class _VerifyAssetDetailsState extends State with TickerProv 12.height, AppTextFormField( labelText: context.translation.callResponse, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), initialValue: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.callResponse, textAlign: TextAlign.center, - labelStyle: AppTextStyles.textFieldLabelStyle, + labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)), showShadow: false, onChange: (value) { requestDetailProvider.engineerUpdateWorkOrderHelperModel?.callResponse = value; @@ -376,7 +376,7 @@ class _VerifyAssetDetailsState extends State with TickerProv crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - context.translation.assetStatus.bodyText(context).custom(color: AppColor.black20), + context.translation.assetStatus.bodyText(context).custom(color: AppColor.textColor(context)), 8.height, Wrap( runSpacing: 8, diff --git a/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart b/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart index 7bf990d5..4dd0fe54 100644 --- a/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart +++ b/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart @@ -86,11 +86,11 @@ class _CostDetailFormScreenState extends State with Ticker // ), // 8.height, AppTextFormField( - labelText: "Labor Cost", - backgroundColor: AppColor.neutral100, initialValue: requestDetailProvider.workOrderCostModel?.labourCost?.toString(), textAlign: TextAlign.center, - labelStyle: AppTextStyles.textFieldLabelStyle, + labelText: "Labor Cost", + backgroundColor: AppColor.fieldBgColor(context), + labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)), textInputType: const TextInputType.numberWithOptions(decimal: true), showShadow: false, onChange: (value) { @@ -101,10 +101,10 @@ class _CostDetailFormScreenState extends State with Ticker 8.height, AppTextFormField( labelText: "Travel Cost", - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), + labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)), initialValue: requestDetailProvider.workOrderCostModel?.travelCost?.toString(), textAlign: TextAlign.center, - labelStyle: AppTextStyles.textFieldLabelStyle, textInputType: const TextInputType.numberWithOptions(decimal: true), showShadow: false, onChange: (value) { @@ -115,10 +115,10 @@ class _CostDetailFormScreenState extends State with Ticker 8.height, AppTextFormField( labelText: "Quot Amount", - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), + labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)), initialValue: requestDetailProvider.workOrderCostModel?.qAmount?.toString(), textAlign: TextAlign.center, - labelStyle: AppTextStyles.textFieldLabelStyle, textInputType: const TextInputType.numberWithOptions(decimal: true), showShadow: false, onChange: (value) { @@ -129,10 +129,10 @@ class _CostDetailFormScreenState extends State with Ticker 8.height, AppTextFormField( labelText: "PR No", - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), + labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)), initialValue: requestDetailProvider.workOrderCostModel?.prNo, textAlign: TextAlign.center, - labelStyle: AppTextStyles.textFieldLabelStyle, textInputType: const TextInputType.numberWithOptions(decimal: true), showShadow: false, onChange: (value) { @@ -143,10 +143,10 @@ class _CostDetailFormScreenState extends State with Ticker 8.height, AppTextFormField( labelText: "PO No", - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), + labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)), initialValue: requestDetailProvider.workOrderCostModel?.poNo, textAlign: TextAlign.center, - labelStyle: AppTextStyles.textFieldLabelStyle, textInputType: const TextInputType.numberWithOptions(decimal: true), showShadow: false, onChange: (value) { @@ -157,10 +157,10 @@ class _CostDetailFormScreenState extends State with Ticker 8.height, AppTextFormField( labelText: "MR No", - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), + labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)), initialValue: requestDetailProvider.workOrderCostModel?.mrNo, textAlign: TextAlign.center, - labelStyle: AppTextStyles.textFieldLabelStyle, textInputType: TextInputType.text, showShadow: false, onChange: (value) { @@ -171,10 +171,10 @@ class _CostDetailFormScreenState extends State with Ticker 8.height, AppTextFormField( labelText: "Exchange Cost", - backgroundColor: AppColor.neutral100, - initialValue: requestDetailProvider.workOrderCostModel?.exchangeCost!=null?requestDetailProvider.workOrderCostModel?.exchangeCost.toString():'', + backgroundColor: AppColor.fieldBgColor(context), + labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)), + initialValue: requestDetailProvider.workOrderCostModel?.exchangeCost != null ? requestDetailProvider.workOrderCostModel?.exchangeCost.toString() : '', textAlign: TextAlign.center, - labelStyle: AppTextStyles.textFieldLabelStyle, textInputType: const TextInputType.numberWithOptions(decimal: true), showShadow: false, onChange: (value) { @@ -187,7 +187,7 @@ class _CostDetailFormScreenState extends State with Ticker ).expanded, Container( padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 16.toScreenHeight), - color: AppColor.white10, + color: AppColor.background(context), child: AppFilledButton( label: "Update Cost Details", buttonColor: AppColor.primary10, @@ -264,7 +264,7 @@ class _CostDetailFormScreenState extends State with Ticker ], ) ], - ).toShimmer(isShow: snapshot.loading,context: context), + ).toShimmer(isShow: snapshot.loading, context: context), ], ); }); diff --git a/lib/modules/pm_module/recurrent_wo/components/room_inspection_card.dart b/lib/modules/pm_module/recurrent_wo/components/room_inspection_card.dart index 295eff91..1bd12455 100644 --- a/lib/modules/pm_module/recurrent_wo/components/room_inspection_card.dart +++ b/lib/modules/pm_module/recurrent_wo/components/room_inspection_card.dart @@ -1,4 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:test_sa/controllers/providers/api/gas_refill_comments.dart'; +import 'package:test_sa/extensions/context_extension.dart'; import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart'; @@ -28,10 +30,10 @@ class _RoomInspectionCardState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - widget.inspectionModel!.tabName!.bodyText(context).custom(color: AppColor.neutral50, fontWeight: FontWeight.w600), + widget.inspectionModel!.tabName!.bodyText(context).custom(color:AppColor.textColor(context), fontWeight: FontWeight.w600), 8.height, Container( - color: Colors.white10, + color: context.isDark?null: Colors.white10, child: Column( children: widget.inspectionModel!.planRecurrentMedicalTaskRoomTabAttributes?.asMap().entries.map((entry) { final model = entry.value; @@ -66,7 +68,7 @@ class _RoomInspectionCardState extends State { model.attribute?.name ?? '', overflow: TextOverflow.ellipsis, maxLines: 1, - style: AppTextStyles.bodyText2.copyWith(color: AppColor.white936), + style: AppTextStyles.bodyText2.copyWith(color: context.isDark?Colors.white:AppColor.white936), ), (status ? 'Pass' : 'Fail').bodyText2(context).custom(color: AppColor.neutral120, fontWeight: FontWeight.w500), ], @@ -83,7 +85,7 @@ class _RoomInspectionCardState extends State { height: 30.toScreenHeight, padding: EdgeInsetsDirectional.all(4.toScreenHeight), decoration: BoxDecoration( - color: AppColor.white80, + color: AppColor.fieldBgColor(context), borderRadius: BorderRadius.circular(5), ), child: Row( @@ -94,14 +96,14 @@ class _RoomInspectionCardState extends State { isActive: status, activeColor: AppColor.green20, inactiveColor: Colors.transparent, - textColor: status ? AppColor.green50 : AppColor.black20, + textColor: status ? AppColor.green50 : context.isDark?Colors.white: AppColor.black20, ), buildToggleOption( label: "FAIL", isActive: !status, activeColor: AppColor.red20, inactiveColor: Colors.transparent, - textColor: status ? AppColor.black20 : AppColor.red30, + textColor: status ? context.isDark?Colors.white: AppColor.black20 : AppColor.red30, ), ], ), @@ -188,14 +190,14 @@ class _RoomInspectionCardState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ - model.attribute!.name!.bodyText2(context).custom(color: AppColor.white936, fontWeight: FontWeight.w500), + model.attribute!.name!.bodyText2(context).custom(color: context.isDark?Colors.white:AppColor.white936, fontWeight: FontWeight.w500), TextFormField( keyboardType: TextInputType.number, initialValue: model.attributeValue ?? '', decoration: InputDecoration( contentPadding: EdgeInsets.symmetric(horizontal: 5.toScreenWidth), filled: true, - fillColor: AppColor.neutral100, + fillColor: AppColor.fieldBgColor(context), constraints: BoxConstraints( maxWidth: 99.toScreenWidth, maxHeight: 30.toScreenHeight, diff --git a/lib/modules/pm_module/recurrent_wo/components/room_tabs_widget.dart b/lib/modules/pm_module/recurrent_wo/components/room_tabs_widget.dart index d74ed962..b3a71ad8 100644 --- a/lib/modules/pm_module/recurrent_wo/components/room_tabs_widget.dart +++ b/lib/modules/pm_module/recurrent_wo/components/room_tabs_widget.dart @@ -67,7 +67,7 @@ class _RoomTabsWidgetState extends State { color: selectedIndex == index ? (context.isDark ? AppColor.neutral60 : AppColor.neutral110) : Colors.transparent, borderRadius: BorderRadius.circular(7), ), - child: label.bodyText(context).custom(color: AppColor.white936), + child: label.bodyText(context).custom(color:context.isDark?Colors.white: AppColor.white936), ), ); }).toList(), diff --git a/lib/modules/pm_module/recurrent_wo/components/task_info_widget.dart b/lib/modules/pm_module/recurrent_wo/components/task_info_widget.dart index 0264d52f..1871dc61 100644 --- a/lib/modules/pm_module/recurrent_wo/components/task_info_widget.dart +++ b/lib/modules/pm_module/recurrent_wo/components/task_info_widget.dart @@ -35,7 +35,7 @@ class RecurrentTaskInfoWidget extends StatelessWidget { backgroundColor: AppColor.getRequestStatusColorByName(context, model?.status?.name), ), 8.height, - model!.title!.bodyText(context).custom(color: AppColor.black10), + model!.title!.bodyText(context).custom(color: AppColor.textColor(context)), 2.height, '${context.translation.taskNo}: ${model!.taskNo!}'.bodyText2(context).custom(color: AppColor.neutral120), '${context.translation.site}: ${model!.site!.siteName!}'.bodyText2(context).custom(color: AppColor.neutral120), @@ -79,7 +79,7 @@ class RecurrentTaskInfoWidget extends StatelessWidget { width: double.infinity, enabled: snapshot.recurrentWoData?.status?.value != 1, decoration: BoxDecoration( - color: AppColor.neutral100, + color: AppColor.fieldBgColor(context), borderRadius: BorderRadius.circular(10), ), pickerTimer: model?.recurrentWoTimePicker, @@ -103,7 +103,7 @@ class RecurrentTaskInfoWidget extends StatelessWidget { 8.width, Text( ServiceRequestUtils.formatTimerDuration(totalWorkingHours.round()), - style: AppTextStyles.bodyText.copyWith(color: AppColor.neutral50, fontWeight: FontWeight.w600), + style: AppTextStyles.bodyText.copyWith(color: AppColor.textColor(context), fontWeight: FontWeight.w600), ), ], ), @@ -117,9 +117,10 @@ class RecurrentTaskInfoWidget extends StatelessWidget { return AppTextFormField( initialValue: model?.comment, labelText: context.translation.comment, - backgroundColor: AppColor.neutral100, + backgroundColor: AppColor.fieldBgColor(context), showShadow: false, - labelStyle: AppTextStyles.textFieldLabelStyle, + hintStyle: TextStyle(color: context.isDark?AppColor.white10:AppColor.black10), + labelStyle: TextStyle(color: context.isDark?AppColor.white10:AppColor.black10), alignLabelWithHint: true, textInputType: TextInputType.multiline, onChange: (value) { @@ -145,8 +146,8 @@ Widget buildingInfoWidget({required String label, required String? value, requir 3.height, Text( value ?? '', - style: AppTextStyles.bodyText2.copyWith(color: AppColor.black10), + style: AppTextStyles.bodyText2.copyWith(color: AppColor.textColor(context)), ) ], - ).toShadowContainer(context, backgroundColor: AppColor.neutral100, borderRadius: 10, paddingObject: EdgeInsets.all(12.toScreenHeight), showShadow: false); + ).toShadowContainer(context, backgroundColor: AppColor.background(context), borderRadius: 10, paddingObject: EdgeInsets.all(12.toScreenHeight), showShadow: false); } diff --git a/lib/modules/pm_module/recurrent_wo/recurrent_work_order_view.dart b/lib/modules/pm_module/recurrent_wo/recurrent_work_order_view.dart index 45d485a0..327f6500 100644 --- a/lib/modules/pm_module/recurrent_wo/recurrent_work_order_view.dart +++ b/lib/modules/pm_module/recurrent_wo/recurrent_work_order_view.dart @@ -86,14 +86,15 @@ class _RecurrentWorkOrderViewState extends State { children: [ AppFilledButton( label: context.translation.save, - buttonColor: AppColor.white60, - textColor: AppColor.black10, + buttonColor: context.isDark?AppColor.neutral20: AppColor.white60, + textColor: context.isDark?Colors.white: AppColor.black10, onPressed: () => _updateTask(context: context, status: 0), ).expanded, 12.width, AppFilledButton( label: context.translation.complete, buttonColor: AppColor.primary10, + // textColor: context.isDark?Colors.white: AppColor.black10, onPressed: () => _updateTask(context: context, status: 1), ).expanded, ], diff --git a/lib/views/pages/device_transfer/device_transfer_details.dart b/lib/views/pages/device_transfer/device_transfer_details.dart index 20a9acb8..1f857949 100644 --- a/lib/views/pages/device_transfer/device_transfer_details.dart +++ b/lib/views/pages/device_transfer/device_transfer_details.dart @@ -273,7 +273,7 @@ class _DeviceTransferDetailsState extends State { // ? (!(_model?.senderMachineStatusName?.toLowerCase()?.contains("close") ?? false) && !(_model?.senderMachineStatusName?.toLowerCase()?.contains("complete") ?? false)) // : (!(_model?.receiverMachineStatusName?.toLowerCase()?.contains("close") ?? false) && !(_model?.receiverMachineStatusName?.toLowerCase()?.contains("complete") ?? false))) // - "edit".toSvgAsset(height: 48, width: 48).onPress(() async { + "edit".toSvgAsset(height: 48, width: 48).onPress(() async { bool isReload = (await Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateDeviceTransfer(model: _model!, isSender: isSender)))) as bool; if (isReload ?? false) { setState(() {}); diff --git a/lib/views/pages/device_transfer/update_device_transfer.dart b/lib/views/pages/device_transfer/update_device_transfer.dart index 7df1aa63..61a7041c 100644 --- a/lib/views/pages/device_transfer/update_device_transfer.dart +++ b/lib/views/pages/device_transfer/update_device_transfer.dart @@ -252,7 +252,8 @@ class _UpdateDeviceTransferState extends State { AppTextFormField( initialValue: widget.isSender ? _formModel.senderComment ?? "" : _formModel.receiverComment ?? "", labelText: context.translation.technicalComment, - labelStyle: AppTextStyles.tinyFont.copyWith(color: AppColor.neutral20), + hintStyle: AppTextStyles.tinyFont.copyWith(color: context.isDark?AppColor.white10:AppColor.black10), + labelStyle: AppTextStyles.tinyFont.copyWith(color: context.isDark?AppColor.white10:AppColor.black10), textInputType: TextInputType.multiline, backgroundColor: AppColor.fieldBgColor(context), showShadow: false, diff --git a/lib/views/pages/user/profile_page.dart b/lib/views/pages/user/profile_page.dart index 3ba6fa42..8c8fe93f 100644 --- a/lib/views/pages/user/profile_page.dart +++ b/lib/views/pages/user/profile_page.dart @@ -175,7 +175,7 @@ class _ProfilePageState extends State { 16.height, AppFilledButton( label: "Update Information", - buttonColor: AppColor.neutral50, + buttonColor: context.isDark? AppColor.primary10:AppColor.neutral50, onPressed: () { showModalBottomSheet( context: context, diff --git a/lib/views/pages/user/update_user_contact_info_bottomsheet.dart b/lib/views/pages/user/update_user_contact_info_bottomsheet.dart index 1f6eb1da..d04d55ba 100644 --- a/lib/views/pages/user/update_user_contact_info_bottomsheet.dart +++ b/lib/views/pages/user/update_user_contact_info_bottomsheet.dart @@ -56,7 +56,7 @@ class _UpdateUserContactInfoBottomSheetState extends State extends State> { Widget build(BuildContext context) { return Container( height: MediaQuery.of(context).size.height * .7, + color: Theme.of(context).scaffoldBackgroundColor, padding: const EdgeInsets.all(21), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -94,8 +95,9 @@ class _SelectionBottomSheetState extends State> { decoration: InputDecoration( hintText: 'Search by name', labelText: 'Search', + labelStyle: TextStyle(color: AppColor.textColor(context)), filled: true, - focusColor: AppColor.fieldBgColor(context), + fillColor: AppColor.fieldBgColor(context), hintStyle: const TextStyle(fontSize: 14), focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: AppColor.blueStatus(context), width: 2.0), @@ -114,22 +116,33 @@ class _SelectionBottomSheetState extends State> { child: ListView.builder( itemCount: filteredList?.length, padding: const EdgeInsets.only(top: 8), - itemBuilder: (cxt, index) => RadioListTile( - // Specify type for RadioListTile - value: filteredList![index], - dense: true, - contentPadding: EdgeInsets.zero, - groupValue: _selectedValue, - activeColor: Colors.black87, - - onChanged: (value) { - _selectedValue = value; - searchFocusNode.unfocus(); - setState(() {}); - }, - title: Text( - widget.builderString(filteredList![index]).cleanupWhitespace.capitalizeFirstOfEach ?? "", - style: Theme.of(context).textTheme.bodyLarge, + itemBuilder: (cxt, index) => Theme( + data: Theme.of(context).copyWith( + radioTheme: RadioThemeData( + fillColor: MaterialStateColor.resolveWith((states) { + if (states.contains(MaterialState.selected)) { + return AppColor.textColor(context); // Active color + } + return Colors.grey; // Inactive color + }), + ), + ), + child: RadioListTile( + // Specify type for RadioListTile + value: filteredList![index], + dense: true, + contentPadding: EdgeInsets.zero, + groupValue: _selectedValue, + activeColor: AppColor.textColor(context), + onChanged: (value) { + _selectedValue = value; + searchFocusNode.unfocus(); + setState(() {}); + }, + title: Text( + widget.builderString(filteredList![index]).cleanupWhitespace.capitalizeFirstOfEach ?? "", + style: Theme.of(context).textTheme.bodyLarge, + ), ), ), ), diff --git a/lib/views/widgets/fullscreen_dialogs/selection_fullscreen_dialog.dart b/lib/views/widgets/fullscreen_dialogs/selection_fullscreen_dialog.dart index 6a5f80c0..10a2b596 100644 --- a/lib/views/widgets/fullscreen_dialogs/selection_fullscreen_dialog.dart +++ b/lib/views/widgets/fullscreen_dialogs/selection_fullscreen_dialog.dart @@ -83,12 +83,15 @@ class _SelectionBottomSheetState extends State> SearchBar( focusNode: searchFocusNode, elevation: WidgetStateProperty.all(0), - leading: const Icon(Icons.search, color: AppColor.neutral50), + backgroundColor: WidgetStateProperty.all( + AppColor.fieldBgColor(context), // Your custom background color + ), + leading: Icon(Icons.search, color: AppColor.iconColor(context)), textStyle: WidgetStateProperty.all( - const TextStyle(color: AppColor.neutral50, fontSize: 16.0), + TextStyle(color: AppColor.textColor(context), fontSize: 16.0), ), hintStyle: WidgetStateProperty.all( - const TextStyle(color: AppColor.neutral20, fontSize: 14.0), + TextStyle(color: AppColor.textColor(context), fontSize: 14.0), ), hintText: 'Search by name', onChanged: (queryString) { @@ -123,22 +126,34 @@ class _SelectionBottomSheetState extends State> child: ListView.builder( itemCount: filteredList?.length, padding: EdgeInsets.zero, - itemBuilder: (cxt, index) => RadioListTile( - // Specify type for RadioListTile - value: filteredList![index], - dense: true, - contentPadding: const EdgeInsets.only(left: 16, right: 16), - groupValue: _selectedValue, - activeColor: Colors.black87, - hoverColor: Colors.transparent, - onChanged: (value) { - _selectedValue = value; - searchFocusNode.unfocus(); - setState(() {}); - }, - title: Text( - widget.builderString(filteredList![index]).cleanupWhitespace.capitalizeFirstOfEach ?? "", - style: Theme.of(context).textTheme.bodyLarge, + itemBuilder: (cxt, index) =>Theme( + data: Theme.of(context).copyWith( + radioTheme: RadioThemeData( + fillColor: MaterialStateColor.resolveWith((states) { + if (states.contains(MaterialState.selected)) { + return AppColor.iconColor(context); // Active color + } + return Colors.grey; // Inactive color + }), + ), + ), + child: RadioListTile( + // Specify type for RadioListTile + value: filteredList![index], + dense: true, + contentPadding: const EdgeInsets.only(left: 16, right: 16), + groupValue: _selectedValue, + activeColor: AppColor.iconColor(context), + hoverColor: Colors.transparent, + onChanged: (value) { + _selectedValue = value; + searchFocusNode.unfocus(); + setState(() {}); + }, + title: Text( + widget.builderString(filteredList![index]).cleanupWhitespace.capitalizeFirstOfEach ?? "", + style: Theme.of(context).textTheme.bodyLarge, + ), ), ), ), From dfe8f0c2715aa5c7ed3adf970c39dae1bd675e5e Mon Sep 17 00:00:00 2001 From: WaseemAbbasi22 Date: Mon, 11 Aug 2025 15:12:38 +0300 Subject: [PATCH 06/13] mr no and exchange cost added and tested in uat --- lib/controllers/api_routes/urls.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/controllers/api_routes/urls.dart b/lib/controllers/api_routes/urls.dart index 69f699fb..5c68ebc8 100644 --- a/lib/controllers/api_routes/urls.dart +++ b/lib/controllers/api_routes/urls.dart @@ -4,12 +4,12 @@ class URLs { static const String appReleaseBuildNumber = "21"; // static const host1 = "https://atomsm.hmg.com"; // production url - static const host1 = "https://atomsmdev.hmg.com"; // local DEV url - // static const host1 = "https://atomsmuat.hmg.com"; // local UAT url + // static const host1 = "https://atomsmdev.hmg.com"; // local DEV url + static const host1 = "https://atomsmuat.hmg.com"; // local UAT url // static String _baseUrl = "$_host/mobile"; - static final String _baseUrl = "$_host/v2/mobile"; // new V2 apis - // static final String _baseUrl = "$_host/mobile"; // host local UAT + // static final String _baseUrl = "$_host/v2/mobile"; // new V2 apis + static final String _baseUrl = "$_host/mobile"; // host local UAT // static final String _baseUrl = "$_host/v3/mobile"; // v3 for new CM,PM,TM static String _host = host1; From b4e8e82995da2d7154ab561392c5f1496265cb95 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Mon, 11 Aug 2025 15:17:51 +0300 Subject: [PATCH 07/13] mr no keyboard type fix. --- .../cm_module/views/forms/cost/cost_detail_form_screen.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart b/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart index f4cbe4db..e05bbfc4 100644 --- a/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart +++ b/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart @@ -161,7 +161,7 @@ class _CostDetailFormScreenState extends State with Ticker initialValue: requestDetailProvider.workOrderCostModel?.mrNo, textAlign: TextAlign.center, labelStyle: AppTextStyles.textFieldLabelStyle, - textInputType: TextInputType.text, + textInputType: const TextInputType.numberWithOptions(decimal: true), showShadow: false, onChange: (value) { requestDetailProvider.workOrderCostModel?.mrNo = value; @@ -172,7 +172,7 @@ class _CostDetailFormScreenState extends State with Ticker AppTextFormField( labelText: "Exchange Cost", backgroundColor: AppColor.neutral100, - initialValue: requestDetailProvider.workOrderCostModel?.exchangeCost!=null?requestDetailProvider.workOrderCostModel?.exchangeCost.toString():'', + initialValue: requestDetailProvider.workOrderCostModel?.exchangeCost != null ? requestDetailProvider.workOrderCostModel?.exchangeCost.toString() : '', textAlign: TextAlign.center, labelStyle: AppTextStyles.textFieldLabelStyle, textInputType: const TextInputType.numberWithOptions(decimal: true), From 4e665d19591c9336033f164493a1aa80479a4dd5 Mon Sep 17 00:00:00 2001 From: WaseemAbbasi22 Date: Thu, 14 Aug 2025 09:31:48 +0300 Subject: [PATCH 08/13] attachment fixes --- .../providers/api/ppm_provider.dart | 7 +- lib/models/generic_attachment_model.dart | 26 +++++++ .../workorder/work_order_helper_models.dart | 2 +- .../service_request_detail_provider.dart | 7 +- .../service_request_detail_view.dart | 23 ++++-- .../forms/asset_retired/asset_retired.dart | 13 ++-- .../components/attachments_view.dart | 78 ++++++++++--------- .../views/nurse/create_new_request_view.dart | 13 ++-- .../ppm_wo/update_ppm/update_ppm.dart | 4 +- .../ppm_wo/update_ppm/wo_info_form.dart | 7 +- .../tm_module/tasks_wo/create_task_view.dart | 18 +++-- .../tasks_wo/update_task_request_view.dart | 14 ++-- lib/new_views/app_style/app_color.dart | 2 + .../pages/gas_refill_request_form.dart | 20 ++--- .../create__device_transfer_request.dart | 13 ++-- .../update_device_transfer.dart | 66 +++++++--------- .../gas_refill/update_gas_refill_request.dart | 12 +-- .../requests/create_service_request_page.dart | 13 ++-- .../work_order/create_service_report.dart | 13 ++-- .../widgets/images/multi_image_picker.dart | 24 +++--- .../images/multi_image_picker_item.dart | 2 +- .../images/new_multi_image_picker.dart | 2 +- 22 files changed, 225 insertions(+), 154 deletions(-) create mode 100644 lib/models/generic_attachment_model.dart diff --git a/lib/controllers/providers/api/ppm_provider.dart b/lib/controllers/providers/api/ppm_provider.dart index 900f88bc..81a7e066 100644 --- a/lib/controllers/providers/api/ppm_provider.dart +++ b/lib/controllers/providers/api/ppm_provider.dart @@ -8,6 +8,7 @@ import 'package:http/http.dart'; import 'package:test_sa/controllers/api_routes/api_manager.dart'; import 'package:test_sa/controllers/api_routes/urls.dart'; import 'package:test_sa/extensions/context_extension.dart'; +import 'package:test_sa/models/generic_attachment_model.dart'; import 'package:test_sa/models/plan_preventive_visit/plan_preventive_visit_model.dart'; import 'package:test_sa/models/ppm/ppm.dart'; import 'package:test_sa/models/ppm/ppm_search.dart'; @@ -38,11 +39,11 @@ class PpmProvider extends ChangeNotifier { notifyListeners(); } - List _ppmPlanAttachments = []; + List _ppmPlanAttachments = []; - List get ppmPlanAttachments => _ppmPlanAttachments; + List get ppmPlanAttachments => _ppmPlanAttachments; - set ppmPlanAttachments(List value) { + set ppmPlanAttachments(List value) { _ppmPlanAttachments = value; notifyListeners(); } diff --git a/lib/models/generic_attachment_model.dart b/lib/models/generic_attachment_model.dart new file mode 100644 index 00000000..1d3cd5ea --- /dev/null +++ b/lib/models/generic_attachment_model.dart @@ -0,0 +1,26 @@ +import 'dart:io'; + +class GenericAttachmentModel { + GenericAttachmentModel({this.id, this.name,this.originalName,this.createdBy}); + + int? id; + String? name; + String ?createdBy; + String? originalName; + GenericAttachmentModel.fromJson(Map json) { + print('created by here is ${json['createdBy']}'); + id = json['id']; + name = json['name']; + createdBy = json['createdBy']; + originalName = json['originalName']; + } + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['name'] = name; + data['createdBy'] = createdBy; + data['originalName'] = originalName; + return data; + } +} \ No newline at end of file diff --git a/lib/models/helper_data_models/workorder/work_order_helper_models.dart b/lib/models/helper_data_models/workorder/work_order_helper_models.dart index 76bf3767..b15924d6 100644 --- a/lib/models/helper_data_models/workorder/work_order_helper_models.dart +++ b/lib/models/helper_data_models/workorder/work_order_helper_models.dart @@ -53,7 +53,7 @@ class WorkOrderHelperModel { } class WorkOrderAttachments { - WorkOrderAttachments({this.id, this.name}); + WorkOrderAttachments({this.id, this.name,this.createdBy}); int? id; String? name; diff --git a/lib/modules/cm_module/service_request_detail_provider.dart b/lib/modules/cm_module/service_request_detail_provider.dart index 743dad6a..5a40ccd8 100644 --- a/lib/modules/cm_module/service_request_detail_provider.dart +++ b/lib/modules/cm_module/service_request_detail_provider.dart @@ -7,6 +7,7 @@ import 'package:flutter/material.dart'; import 'package:http/src/response.dart'; import 'package:test_sa/controllers/api_routes/api_manager.dart'; import 'package:test_sa/controllers/api_routes/urls.dart'; +import 'package:test_sa/models/generic_attachment_model.dart'; import 'package:test_sa/models/helper_data_models/asset_retired/asset_retired_model.dart'; import 'package:test_sa/models/helper_data_models/maintenance_request/activity_maintenance_model.dart'; import 'package:test_sa/models/helper_data_models/spare_part/activity_spare_part_model.dart'; @@ -257,15 +258,15 @@ class ServiceRequestDetailProvider extends ChangeNotifier { } //upload workorder attachment by engineer.. - Future addWorkOrderAttachment({required int woId, required List attachments, required List otherAttachment}) async { + Future addWorkOrderAttachment({required int woId, required List attachments, required List otherAttachment}) async { try { List woAttachments = []; if (otherAttachment.isNotEmpty) { woAttachments.addAll(otherAttachment); } for (var file in attachments) { - String fileName = ServiceRequestUtils.isLocalUrl(file.path) ? ("${file.path.split("/").last}|${base64Encode(File(file.path).readAsBytesSync())}") : file.path; - woAttachments.add(WorkOrderAttachments(id: 0, name: fileName)); + String fileName = ServiceRequestUtils.isLocalUrl(file.name??'') ? ("${file.name??''.split("/").last}|${base64Encode(File(file.name??'').readAsBytesSync())}") :file.name??''; + woAttachments.add(WorkOrderAttachments(id: file.id, name: fileName,createdBy:file.createdBy)); } isLoading = true; diff --git a/lib/modules/cm_module/views/components/service_request_detail_view.dart b/lib/modules/cm_module/views/components/service_request_detail_view.dart index b366a1ce..52ee941e 100644 --- a/lib/modules/cm_module/views/components/service_request_detail_view.dart +++ b/lib/modules/cm_module/views/components/service_request_detail_view.dart @@ -12,6 +12,7 @@ import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart'; import 'package:test_sa/models/enums/user_types.dart'; import 'package:test_sa/models/enums/work_order_next_step.dart'; +import 'package:test_sa/models/generic_attachment_model.dart'; import 'package:test_sa/models/helper_data_models/workorder/work_order_helper_models.dart'; import 'package:test_sa/models/new_models/work_order_detail_model.dart'; import 'package:test_sa/modules/cm_module/service_request_detail_provider.dart'; @@ -37,7 +38,7 @@ class ServiceRequestDetailView extends StatefulWidget { } class _ServiceRequestDetailViewState extends State { - List _userAttachments = []; + List _userAttachments = []; List _attachments = []; @override @@ -47,10 +48,20 @@ class _ServiceRequestDetailViewState extends State { @override Widget build(BuildContext context) { + //GenericAttachmentModel( + // id: e.id, + // name: e.name, + // createdBy: e.createdBy, + // // originalName: , + // localFile: File(e.name ?? ''), + // + // ) UserProvider _userProvider = Provider.of(context, listen: false); return Consumer(builder: (pContext, requestProvider, _) { if (_userProvider.user?.type == UsersTypes.engineer) { - _userAttachments = requestProvider.currentWorkOrder?.data?.workOrderAttachments.where((e) => e.createdBy == _userProvider.user?.userID).map((e) => File(e.name ?? '')).toList() ?? []; + // _userAttachments = requestProvider.currentWorkOrder?.data?.workOrderAttachments.where((e) => e.createdBy == _userProvider.user?.userID).map((e) => File(e.name ?? '')).toList() ?? []; + _userAttachments = + requestProvider.currentWorkOrder?.data?.workOrderAttachments.where((e) => e.createdBy == _userProvider.user?.userID).map((e) => GenericAttachmentModel.fromJson(e.toJson())).toList() ?? []; _attachments = requestProvider.currentWorkOrder?.data?.workOrderAttachments.where((e) => e.createdBy != _userProvider.user?.userID).toList() ?? []; } else { //show only nurse attachments @@ -336,19 +347,19 @@ class _ServiceRequestDetailViewState extends State { "Attachments".addTranslation, style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50), ), - FilesList(images: _attachments.map((toElement) => URLs.getFileUrl(toElement.name!)??'').toList()), + FilesList(images: _attachments.map((toElement) => URLs.getFileUrl(toElement.name!) ?? '').toList()), ], if (!requestProvider.isReadOnlyRequest && workOrder.nextStep?.workOrderNextStepEnum == WorkOrderNextStepEnum.activity) ...[ 8.height, const Divider().defaultStyle(context), - MultiFilesPicker( + AttachmentPicker( label: context.translation.attachments, - files: _userAttachments, + attachment: _userAttachments, buttonColor: AppColor.primary10, onlyImages: false, buttonIcon: 'quotation_icon'.toSvgAsset(color: AppColor.primary10), onChange: (attachment) { - requestProvider.addWorkOrderAttachment(woId: workOrder.requestId!, attachments: _userAttachments, otherAttachment: _attachments); + requestProvider.addWorkOrderAttachment(woId: workOrder.requestId!, attachments: attachment, otherAttachment: _attachments); }, ), ], diff --git a/lib/modules/cm_module/views/forms/asset_retired/asset_retired.dart b/lib/modules/cm_module/views/forms/asset_retired/asset_retired.dart index 283ed269..0ef11bed 100644 --- a/lib/modules/cm_module/views/forms/asset_retired/asset_retired.dart +++ b/lib/modules/cm_module/views/forms/asset_retired/asset_retired.dart @@ -7,9 +7,11 @@ import 'package:test_sa/extensions/context_extension.dart'; import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart'; +import 'package:test_sa/models/generic_attachment_model.dart'; import 'package:test_sa/models/helper_data_models/asset_retired/asset_retired_model.dart'; import 'package:test_sa/models/lookup.dart'; import 'package:test_sa/modules/cm_module/service_request_detail_provider.dart'; +import 'package:test_sa/modules/cm_module/utilities/service_request_utils.dart'; import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart'; import 'package:test_sa/new_views/app_style/app_color.dart'; import 'package:test_sa/new_views/common_widgets/app_filled_button.dart'; @@ -52,7 +54,7 @@ class _AssetRetiredState extends State with TickerProviderStateMix @override Widget build(BuildContext context) { - final List _files = []; + final List attachments = []; return Scaffold( key: _scaffoldKey, @@ -103,9 +105,9 @@ class _AssetRetiredState extends State with TickerProviderStateMix }, ), 23.height, - MultiFilesPicker( + AttachmentPicker( label: context.translation.attachFiles, - files: _files, + attachment: attachments, buttonIcon: 'image-plus'.toSvgAsset(), ), ], @@ -119,9 +121,10 @@ class _AssetRetiredState extends State with TickerProviderStateMix loading: requestDetailProvider.isLoading, onPressed: () async { requestDetailProvider.assetRetiredHelperModel?.activityAssetToBeRetiredAttachments = []; - for (var file in _files) { + for (var attachment in attachments) { + String fileName = ServiceRequestUtils.isLocalUrl(attachment.name??'') ? ("${attachment.name??''.split("/").last}|${base64Encode(File(attachment.name??'').readAsBytesSync())}") :attachment.name??''; requestDetailProvider.assetRetiredHelperModel?.activityAssetToBeRetiredAttachments - ?.add(ActivityAssetToBeRetiredAttachments(id: 0, name: "${file.path.split("/").last}|${base64Encode(file.readAsBytesSync())}")); + ?.add(ActivityAssetToBeRetiredAttachments(id: attachment.id, name: fileName)); } int status = await requestDetailProvider.createActivityAssetToBeRetired(); if (status == 200) { diff --git a/lib/modules/cm_module/views/forms/work_order/components/attachments_view.dart b/lib/modules/cm_module/views/forms/work_order/components/attachments_view.dart index 297a0fd3..253c2d31 100644 --- a/lib/modules/cm_module/views/forms/work_order/components/attachments_view.dart +++ b/lib/modules/cm_module/views/forms/work_order/components/attachments_view.dart @@ -1,39 +1,41 @@ -import 'dart:io'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:test_sa/controllers/providers/api/service_requests_provider.dart'; -import 'package:test_sa/extensions/context_extension.dart'; -import 'package:test_sa/extensions/int_extensions.dart'; -import 'package:test_sa/extensions/text_extensions.dart'; -import 'package:test_sa/views/widgets/images/multi_image_picker.dart'; +// import 'dart:io'; +// import 'package:flutter/material.dart'; +// import 'package:provider/provider.dart'; +// import 'package:test_sa/controllers/providers/api/service_requests_provider.dart'; +// import 'package:test_sa/extensions/context_extension.dart'; +// import 'package:test_sa/extensions/int_extensions.dart'; +// import 'package:test_sa/extensions/text_extensions.dart'; -class AttachmentView extends StatelessWidget { - const AttachmentView({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - //TODO user the same form key everywhere.... - final GlobalKey _formKey = GlobalKey(); - final List _files = []; - return Consumer(builder: (context, serviceRequestProvider, child) { - serviceRequestProvider.currentSelectedRequest?.visitDate = ''; - return Form( - key: _formKey, - child: SingleChildScrollView( - child: Column( - children: [ - MultiFilesPicker( - label: context.translation.attachImage, - buttonHeight: 108.toScreenHeight, - buttonIcon: 'image_icon'?.toSvgAsset(), - files: _files, - onlyImages: true, - ), - 16.height, - ], - ), - ), - ); - }); - } -} +//TODO need to delete.. +// import 'package:test_sa/views/widgets/images/multi_image_picker.dart'; +// +// class AttachmentView extends StatelessWidget { +// const AttachmentView({Key? key}) : super(key: key); +// +// @override +// Widget build(BuildContext context) { +// //TODO user the same form key everywhere.... +// final GlobalKey _formKey = GlobalKey(); +// final List _files = []; +// return Consumer(builder: (context, serviceRequestProvider, child) { +// serviceRequestProvider.currentSelectedRequest?.visitDate = ''; +// return Form( +// key: _formKey, +// child: SingleChildScrollView( +// child: Column( +// children: [ +// MultiFilesPicker( +// label: context.translation.attachImage, +// buttonHeight: 108.toScreenHeight, +// buttonIcon: 'image_icon'?.toSvgAsset(), +// files: _files, +// onlyImages: true, +// ), +// 16.height, +// ], +// ), +// ), +// ); +// }); +// } +// } diff --git a/lib/modules/cm_module/views/nurse/create_new_request_view.dart b/lib/modules/cm_module/views/nurse/create_new_request_view.dart index 6c276072..4f18a203 100644 --- a/lib/modules/cm_module/views/nurse/create_new_request_view.dart +++ b/lib/modules/cm_module/views/nurse/create_new_request_view.dart @@ -13,11 +13,13 @@ import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart'; import 'package:test_sa/models/enums/user_types.dart'; +import 'package:test_sa/models/generic_attachment_model.dart'; import 'package:test_sa/models/helper_data_models/workorder/work_order_helper_models.dart'; import 'package:test_sa/models/lookup.dart'; import 'package:test_sa/models/service_request/pending_service_request_model.dart'; import 'package:test_sa/models/service_request/service_request.dart'; import 'package:test_sa/modules/cm_module/service_request_detail_provider.dart'; +import 'package:test_sa/modules/cm_module/utilities/service_request_utils.dart'; import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart'; import 'package:test_sa/new_views/app_style/app_color.dart'; import 'package:test_sa/new_views/common_widgets/app_filled_button.dart'; @@ -52,7 +54,7 @@ class _CreateNewRequestState extends State with TickerProvider late ServiceRequestsProvider _serviceRequestsProvider; late ServiceRequestDetailProvider _requestDetailProvider; late ServiceRequest _serviceRequest; - final List _deviceImages = []; + final List _deviceImages = []; final bool _isLoading = false; final GlobalKey _formKey = GlobalKey(); final GlobalKey _scaffoldKey = GlobalKey(); @@ -72,7 +74,7 @@ class _CreateNewRequestState extends State with TickerProvider getInitialData(); if (_serviceRequestsProvider.currentSelectedRequest != null) { _serviceRequest = _serviceRequestsProvider.currentSelectedRequest!; - _deviceImages.addAll(_serviceRequest.devicePhotos!.map((e) => File(e)).toList()); + _deviceImages.addAll(_serviceRequest.devicePhotos!.map((e) => GenericAttachmentModel(name: e)).toList()); _showDatePicker = _serviceRequest.firstAction != null && _serviceRequest.firstAction?.name == "Need a visit"; if (_showDatePicker && _serviceRequest.visitDate != null) { _dateTime = DateTime.tryParse(_serviceRequest.visitDate!); @@ -154,9 +156,9 @@ class _CreateNewRequestState extends State with TickerProvider 16.height, assetStatusWidget(context), 24.height, - MultiFilesPicker( + AttachmentPicker( label: context.translation.attachImage, - files: _deviceImages, + attachment: _deviceImages, buttonColor: AppColor.black10, onlyImages: false, buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120), @@ -351,7 +353,8 @@ class _CreateNewRequestState extends State with TickerProvider } List attachement = []; for (var item in _deviceImages) { - attachement.add(WorkOrderAttachments(id: 0, name: "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}")); + String fileName = ServiceRequestUtils.isLocalUrl(item.name??'') ? ("${item.name??''.split("/").last}|${base64Encode(File(item.name??'').readAsBytesSync())}") :item.name??''; + attachement.add(WorkOrderAttachments(id: 0, name: fileName)); } _requestDetailProvider.workOrderHelperModel = WorkOrderHelperModel( assetId: _serviceRequest.device?.id, diff --git a/lib/modules/pm_module/ppm_wo/update_ppm/update_ppm.dart b/lib/modules/pm_module/ppm_wo/update_ppm/update_ppm.dart index 16899bb9..08156206 100644 --- a/lib/modules/pm_module/ppm_wo/update_ppm/update_ppm.dart +++ b/lib/modules/pm_module/ppm_wo/update_ppm/update_ppm.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:io'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -46,8 +47,9 @@ class _UpdatePpmState extends State with TickerProviderStateMixin { showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading()); ppmProvider.planPreventiveVisit?.preventiveVisitAttachments = []; for (var item in ppmProvider.ppmPlanAttachments) { + String fileName = ServiceRequestUtils.isLocalUrl(item.name??'') ? ("${item.name??''.split("/").last}|${base64Encode(File(item.name??'').readAsBytesSync())}") :item.name??''; ppmProvider.planPreventiveVisit?.preventiveVisitAttachments - ?.add(PreventiveVisitAttachments(id: 0, attachmentName: ServiceRequestUtils.isLocalUrl(item.path) ? "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}" : item.path)); + ?.add(PreventiveVisitAttachments(id: item.id, attachmentName: fileName)); } ppmProvider.planPreventiveVisit?.preventiveVisitTimers = ppmProvider.planPreventiveVisit?.preventiveVisitTimers ?? []; diff --git a/lib/modules/pm_module/ppm_wo/update_ppm/wo_info_form.dart b/lib/modules/pm_module/ppm_wo/update_ppm/wo_info_form.dart index 0e12c5dc..a010f25c 100644 --- a/lib/modules/pm_module/ppm_wo/update_ppm/wo_info_form.dart +++ b/lib/modules/pm_module/ppm_wo/update_ppm/wo_info_form.dart @@ -12,6 +12,7 @@ import 'package:test_sa/helper/utils.dart'; import 'package:test_sa/models/device/asset.dart'; import 'package:test_sa/models/device/model_definition.dart'; import 'package:test_sa/models/device/supplier.dart'; +import 'package:test_sa/models/generic_attachment_model.dart'; import 'package:test_sa/models/lookup.dart'; import 'package:test_sa/models/new_models/building.dart'; import 'package:test_sa/models/new_models/department.dart'; @@ -51,7 +52,7 @@ class _WoInfoFormState extends State { PpmProvider ppmProvider = Provider.of(context, listen: false); if (widget.planPreventiveVisit.preventiveVisitAttachments != null && widget.planPreventiveVisit.preventiveVisitAttachments!.isNotEmpty) { ppmProvider.ppmPlanAttachments = []; - ppmProvider.ppmPlanAttachments.addAll(widget.planPreventiveVisit.preventiveVisitAttachments!.map((e) => File(e.attachmentName!)).toList()); + ppmProvider.ppmPlanAttachments.addAll(widget.planPreventiveVisit.preventiveVisitAttachments!.map((e) => GenericAttachmentModel(id:e.id,name:e.attachmentName!)).toList()); } }); @@ -291,9 +292,9 @@ class _WoInfoFormState extends State { }, ), 16.height, - MultiFilesPicker( + AttachmentPicker( label: context.translation.attachments, - files: ppmProvider.ppmPlanAttachments, + attachment: ppmProvider.ppmPlanAttachments, buttonColor: AppColor.black10, onlyImages: false, buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120), diff --git a/lib/modules/tm_module/tasks_wo/create_task_view.dart b/lib/modules/tm_module/tasks_wo/create_task_view.dart index 95b9d17a..6b60eea0 100644 --- a/lib/modules/tm_module/tasks_wo/create_task_view.dart +++ b/lib/modules/tm_module/tasks_wo/create_task_view.dart @@ -10,12 +10,14 @@ import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart'; import 'package:test_sa/models/device/asset.dart'; import 'package:test_sa/models/enums/user_types.dart'; +import 'package:test_sa/models/generic_attachment_model.dart'; import 'package:test_sa/models/lookup.dart'; import 'package:test_sa/models/new_models/mapped_sites.dart'; import 'package:test_sa/models/new_models/room_model.dart'; import 'package:test_sa/models/new_models/task_request/task_request_model.dart'; import 'package:test_sa/models/new_models/task_request/task_type_model.dart'; import 'package:test_sa/models/service_request/pending_service_request_model.dart'; +import 'package:test_sa/modules/cm_module/utilities/service_request_utils.dart'; import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart'; import 'package:test_sa/new_views/app_style/app_color.dart'; import 'package:test_sa/new_views/common_widgets/app_filled_button.dart'; @@ -41,7 +43,7 @@ class CreateTaskView extends StatefulWidget { } class _CreateTaskViewState extends State with TickerProviderStateMixin { - final List _deviceImages = []; + final List attachments = []; final GlobalKey _formKey = GlobalKey(); final GlobalKey _scaffoldKey = GlobalKey(); List _deviceList = []; @@ -111,12 +113,17 @@ class _CreateTaskViewState extends State with TickerProviderStat }, ), 23.height, - MultiFilesPicker( + AttachmentPicker( label: context.translation.attachImage, - files: _deviceImages, + attachment: attachments, buttonColor: AppColor.black10, onlyImages: false, buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120), + //verify this if not required delete this .. + onChange: (attachments) { + attachments = attachments; + setState(() {}); + }, ), ], ).toShadowContainer(context).paddingAll(16), @@ -444,8 +451,9 @@ class _CreateTaskViewState extends State with TickerProviderStat _addTaskModel!.assetIds?.add(int.parse(device!.id.toString())); } } - for (var item in _deviceImages) { - _addTaskModel?.attachments?.add(TaskJobAttachment(id: 0, name: "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}")); + for (var item in attachments) { + String fileName = ServiceRequestUtils.isLocalUrl(item.name ?? '') ? ("${item.name ?? ''.split("/").last}|${base64Encode(File(item.name ?? '').readAsBytesSync())}") : item.name ?? ''; + _addTaskModel?.attachments?.add(TaskJobAttachment(id: item.id, name: fileName)); } TaskRequestProvider taskRequestProvider = Provider.of(context, listen: false); await taskRequestProvider.addTask(context: context, task: _addTaskModel!); diff --git a/lib/modules/tm_module/tasks_wo/update_task_request_view.dart b/lib/modules/tm_module/tasks_wo/update_task_request_view.dart index 4bae9bd5..08070b76 100644 --- a/lib/modules/tm_module/tasks_wo/update_task_request_view.dart +++ b/lib/modules/tm_module/tasks_wo/update_task_request_view.dart @@ -10,6 +10,7 @@ import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/string_extensions.dart'; import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart'; +import 'package:test_sa/models/generic_attachment_model.dart'; import 'package:test_sa/models/lookup.dart'; import 'package:test_sa/models/new_models/building.dart'; import 'package:test_sa/models/new_models/department.dart'; @@ -52,7 +53,7 @@ class _UpdateTaskRequestState extends State { final TextEditingController _requestedQuantityController = TextEditingController(); final GlobalKey _formKey = GlobalKey(); final GlobalKey _scaffoldKey = GlobalKey(); - List _files = []; + List attachments = []; bool installationType = true; String comments = ''; @@ -70,7 +71,7 @@ class _UpdateTaskRequestState extends State { TaskData? taskModel = _taskProvider!.taskRequestModel; _taskProvider?.updateTaskModel(taskModel); if (taskModel != null) { - _files.addAll(taskModel.taskJobAttachments!.map((e) => File(e.name ?? '')).toList()); + attachments.addAll(taskModel.taskJobAttachments!.map((e) => GenericAttachmentModel(id:e.id,name:e.name ?? '')).toList()); // if (taskModel.taskType?.isInstallation == true) { // await _taskProvider!.getSiteData(siteId: taskModel.asset?.siteId); // } @@ -135,9 +136,9 @@ class _UpdateTaskRequestState extends State { onSaved: (value) {}, ), 20.height, - MultiFilesPicker( + AttachmentPicker( label: context.translation.attachFiles, - files: _files, + attachment: attachments, buttonColor: AppColor.black10, onlyImages: false, buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120), @@ -188,8 +189,9 @@ class _UpdateTaskRequestState extends State { if (validate(model: taskModel)) { showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading()); List attachment = []; - for (var item in _files) { - attachment.add(TaskJobAttachment(id: 0, name: ServiceRequestUtils.isLocalUrl(item.path) ? "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}" : item.path)); + for (var item in attachments) { + String fileName = ServiceRequestUtils.isLocalUrl(item.name??'') ? ("${item.name??''.split("/").last}|${base64Encode(File(item.name??'').readAsBytesSync())}") :item.name??''; + attachment.add(TaskJobAttachment(id: item.id, name: fileName)); } taskModel?.taskJobAttachments = attachment; if (taskModel?.taskTimePicker != null) { diff --git a/lib/new_views/app_style/app_color.dart b/lib/new_views/app_style/app_color.dart index 847b6b59..47b65712 100644 --- a/lib/new_views/app_style/app_color.dart +++ b/lib/new_views/app_style/app_color.dart @@ -180,6 +180,8 @@ static Color getActivityTypeTextColor(String type) { return red30; case "canceled": return red30; + case "returned": + return red30; default: return Colors.white; } diff --git a/lib/new_views/pages/gas_refill_request_form.dart b/lib/new_views/pages/gas_refill_request_form.dart index 64314fe4..b73bc1c5 100644 --- a/lib/new_views/pages/gas_refill_request_form.dart +++ b/lib/new_views/pages/gas_refill_request_form.dart @@ -11,6 +11,7 @@ import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart'; import 'package:test_sa/models/enums/user_types.dart'; +import 'package:test_sa/models/generic_attachment_model.dart'; import 'package:test_sa/models/lookup.dart'; import 'package:test_sa/models/new_models/gas_refill_model.dart'; import 'package:test_sa/models/new_models/mapped_sites.dart'; @@ -43,7 +44,7 @@ class _GasRefillRequestFormState extends State { Lookup? _requestedQuantity; final TextEditingController _commentController = TextEditingController(); GasRefillProvider? _gasRefillProvider; - List _files = []; + List attachments = []; static List gasQuantity = [ Lookup(name: "1", id: 1, value: 1), @@ -213,9 +214,9 @@ class _GasRefillRequestFormState extends State { onSaved: (value) {}, ), 8.height, - MultiFilesPicker( + AttachmentPicker( label: context.translation.attachFiles, - files: _files, + attachment: attachments, buttonColor: AppColor.black10, onlyImages: false, buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120), @@ -235,9 +236,10 @@ class _GasRefillRequestFormState extends State { _gasModel.gasRefillDetails = []; _gasModel.gasRefillDetails?.add(_currentDetails); _gasModel.gasRefillAttachments = []; - for (var item in _files) { + for (var item in attachments) { + String fileName = ServiceRequestUtils.isLocalUrl(item.name??'') ? ("${item.name??''.split("/").last}|${base64Encode(File(item.name??'').readAsBytesSync())}") :item.name??''; _gasModel.gasRefillAttachments?.add(GasRefillAttachments( - id: 0, gasRefillId: _gasModel.id ?? 0, attachmentName: ServiceRequestUtils.isLocalUrl(item.path) ? "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}" : item.path)); + id: item.id, gasRefillId: _gasModel.id ?? 0, attachmentName: fileName)); } await _gasRefillProvider?.addGasRefillRequest( context: context, @@ -380,7 +382,7 @@ class _GasRefillRequestFormState extends State { // Lookup? _requestedQuantity; // final TextEditingController _commentController = TextEditingController(); // GasRefillProvider? _gasRefillProvider; -// List _files = []; +// List attachments = []; // // static List gasQuantity = [ // Lookup(name: "1", id: 1, value: 1), @@ -397,7 +399,7 @@ class _GasRefillRequestFormState extends State { // _currentDetails = widget.gasRefillDetails ?? GasRefillDetails(); // _gasModel = widget.gasModel ?? GasRefillModel(gasRefillDetails: []); // if (_gasModel.gasRefillAttachments != null && _gasModel.gasRefillAttachments!.isNotEmpty) { -// _files.addAll(_gasModel.gasRefillAttachments!.map((e) => File(e.attachmentName!)).toList()); +// attachments.addAll(_gasModel.gasRefillAttachments!.map((e) => File(e.attachmentName!)).toList()); // } // if (widget.gasRefillDetails != null && widget.gasRefillDetails?.requestedQty != null) { // _requestedQuantity = Lookup(name: "1", id: 1, value: int.parse(widget.gasRefillDetails!.requestedQty!.toStringAsFixed(0))); @@ -561,7 +563,7 @@ class _GasRefillRequestFormState extends State { // 8.height, // MultiFilesPicker( // label: context.translation.attachFiles, -// files: _files, +// files: attachments, // buttonColor: AppColor.black10, // onlyImages: false, // buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120), @@ -582,7 +584,7 @@ class _GasRefillRequestFormState extends State { // _gasModel.gasRefillDetails = []; // _gasModel.gasRefillDetails?.add(_currentDetails); // _gasModel.gasRefillAttachments = []; -// for (var item in _files) { +// for (var item in attachments) { // _gasModel.gasRefillAttachments?.add(GasRefillAttachments( // id: 0, gasRefillId: _gasModel.id ?? 0, attachmentName: ServiceRequestUtils.isLocalUrl(item.path) ? "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}" : item.path)); // } diff --git a/lib/views/pages/device_transfer/create__device_transfer_request.dart b/lib/views/pages/device_transfer/create__device_transfer_request.dart index 1e6a727f..493077ce 100644 --- a/lib/views/pages/device_transfer/create__device_transfer_request.dart +++ b/lib/views/pages/device_transfer/create__device_transfer_request.dart @@ -14,9 +14,11 @@ import 'package:test_sa/models/device/asset.dart'; import 'package:test_sa/models/device/asset_transfer_attachment.dart'; import 'package:test_sa/models/device/device_transfer.dart'; import 'package:test_sa/models/enums/user_types.dart'; +import 'package:test_sa/models/generic_attachment_model.dart'; import 'package:test_sa/models/new_models/department.dart'; import 'package:test_sa/models/new_models/floor.dart'; import 'package:test_sa/models/service_request/pending_service_request_model.dart'; +import 'package:test_sa/modules/cm_module/utilities/service_request_utils.dart'; import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart'; import 'package:test_sa/new_views/app_style/app_color.dart'; import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart'; @@ -49,7 +51,7 @@ class _CreateDeviceTransferRequestState extends State _scaffoldKey = GlobalKey(); Asset _assetDestination = Asset(); Asset? _pickedAsset; - final List _deviceImages = []; + final List attachments = []; bool isInternal = true; PendingAssetServiceRequest? pendingAssetServiceRequest; @@ -77,8 +79,9 @@ class _CreateDeviceTransferRequestState extends State attachement = []; - for (var item in _deviceImages) { - attachement.add(AssetTransferAttachment(id: 0, attachmentName: "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}")); + for (var item in attachments) { + String fileName = ServiceRequestUtils.isLocalUrl(item.name??'') ? ("${item.name??''.split("/").last}|${base64Encode(File(item.name??'').readAsBytesSync())}") :item.name??''; + attachement.add(AssetTransferAttachment(id: item.id, attachmentName: fileName)); } _transferModel.attachments = attachement; @@ -236,9 +239,9 @@ class _CreateDeviceTransferRequestState extends State { final GlobalKey _formKey = GlobalKey(); final GlobalKey _scaffoldKey = GlobalKey(); - List _files = []; + List attachments = []; _update({required int status}) async { _formKey.currentState!.save(); @@ -110,13 +111,9 @@ class _UpdateDeviceTransferState extends State { _formModel.assetTransferEngineerTimers = _formModel.receiverVisitTimers; } try { - for (var file in _files) { - String attachmentName = file.path; - if (attachmentName.contains("/")) { - attachmentName = file.path.split("/").last; - attachmentName = "$attachmentName|${base64Encode(file.readAsBytesSync())}"; - } - _formModel.assetTransferAttachments!.add(AssetTransferAttachment(id: 0, attachmentName: attachmentName)); + for (var item in attachments) { + String fileName = ServiceRequestUtils.isLocalUrl(item.name ?? '') ? ("${item.name ?? ''.split("/").last}|${base64Encode(File(item.name ?? '').readAsBytesSync())}") : item.name ?? ''; + _formModel.assetTransferAttachments!.add(AssetTransferAttachment(id: item.id, attachmentName: fileName)); _formModel.attachments = _formModel.assetTransferAttachments; } } catch (error) { @@ -202,7 +199,7 @@ class _UpdateDeviceTransferState extends State { @override void initState() { _formModel.fromDetails(widget.model); - _files = widget.model.assetTransferAttachments?.map((e) => File(e.attachmentName!)).toList() ?? []; + attachments = widget.model.assetTransferAttachments?.map((e) => GenericAttachmentModel(id: e.id?.toInt()??0, name: e.attachmentName!)).toList() ?? []; super.initState(); } @@ -262,9 +259,9 @@ class _UpdateDeviceTransferState extends State { }, ), 8.height, - MultiFilesPicker( + AttachmentPicker( label: context.translation.attachFiles, - files: _files, + attachment: attachments, buttonColor: AppColor.black10, onlyImages: false, buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120), @@ -275,9 +272,9 @@ class _UpdateDeviceTransferState extends State { 16.height, DeviceTransferAssistantEmployeeList( assetId: _formModel.assetId, - createdDate: _formModel.createdDate??'', - assistantEmployeeList: widget.isSender?_formModel.assetTransferAssistantEmployeesSender:_formModel.assetTransferAssistantEmployeesReceiver, - cardPadding: 0, + createdDate: _formModel.createdDate ?? '', + assistantEmployeeList: widget.isSender ? _formModel.assetTransferAssistantEmployeesSender : _formModel.assetTransferAssistantEmployeesReceiver, + cardPadding: 0, onListChanged: (updatedList) { setState(() { _formModel.assistantEmployList = updatedList; @@ -381,16 +378,12 @@ class _UpdateDeviceTransferState extends State { } } - - - - class DeviceTransferAssistantEmployeeList extends StatefulWidget { final List? assistantEmployeeList; final ValueChanged>? onListChanged; - final double ?cardPadding; - final dynamic assetId; - final String createdDate; + final double? cardPadding; + final dynamic assetId; + final String createdDate; const DeviceTransferAssistantEmployeeList({ super.key, @@ -444,7 +437,7 @@ class _DeviceTransferAssistantEmployeeListState extends State { bool _firstTime = true; Lookup? _deliveredQuantity; - List _attachments = []; + List _attachments = []; static List deliveredQuantity = [ Lookup(name: "1", id: 1, value: 1), @@ -82,7 +83,7 @@ class _UpdateGasRefillRequestState extends State { } catch (ex) {} } if (_formModel.gasRefillAttachments != null && _formModel.gasRefillAttachments!.isNotEmpty) { - _attachments.addAll(_formModel.gasRefillAttachments!.map((e) => File(e.attachmentName!)).toList()); + _attachments.addAll(_formModel.gasRefillAttachments!.map((e) => GenericAttachmentModel(id:e.id,name:e.attachmentName!)).toList()); } } @@ -153,8 +154,9 @@ class _UpdateGasRefillRequestState extends State { }); _formModel.gasRefillAttachments = []; for (var item in _attachments) { + String fileName = ServiceRequestUtils.isLocalUrl(item.name??'') ? ("${item.name??''.split("/").last}|${base64Encode(File(item.name??'').readAsBytesSync())}") :item.name??''; _formModel.gasRefillAttachments?.add(GasRefillAttachments( - id: 0, gasRefillId: _formModel.id ?? 0, attachmentName: ServiceRequestUtils.isLocalUrl(item.path) ? "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}" : item.path)); + id: item.id, gasRefillId: _formModel.id ?? 0, attachmentName: fileName)); } await _gasRefillProvider?.updateGasRefill(status: status, model: _formModel).then((success) { @@ -258,9 +260,9 @@ class _UpdateGasRefillRequestState extends State { onSaved: (value) {}, ), 16.height, - MultiFilesPicker( + AttachmentPicker( label: context.translation.attachFiles, - files: _attachments, + attachment: _attachments, buttonColor: AppColor.black10, onlyImages: false, buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120), diff --git a/lib/views/pages/user/requests/create_service_request_page.dart b/lib/views/pages/user/requests/create_service_request_page.dart index 791c5b57..3362b874 100644 --- a/lib/views/pages/user/requests/create_service_request_page.dart +++ b/lib/views/pages/user/requests/create_service_request_page.dart @@ -10,8 +10,10 @@ import 'package:test_sa/controllers/providers/settings/setting_provider.dart'; import 'package:test_sa/extensions/context_extension.dart'; import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart'; +import 'package:test_sa/models/generic_attachment_model.dart'; import 'package:test_sa/models/service_request/pending_service_request_model.dart'; import 'package:test_sa/models/service_request/service_request.dart'; +import 'package:test_sa/modules/cm_module/utilities/service_request_utils.dart'; import 'package:test_sa/new_views/common_widgets/app_filled_button.dart'; import 'package:test_sa/providers/service_request_providers/equipment_status_provider.dart'; import 'package:test_sa/providers/service_request_providers/requested_through_provider.dart'; @@ -45,7 +47,7 @@ class CreateServiceRequestPageState extends State { late SettingProvider _settingProvider; late ServiceRequestsProvider _serviceRequestsProvider; late ServiceRequest _serviceRequest; - final List _deviceImages = []; + final List attachments = []; final bool _isLoading = false; bool _showDatePicker = false; final GlobalKey _formKey = GlobalKey(); @@ -59,7 +61,7 @@ class CreateServiceRequestPageState extends State { _commentController = TextEditingController(); if (widget.serviceRequest != null) { _serviceRequest = widget.serviceRequest!; - _deviceImages.addAll(_serviceRequest.devicePhotos!.map((e) => File(e)).toList()); + attachments.addAll(_serviceRequest.devicePhotos!.map((e) => GenericAttachmentModel(name: e)).toList()); _showDatePicker = _serviceRequest.firstAction != null && _serviceRequest.firstAction?.name == "Need a visit"; if (_showDatePicker && _serviceRequest.visitDate != null) { _dateTime = DateTime.tryParse(_serviceRequest.visitDate!); @@ -77,7 +79,7 @@ class CreateServiceRequestPageState extends State { // ServiceRequest request = await _serviceRequestsProvider.getServiceRequestObjectById(requestId: id) ?? ""; // _serviceRequest = request; // _device = _serviceRequest.device; - // _deviceImages.addAll(_serviceRequest.devicePhotos.map((e) { + // attachments.addAll(_serviceRequest.devicePhotos.map((e) { // return File(e); // }).toList()); // _showDatePicker = _serviceRequest.firstAction != null && _serviceRequest.firstAction.name == "Need a visit"; @@ -244,7 +246,7 @@ class CreateServiceRequestPageState extends State { ); }), 16.height, - MultiFilesPicker(label: context.translation.attachImage, files: _deviceImages, showAsGrid: true), + AttachmentPicker(label: context.translation.attachImage, attachment: attachments, showAsGrid: true), ], ).toShadowContainer(context), @@ -386,7 +388,8 @@ class CreateServiceRequestPageState extends State { // return; // } - _serviceRequest.devicePhotos = _deviceImages.map((e) => _isLocalUrl(e.path) ? "${e.path.split("/").last}|${base64Encode(e.readAsBytesSync())}" : e.path).toList(); + + _serviceRequest.devicePhotos = attachments.map((item) => ServiceRequestUtils.isLocalUrl(item.name??'') ? "${item.name?.split("/").last}|${base64Encode(File(item.name??'').readAsBytesSync())}" : item.name??'').toList(); if (_serviceRequest.audio != null) { if (_isLocalUrl(_serviceRequest.audio!)) { final File file = File(_serviceRequest.audio!); diff --git a/lib/views/pages/user/requests/work_order/create_service_report.dart b/lib/views/pages/user/requests/work_order/create_service_report.dart index 2c7e7fc9..f1ec7b49 100644 --- a/lib/views/pages/user/requests/work_order/create_service_report.dart +++ b/lib/views/pages/user/requests/work_order/create_service_report.dart @@ -14,8 +14,10 @@ import 'package:test_sa/extensions/string_extensions.dart'; import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart'; import 'package:test_sa/models/device/asset.dart'; +import 'package:test_sa/models/generic_attachment_model.dart'; import 'package:test_sa/models/service_request/service_report.dart'; import 'package:test_sa/models/service_request/service_request.dart'; +import 'package:test_sa/modules/cm_module/utilities/service_request_utils.dart'; import 'package:test_sa/new_views/common_widgets/app_filled_button.dart'; import 'package:test_sa/providers/service_request_providers/equipment_status_provider.dart'; import 'package:test_sa/providers/service_request_providers/loan_availability_provider.dart'; @@ -61,7 +63,7 @@ class _CreateServiceReportState extends State with TickerPr bool _isLoading = false; List _spareParts = []; - final List _files = []; + final List attachments = []; final GlobalKey _formKey = GlobalKey(); final GlobalKey _scaffoldKey = GlobalKey(); final TextEditingController _faultController = TextEditingController(); @@ -363,7 +365,7 @@ class _CreateServiceReportState extends State with TickerPr }, ), 8.height, - MultiFilesPicker(label: context.translation.attachImage, files: _files), + AttachmentPicker(label: context.translation.attachImage, attachment: attachments), 8.height, ESignature( title: context.translation.engSign, @@ -407,9 +409,10 @@ class _CreateServiceReportState extends State with TickerPr } _formKey.currentState!.save(); _serviceReport.attachmentsWorkOrder ??= []; - if (_files.isEmpty) _serviceReport.attachmentsWorkOrder = []; - for (var file in _files) { - _serviceReport.attachmentsWorkOrder!.add(Attachment(id: 0, name: "${file.path.split("/").last}|${base64Encode(file.readAsBytesSync())}")); + if (attachments.isEmpty) _serviceReport.attachmentsWorkOrder = []; + for (var item in attachments) { + String fileName = ServiceRequestUtils.isLocalUrl(item.name??'') ? ("${item.name??''.split("/").last}|${base64Encode(File(item.name??'').readAsBytesSync())}") :item.name??''; + _serviceReport.attachmentsWorkOrder!.add(Attachment(id: item.id, name: fileName)); } final user = Provider.of(context, listen: false).user!; await _serviceRequestsProvider.createServiceReport(context, report: _serviceReport, request: widget.request, user: user); diff --git a/lib/views/widgets/images/multi_image_picker.dart b/lib/views/widgets/images/multi_image_picker.dart index aa1c97b6..470471a1 100644 --- a/lib/views/widgets/images/multi_image_picker.dart +++ b/lib/views/widgets/images/multi_image_picker.dart @@ -8,6 +8,7 @@ import 'package:test_sa/extensions/context_extension.dart'; import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart'; +import 'package:test_sa/models/generic_attachment_model.dart'; import 'package:test_sa/new_views/app_style/app_color.dart'; import '../../../new_views/common_widgets/app_dashed_button.dart'; @@ -17,7 +18,7 @@ class MultiFilesPicker extends StatefulWidget { final String label; final bool error; final List files; - final List attachment; + final List attachment; final bool enabled, onlyImages; double? buttonHeight; @@ -29,7 +30,7 @@ class MultiFilesPicker extends StatefulWidget { MultiFilesPicker( {Key? key, this.files = const [], - this.attachment = const [], + this.attachment = const [], required this.label, this.error = false, this.buttonHeight, @@ -311,18 +312,18 @@ class AttachmentModel { class AttachmentPicker extends StatefulWidget { final String label; final bool error; - final List attachment; + final List attachment; final bool enabled, onlyImages; double? buttonHeight; Widget? buttonIcon; Color? buttonColor; - final Function(List)? onChange; + final Function(List)? onChange; final bool showAsGrid; AttachmentPicker( {Key? key, - this.attachment = const [], + this.attachment = const [], required this.label, this.error = false, this.buttonHeight, @@ -361,7 +362,7 @@ class _AttachmentPickerState extends State { children: List.generate( widget.attachment.length, (index) { - File image = widget.attachment[index].file!; + File image = File(widget.attachment[index].name!); return MultiFilesPickerItem( file: image, enabled: widget.enabled, @@ -369,7 +370,7 @@ class _AttachmentPickerState extends State { if (!widget.enabled) { return; } - widget.attachment.remove(image); + widget.attachment.removeAt(index); if (widget.onChange != null) { widget.onChange!(widget.attachment); } @@ -391,7 +392,10 @@ class _AttachmentPickerState extends State { ); if (result != null) { for (var path in result.paths) { - widget.attachment.add(AttachmentModel(0, File(path!))); + widget.attachment.add(GenericAttachmentModel(id: 0,name: File(path!).path)); + } + if (widget.onChange != null) { + widget.onChange!(widget.attachment); } setState(() {}); } @@ -440,7 +444,7 @@ class _AttachmentPickerState extends State { if (pickedFile != null) { File fileImage = File(pickedFile.path); - widget.attachment.add(AttachmentModel(0, fileImage)); + widget.attachment.add(GenericAttachmentModel(id: 0,name: fileImage.path)); if (widget.onChange != null) { widget.onChange!(widget.attachment); } @@ -562,7 +566,7 @@ class _AttachmentPickerState extends State { if (pickedFile != null) { File fileImage = File(pickedFile.path); - widget.attachment.add(AttachmentModel(0, fileImage)); + widget.attachment.add(GenericAttachmentModel(id: 0, name: fileImage.path)); if (widget.onChange != null) { widget.onChange!(widget.attachment); } diff --git a/lib/views/widgets/images/multi_image_picker_item.dart b/lib/views/widgets/images/multi_image_picker_item.dart index ee2d0753..896fe571 100644 --- a/lib/views/widgets/images/multi_image_picker_item.dart +++ b/lib/views/widgets/images/multi_image_picker_item.dart @@ -67,7 +67,7 @@ class MultiFilesPickerItem extends StatelessWidget { } else if (_isLocalUrl(file.path)) { OpenFile.open(file.path); } else { - if (!await launchUrl(Uri.parse(file.path), mode: LaunchMode.externalApplication)) { + if (!await launchUrl(Uri.parse(URLs.getFileUrl(file.path)!), mode: LaunchMode.externalApplication)) { Fluttertoast.showToast(msg: "UnExpected Error with file."); throw Exception('Could not launch'); } diff --git a/lib/views/widgets/images/new_multi_image_picker.dart b/lib/views/widgets/images/new_multi_image_picker.dart index 10487230..fba3c3f6 100644 --- a/lib/views/widgets/images/new_multi_image_picker.dart +++ b/lib/views/widgets/images/new_multi_image_picker.dart @@ -72,7 +72,7 @@ class _MultiFilesPickerState extends State { children: List.generate( widget.files!.length, (index) { - File image = widget.files![index].file; + File image = widget.files[index].file; return MultiFilesPickerItem( file: image, enabled: widget.enabled, From 4fe2943a5fa095567fadb3813628c0d315991d84 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 14 Aug 2025 12:42:06 +0300 Subject: [PATCH 09/13] update asset details improvement. --- .../service_request_detail_provider.dart | 8 +- .../asset_retired/verify_asset_detail.dart | 89 +++++++++---------- 2 files changed, 48 insertions(+), 49 deletions(-) diff --git a/lib/modules/cm_module/service_request_detail_provider.dart b/lib/modules/cm_module/service_request_detail_provider.dart index 5a40ccd8..7f597320 100644 --- a/lib/modules/cm_module/service_request_detail_provider.dart +++ b/lib/modules/cm_module/service_request_detail_provider.dart @@ -265,8 +265,8 @@ class ServiceRequestDetailProvider extends ChangeNotifier { woAttachments.addAll(otherAttachment); } for (var file in attachments) { - String fileName = ServiceRequestUtils.isLocalUrl(file.name??'') ? ("${file.name??''.split("/").last}|${base64Encode(File(file.name??'').readAsBytesSync())}") :file.name??''; - woAttachments.add(WorkOrderAttachments(id: file.id, name: fileName,createdBy:file.createdBy)); + String fileName = ServiceRequestUtils.isLocalUrl(file.name ?? '') ? ("${file.name ?? ''.split("/").last}|${base64Encode(File(file.name ?? '').readAsBytesSync())}") : file.name ?? ''; + woAttachments.add(WorkOrderAttachments(id: file.id, name: fileName, createdBy: file.createdBy)); } isLoading = true; @@ -612,11 +612,11 @@ class ServiceRequestDetailProvider extends ChangeNotifier { } //engineerUpdateWorkOrder...... - Future engineerUpdateWorkOrder() async { + Future engineerUpdateWorkOrder(EngineerUpdateWorkOrderHelperModel updateAssetModel) async { isLoading = true; Response response; try { - response = await ApiManager.instance.post(URLs.engineerUpdateWorkOrderUrl, body: engineerUpdateWorkOrderHelperModel!.toJson()); + response = await ApiManager.instance.post(URLs.engineerUpdateWorkOrderUrl, body: updateAssetModel.toJson()); stateCode = response.statusCode; isLoading = false; notifyListeners(); diff --git a/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart b/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart index 142c2f19..68abaf60 100644 --- a/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart +++ b/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart @@ -61,11 +61,14 @@ class _VerifyAssetDetailsState extends State with TickerProv }); } + EngineerUpdateWorkOrderHelperModel? updateAssetModel; + late WorkOrderData currentWorkOrderData; + void assignValues() { // ServiceRequestDetailProvider requestDetailProvider = Provider.of(context, listen: false); // _requestDetailProvider = Provider.of(context, listen: false); - WorkOrderData currentWorkOrderData = _requestDetailProvider!.currentWorkOrder!.data!; - _requestDetailProvider!.engineerUpdateWorkOrderHelperModel = EngineerUpdateWorkOrderHelperModel( + currentWorkOrderData = _requestDetailProvider!.currentWorkOrder!.data!; + updateAssetModel = EngineerUpdateWorkOrderHelperModel( workOrderId: currentWorkOrderData.requestId, equipmentStatus: currentWorkOrderData.equipmentStatus, loanAvailability: currentWorkOrderData.loanAvailablity, @@ -91,7 +94,7 @@ class _VerifyAssetDetailsState extends State with TickerProv ); setState(() {}); } - getFaultDescription(assetId: _requestDetailProvider!.currentWorkOrder?.data?.asset?.id); + getFaultDescription(assetId: currentWorkOrderData.asset?.id); } @override @@ -126,15 +129,15 @@ class _VerifyAssetDetailsState extends State with TickerProv crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - assetStatusWidget(context: context, workOrderData: requestDetailProvider.engineerUpdateWorkOrderHelperModel!), + assetStatusWidget(context: context, workOrderData: updateAssetModel!), 12.height, ADatePicker( label: context.translation.returnToService, hideShadow: true, backgroundColor: AppColor.neutral100, - // initialDate: DateTime.tryParse(requestDetailProvider.engineerUpdateWorkOrderHelperModel?.returnToService ?? ""), + // initialDate: DateTime.tryParse(updateAssetModel?.returnToService ?? ""), from: requestDetailProvider.currentWorkOrder?.data?.requestedDate, - date: DateTime.tryParse(requestDetailProvider.engineerUpdateWorkOrderHelperModel?.returnToService ?? ""), + date: DateTime.tryParse(updateAssetModel?.returnToService ?? ""), formatDateWithTime: true, onDatePicker: (selectedDate) { showTimePicker( @@ -150,19 +153,18 @@ class _VerifyAssetDetailsState extends State with TickerProv selectedTime.hour, selectedTime.minute, ); - // if (requestDetailProvider.engineerUpdateWorkOrderHelperModel?.returnToService != null && - // selectedDateTime.isBefore(DateTime.parse(requestDetailProvider.engineerUpdateWorkOrderHelperModel!.returnToService!))) { + // if (updateAssetModel?.returnToService != null && + // selectedDateTime.isBefore(DateTime.parse(updateAssetModel!.returnToService!))) { // "Return To Service Date time must be greater then previous date".showToast; // return; // } setState(() { - requestDetailProvider.engineerUpdateWorkOrderHelperModel?.returnToService = selectedDateTime.toIso8601String(); + updateAssetModel?.returnToService = selectedDateTime.toIso8601String(); }); } }); }, ), - 12.height, SingleItemDropDownMenu( context: context, @@ -170,10 +172,10 @@ class _VerifyAssetDetailsState extends State with TickerProv backgroundColor: AppColor.neutral100, height: 56.toScreenHeight, showShadow: false, - initialValue: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.cmFrameId, + initialValue: updateAssetModel?.cmFrameId, onSelect: (value) { if (value != null) { - requestDetailProvider.engineerUpdateWorkOrderHelperModel?.cmFrameId = value; + updateAssetModel?.cmFrameId = value; } }, ), @@ -184,10 +186,10 @@ class _VerifyAssetDetailsState extends State with TickerProv backgroundColor: AppColor.neutral100, height: 56.toScreenHeight, showShadow: false, - initialValue: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.failureReason, + initialValue: updateAssetModel?.failureReason, onSelect: (value) { if (value != null) { - requestDetailProvider.engineerUpdateWorkOrderHelperModel?.failureReason = value; + updateAssetModel?.failureReason = value; } }, ), @@ -198,22 +200,20 @@ class _VerifyAssetDetailsState extends State with TickerProv backgroundColor: AppColor.neutral100, staticData: _faults, showShadow: false, - initialValue: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.faultDescription, + initialValue: updateAssetModel?.faultDescription, onSelect: (fault) { if (fault != null) { - requestDetailProvider.engineerUpdateWorkOrderHelperModel?.faultDescription = fault; - requestDetailProvider.engineerUpdateWorkOrderHelperModel?.solution = fault.workPerformed; + updateAssetModel?.faultDescription = fault; + updateAssetModel?.solution = fault.workPerformed; setState(() {}); } }, ), - if (requestDetailProvider.engineerUpdateWorkOrderHelperModel?.solution != null) ...[ + if (updateAssetModel?.solution != null) ...[ 12.height, context.translation.solutions.heading6(context).custom(color: AppColor.neutral50), 8.height, - requestDetailProvider.engineerUpdateWorkOrderHelperModel?.solution != null - ? requestDetailProvider.engineerUpdateWorkOrderHelperModel!.solution!.bodyText2(context).custom(color: AppColor.neutral120, align: TextAlign.justify) - : const SizedBox(), + updateAssetModel?.solution != null ? updateAssetModel!.solution!.bodyText2(context).custom(color: AppColor.neutral120, align: TextAlign.justify) : const SizedBox(), ], 12.height, SingleItemDropDownMenu( @@ -222,25 +222,25 @@ class _VerifyAssetDetailsState extends State with TickerProv backgroundColor: AppColor.neutral100, height: 56.toScreenHeight, showShadow: false, - initialValue: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.loanAvailability, + initialValue: updateAssetModel?.loanAvailability, onSelect: (status) { if (status != null) { - requestDetailProvider.engineerUpdateWorkOrderHelperModel?.loanAvailability = status; + updateAssetModel?.loanAvailability = status; if (status.value != 1) { loanAvailabilityAsset = null; - requestDetailProvider.engineerUpdateWorkOrderHelperModel?.loanAssetId = null; + updateAssetModel?.loanAssetId = null; } setState(() {}); } }, ), - if (requestDetailProvider.engineerUpdateWorkOrderHelperModel?.loanAvailability?.value == 1) 8.height, - if (requestDetailProvider.engineerUpdateWorkOrderHelperModel?.loanAvailability?.value == 1) + if (updateAssetModel?.loanAvailability?.value == 1) 8.height, + if (updateAssetModel?.loanAvailability?.value == 1) PickAsset( device: loanAvailabilityAsset, // ?? _serviceReport.device, cardColor: AppColor.neutral100, onPickAsset: (asset) { - requestDetailProvider.engineerUpdateWorkOrderHelperModel?.loanAssetId = asset.id; + updateAssetModel?.loanAssetId = asset.id; setState(() { loanAvailabilityAsset = asset; }); @@ -251,9 +251,9 @@ class _VerifyAssetDetailsState extends State with TickerProv label: "EDD", hideShadow: true, backgroundColor: AppColor.neutral100, - // initialDate: DateTime.tryParse(requestDetailProvider.engineerUpdateWorkOrderHelperModel?.edd ?? ""), + // initialDate: DateTime.tryParse(updateAssetModel?.edd ?? ""), from: requestDetailProvider.currentWorkOrder?.data?.requestedDate, - date: DateTime.tryParse(requestDetailProvider.engineerUpdateWorkOrderHelperModel?.edd ?? ""), + date: DateTime.tryParse(updateAssetModel?.edd ?? ""), formatDateWithTime: true, onDatePicker: (selectedDate) { showTimePicker( @@ -269,13 +269,13 @@ class _VerifyAssetDetailsState extends State with TickerProv selectedTime.hour, selectedTime.minute, ); - // if (requestDetailProvider.engineerUpdateWorkOrderHelperModel?.edd != null && - // selectedDateTime.isBefore(DateTime.parse(requestDetailProvider.engineerUpdateWorkOrderHelperModel!.edd!))) { + // if (updateAssetModel?.edd != null && + // selectedDateTime.isBefore(DateTime.parse(updateAssetModel!.edd!))) { // "Return To Service Date time must be greater then previous date".showToast; // return; // } setState(() { - requestDetailProvider.engineerUpdateWorkOrderHelperModel?.edd = selectedDateTime.toIso8601String(); + updateAssetModel?.edd = selectedDateTime.toIso8601String(); }); } }); @@ -285,12 +285,12 @@ class _VerifyAssetDetailsState extends State with TickerProv AppTextFormField( labelText: context.translation.callResponse, backgroundColor: AppColor.neutral100, - initialValue: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.callResponse, + initialValue: updateAssetModel?.callResponse, textAlign: TextAlign.center, labelStyle: AppTextStyles.textFieldLabelStyle, showShadow: false, onChange: (value) { - requestDetailProvider.engineerUpdateWorkOrderHelperModel?.callResponse = value; + updateAssetModel?.callResponse = value; }, style: Theme.of(context).textTheme.titleMedium, ), @@ -299,12 +299,12 @@ class _VerifyAssetDetailsState extends State with TickerProv AppTextFormField( labelText: "Description of Finding", backgroundColor: AppColor.neutral100, - initialValue: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.descriptionOfFinding, + initialValue: updateAssetModel?.descriptionOfFinding, textAlign: TextAlign.center, labelStyle: AppTextStyles.textFieldLabelStyle, showShadow: false, onChange: (value) { - requestDetailProvider.engineerUpdateWorkOrderHelperModel?.descriptionOfFinding = value; + updateAssetModel?.descriptionOfFinding = value; }, style: Theme.of(context).textTheme.titleMedium, ), @@ -312,12 +312,12 @@ class _VerifyAssetDetailsState extends State with TickerProv AppTextFormField( labelText: "Action Taken", backgroundColor: AppColor.neutral100, - initialValue: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.actionTaken, + initialValue: updateAssetModel?.actionTaken, textAlign: TextAlign.center, labelStyle: AppTextStyles.textFieldLabelStyle, showShadow: false, onChange: (value) { - requestDetailProvider.engineerUpdateWorkOrderHelperModel?.actionTaken = value; + updateAssetModel?.actionTaken = value; }, style: Theme.of(context).textTheme.titleMedium, ), @@ -326,7 +326,7 @@ class _VerifyAssetDetailsState extends State with TickerProv ).toShadowContainer(context).paddingAll(16), ).expanded, ] else ...[ - assetStatusWidget(context: context, workOrderData: requestDetailProvider.engineerUpdateWorkOrderHelperModel!).toShadowContainer(context).paddingAll(16), + assetStatusWidget(context: context, workOrderData: updateAssetModel!).toShadowContainer(context).paddingAll(16), ], Container( padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 16.toScreenHeight), @@ -337,13 +337,12 @@ class _VerifyAssetDetailsState extends State with TickerProv onPressed: () async { if (validateForm(requestDetailProvider: requestDetailProvider)) { showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading()); - await requestDetailProvider.engineerUpdateWorkOrder().then((success){ + await requestDetailProvider.engineerUpdateWorkOrder(updateAssetModel!).then((success) { Navigator.pop(context); - if(success){ + if (success) { Navigator.pop(context); } }); - } }, ), @@ -359,9 +358,9 @@ class _VerifyAssetDetailsState extends State with TickerProv if (!widget.isEdit) { return true; } - // if (requestDetailProvider.engineerUpdateWorkOrderHelperModel!.equipmentStatus != null) { - // if (requestDetailProvider.engineerUpdateWorkOrderHelperModel!.equipmentStatus!.value == 1 || requestDetailProvider.engineerUpdateWorkOrderHelperModel!.equipmentStatus!.value == 2) { - // if (requestDetailProvider.engineerUpdateWorkOrderHelperModel!.returnToService == null) { + // if (updateAssetModel!.equipmentStatus != null) { + // if (updateAssetModel!.equipmentStatus!.value == 1 || updateAssetModel!.equipmentStatus!.value == 2) { + // if (updateAssetModel!.returnToService == null) { // Fluttertoast.showToast(msg: "Return to service is required ", toastLength: Toast.LENGTH_LONG); // return false; // } From f2eb4d7432c01f353c77a34b3e8712f7f8a33594 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 14 Aug 2025 16:06:08 +0300 Subject: [PATCH 10/13] update asset details improvement. --- lib/modules/cm_module/service_request_detail_provider.dart | 4 ++-- .../views/forms/asset_retired/verify_asset_detail.dart | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/modules/cm_module/service_request_detail_provider.dart b/lib/modules/cm_module/service_request_detail_provider.dart index 7f597320..50636738 100644 --- a/lib/modules/cm_module/service_request_detail_provider.dart +++ b/lib/modules/cm_module/service_request_detail_provider.dart @@ -612,11 +612,11 @@ class ServiceRequestDetailProvider extends ChangeNotifier { } //engineerUpdateWorkOrder...... - Future engineerUpdateWorkOrder(EngineerUpdateWorkOrderHelperModel updateAssetModel) async { + Future engineerUpdateWorkOrder() async { isLoading = true; Response response; try { - response = await ApiManager.instance.post(URLs.engineerUpdateWorkOrderUrl, body: updateAssetModel.toJson()); + response = await ApiManager.instance.post(URLs.engineerUpdateWorkOrderUrl, body: engineerUpdateWorkOrderHelperModel!.toJson()); stateCode = response.statusCode; isLoading = false; notifyListeners(); diff --git a/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart b/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart index 68abaf60..f48d0f76 100644 --- a/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart +++ b/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart @@ -337,7 +337,8 @@ class _VerifyAssetDetailsState extends State with TickerProv onPressed: () async { if (validateForm(requestDetailProvider: requestDetailProvider)) { showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading()); - await requestDetailProvider.engineerUpdateWorkOrder(updateAssetModel!).then((success) { + requestDetailProvider.engineerUpdateWorkOrderHelperModel = updateAssetModel; + await requestDetailProvider.engineerUpdateWorkOrder().then((success) { Navigator.pop(context); if (success) { Navigator.pop(context); From 0637a51ea0b1b9abd26717df908355378f83a41c Mon Sep 17 00:00:00 2001 From: WaseemAbbasi22 Date: Thu, 14 Aug 2025 16:47:07 +0300 Subject: [PATCH 11/13] spare part attachment fixes --- .../forms/spare_part/spare_part_request.dart | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/modules/cm_module/views/forms/spare_part/spare_part_request.dart b/lib/modules/cm_module/views/forms/spare_part/spare_part_request.dart index 41bc6dd0..7e3ef23a 100644 --- a/lib/modules/cm_module/views/forms/spare_part/spare_part_request.dart +++ b/lib/modules/cm_module/views/forms/spare_part/spare_part_request.dart @@ -11,11 +11,13 @@ import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/string_extensions.dart'; import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart'; +import 'package:test_sa/models/generic_attachment_model.dart'; import 'package:test_sa/models/helper_data_models/spare_part/activity_spare_part_model.dart'; import 'package:test_sa/models/lookup.dart'; import 'package:test_sa/models/service_request/spare_parts.dart'; import 'package:test_sa/models/size_config.dart'; import 'package:test_sa/modules/cm_module/service_request_detail_provider.dart'; +import 'package:test_sa/modules/cm_module/utilities/service_request_utils.dart'; import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart'; import 'package:test_sa/modules/cm_module/views/components/bottom_sheets/service_request_bottomsheet.dart'; import 'package:test_sa/new_views/app_style/app_color.dart'; @@ -25,7 +27,7 @@ import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart'; import 'package:test_sa/new_views/common_widgets/default_app_bar.dart'; import 'package:test_sa/new_views/common_widgets/single_item_drop_down_menu.dart'; import 'package:test_sa/providers/loading_list_notifier.dart'; -import 'package:test_sa/views/widgets/images/new_multi_image_picker.dart'; +import 'package:test_sa/views/widgets/images/multi_image_picker.dart'; import 'package:test_sa/views/widgets/loaders/no_data_found.dart'; class SparePartRequest extends StatefulWidget { @@ -43,7 +45,7 @@ class _SparePartRequestState extends State with TickerProvider bool _isLoading = false; List _spareParts = []; - List _files = []; + List attachments = []; final GlobalKey _formKey = GlobalKey(); final GlobalKey _scaffoldKey = GlobalKey(); final TextEditingController _partQtyController = TextEditingController(); @@ -80,7 +82,7 @@ class _SparePartRequestState extends State with TickerProvider activityStatus = _requestDetailProvider?.sparePartHelperModel?.activityStatus?.value; scheduleMicrotask(() async { _isLoading = true; - _files = _requestDetailProvider?.sparePartHelperModel?.sparePartAttachments?.map((e) => MultiFilesPickerModel(e.id!, File(e.name!))).toList() ?? []; + attachments = _requestDetailProvider?.sparePartHelperModel?.sparePartAttachments?.map((e) => GenericAttachmentModel(id: e.id!, name: e.name ?? '')).toList() ?? []; setState(() {}); _spareParts = await _partsProvider!.getPartsListByDisplayName(assetId: _requestDetailProvider?.currentWorkOrder?.data?.asset?.id); _isLoading = false; @@ -95,7 +97,7 @@ class _SparePartRequestState extends State with TickerProvider _returnQtyController.clear(); _oracleNoController.clear(); _descriptionController.clear(); - _files = []; + attachments = []; } @override @@ -291,9 +293,9 @@ class _SparePartRequestState extends State with TickerProvider }, ), 12.height, - NewMultiFilesPicker( + AttachmentPicker( label: context.translation.attachQuotation, - files: _files, + attachment: attachments, buttonIcon: 'quotation_icon'.toSvgAsset(), buttonColor: AppColor.primary10, ), @@ -332,10 +334,10 @@ class _SparePartRequestState extends State with TickerProvider requestDetailProvider.sparePartHelperModel?.sparePartAttachments?.clear(); - for (var pickerObject in _files) { - String fileData = _isLocalUrl(pickerObject.file.path) ? "${pickerObject.file.path.split("/").last}|${base64Encode(File(pickerObject.file.path).readAsBytesSync())}" : pickerObject.file.path; + for (var item in attachments) { + String fileName = ServiceRequestUtils.isLocalUrl(item.name ?? '') ? ("${item.name ?? ''.split("/").last}|${base64Encode(File(item.name ?? '').readAsBytesSync())}") : item.name ?? ''; requestDetailProvider.sparePartHelperModel?.sparePartAttachments?.add( - SparePartAttachments(id: pickerObject.id, name: fileData), + SparePartAttachments(id: item.id, name: fileName), ); } From 841fc937837457e5abb61979f6c13868080d5a4d Mon Sep 17 00:00:00 2001 From: WaseemAbbasi22 Date: Thu, 14 Aug 2025 16:58:48 +0300 Subject: [PATCH 12/13] calibration tool picker fixes --- .../pm_module/ppm_wo/update_ppm/ppm_calibration_tools_form.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules/pm_module/ppm_wo/update_ppm/ppm_calibration_tools_form.dart b/lib/modules/pm_module/ppm_wo/update_ppm/ppm_calibration_tools_form.dart index fd3d3913..e6c31afa 100644 --- a/lib/modules/pm_module/ppm_wo/update_ppm/ppm_calibration_tools_form.dart +++ b/lib/modules/pm_module/ppm_wo/update_ppm/ppm_calibration_tools_form.dart @@ -106,7 +106,7 @@ class _PpmCalibrationToolsFormState extends State { ADatePicker( label: context.translation.calibrationDate, date: DateTime.tryParse(model.calibrationDateOfTesters ?? ""), - from: DateTime.now().subtract(const Duration(days: 90)), + from: DateTime.now().subtract(const Duration(days: 10*365)), backgroundColor: context.isDark ? AppColor.neutral50 : AppColor.neutral100, withBorder: false, hideShadow: true, From 8517562d6a0cf2d6d639acb4b2b3dc4cd798571c Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 14 Aug 2025 17:23:06 +0300 Subject: [PATCH 13/13] 1.3.6+25 uploaded --- lib/controllers/api_routes/urls.dart | 10 +++++----- pubspec.yaml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/controllers/api_routes/urls.dart b/lib/controllers/api_routes/urls.dart index 5c68ebc8..336dd7b3 100644 --- a/lib/controllers/api_routes/urls.dart +++ b/lib/controllers/api_routes/urls.dart @@ -1,16 +1,16 @@ class URLs { URLs._(); - static const String appReleaseBuildNumber = "21"; + static const String appReleaseBuildNumber = "22"; - // static const host1 = "https://atomsm.hmg.com"; // production url + static const host1 = "https://atomsm.hmg.com"; // production url // static const host1 = "https://atomsmdev.hmg.com"; // local DEV url - static const host1 = "https://atomsmuat.hmg.com"; // local UAT url + // static const host1 = "https://atomsmuat.hmg.com"; // local UAT url // static String _baseUrl = "$_host/mobile"; // static final String _baseUrl = "$_host/v2/mobile"; // new V2 apis - static final String _baseUrl = "$_host/mobile"; // host local UAT - // static final String _baseUrl = "$_host/v3/mobile"; // v3 for new CM,PM,TM + // static final String _baseUrl = "$_host/mobile"; // host local UAT + static final String _baseUrl = "$_host/v3/mobile"; // v3 for new CM,PM,TM static String _host = host1; diff --git a/pubspec.yaml b/pubspec.yaml index 47ace654..a562ad1d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.3.5+24 +version: 1.3.6+25 environment: sdk: ">=3.5.0 <4.0.0"