From 312de208e7b447d1b96795c6b900101f078a6371 Mon Sep 17 00:00:00 2001 From: WaseemAbbasi22 <50428976+WaseemAbbasi22@users.noreply.github.com> Date: Wed, 13 May 2026 16:25:21 +0300 Subject: [PATCH] Bug Fixes --- .../pages/asset_inventory_form_view.dart | 1 + lib/modules/cm_module/create_cm_request.dart | 1 + .../service_request_bottomsheet.dart | 7 +- .../components/assistant_employee_list.dart | 2 +- .../components/external_request.dart | 29 ++- .../components/internal_request.dart | 1 - .../forms/spare_part/spare_part_request.dart | 73 ++++--- .../create_incident_request_page.dart | 2 + .../create_equipment_internal_audit_form.dart | 1 + .../create_device_transfer_request.dart | 1 + .../tm_module/tasks/create_task_view.dart | 10 +- .../traf_module/create_traf_request_page.dart | 1 + .../traf_module/update_traf_request_page.dart | 5 +- lib/new_views/app_style/app_color.dart | 2 + .../common_widgets/app_text_form_field.dart | 11 +- .../swipe_module/dialoge/info_dialog.dart | 25 ++- .../swipe_module/swipe_history_view.dart | 10 +- .../swipe_module/swipe_success_view.dart | 12 +- .../add_supplier_engineer_bottom_sheet.dart | 178 ++++++++---------- .../widgets/date_and_time/date_picker.dart | 14 +- lib/views/widgets/equipment/asset_picker.dart | 38 ++-- .../status/assistant_employee_menu.dart | 3 +- ...ervice_report_assistant_employee_menu.dart | 111 +++-------- lib/views/widgets/timer/app_timer.dart | 81 ++++---- 24 files changed, 295 insertions(+), 324 deletions(-) diff --git a/lib/modules/asset_inventory_module/pages/asset_inventory_form_view.dart b/lib/modules/asset_inventory_module/pages/asset_inventory_form_view.dart index f60d5332..29c3d4d5 100644 --- a/lib/modules/asset_inventory_module/pages/asset_inventory_form_view.dart +++ b/lib/modules/asset_inventory_module/pages/asset_inventory_form_view.dart @@ -119,6 +119,7 @@ class _AssetInventoryFormViewState extends State { if ((!isRegistered && widget.sessionTypeValue == 1) || (widget.sessionTypeValue == 3) || (!isRegistered && widget.sessionTypeValue == 2)) ...[ AssetPicker( showLoading: false, + overWriteStyle: true, labelColor: AppColor.white936, iconColor: AppColor.neutral120, label: 'Scan Asset'.addTranslation, diff --git a/lib/modules/cm_module/create_cm_request.dart b/lib/modules/cm_module/create_cm_request.dart index e9d38414..6dcf83e0 100644 --- a/lib/modules/cm_module/create_cm_request.dart +++ b/lib/modules/cm_module/create_cm_request.dart @@ -244,6 +244,7 @@ class _CreateCMRequestState extends State with TickerProviderSt Widget scanAssetButton() { return AssetPicker( device: _serviceRequest.device, + overWriteStyle: true, showLoading: checkPendingRequest, // borderColor: AppColor.black20, onPick: (asset) async { 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 ebf38029..4dcbd64b 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 @@ -789,8 +789,11 @@ class ServiceRequestBottomSheet { AppFilledButton( label: context.translation.no, loading: false, - buttonColor: AppColor.white60, - textColor: AppColor.black10, + showBorder: true, + buttonColor: context.isDark ? AppColor.neutral70 : AppColor.white60, + textColor: context.isDark ? AppColor.white10 : AppColor.black10, + // buttonColor: AppColor.white60, + // textColor: AppColor.black10, onPressed: () async { Navigator.pop(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 d6f1c2db..5124868e 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 @@ -149,7 +149,7 @@ class EmployeeCard extends StatelessWidget { children: [ ServiceReportAssistantEmployeeMenu( title: context.translation.select, - backgroundColor: AppColor.fieldBgColor(context), + // backgroundColor: AppColor.fieldBgColor(context), assetId: assetId, initialValue: model.employee, onSelect: (employee) { 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 b92cb7e4..43057a68 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 @@ -61,7 +61,7 @@ class _ExternalMaintenanceRequestState extends State SingleItemDropDownMenu( context: context, title: context.translation.supplier, - backgroundColor: AppColor.fieldBgColor(context), + // backgroundColor: AppColor.fieldBgColor(context), initialValue: requestDetailProvider.activityMaintenanceHelperModel?.supplier, showAsBottomSheet: true, showShadow: false, @@ -77,7 +77,8 @@ class _ExternalMaintenanceRequestState extends State children: [ SingleItemDropDownMenu( context: context, - backgroundColor: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? context.isDark ? AppColor.neutral20 : AppColor.neutral40 : AppColor.fieldBgColor(context), + backgroundColor: + requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? AppColor.disableFieldBackground(context) : AppColor.fieldBgColor(context), title: context.translation.supplierEngineer, showShadow: false, enabled: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppPersons?.isNotEmpty ?? false, @@ -108,7 +109,7 @@ class _ExternalMaintenanceRequestState extends State width: 60.toScreenWidth, decoration: BoxDecoration( // 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), + color: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? AppColor.disableFieldBackground(context) : AppColor.fieldBgColor(context), borderRadius: BorderRadius.circular(10), //boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)], ), @@ -120,8 +121,12 @@ class _ExternalMaintenanceRequestState extends State context: context, useSafeArea: true, isScrollControlled: true, - backgroundColor: Colors.transparent, - builder: (context) => AddSupplierEngineerBottomSheet(requestDetailProvider.activityMaintenanceHelperModel!.supplier!.id!.toInt()), + isDismissible: true, + backgroundColor: AppColor.bottomSheetColor(context), + // useSafeArea: true, + // isScrollControlled: true, + // backgroundColor: Colors.transparent, + builder: (context) => AddSupplierEngineerBottomSheet(requestDetailProvider.activityMaintenanceHelperModel!.supplier!.id!.toInt()).bottomSheetContainer(context), )) as SuppEngineerWorkOrders; requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppPersons ??= []; requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppPersons?.add(SuppPersons.fromJson(suppEngineer.toJson())); @@ -137,7 +142,7 @@ class _ExternalMaintenanceRequestState extends State ADatePicker( label: context.translation.startTime, hideShadow: true, - backgroundColor: AppColor.fieldBgColor(context), + backgroundColor: AppColor.fieldBgColor(context), date: requestDetailProvider.activityMaintenanceHelperModel?.supplierStartTime, from: requestDetailProvider.currentWorkOrder?.data?.requestedDate, formatDateWithTime: true, @@ -179,10 +184,10 @@ class _ExternalMaintenanceRequestState extends State ADatePicker( label: context.translation.endTime, hideShadow: true, - backgroundColor: AppColor.fieldBgColor(context), + backgroundColor: AppColor.fieldBgColor(context), from: requestDetailProvider.currentWorkOrder?.data?.requestedDate, to: DateTime.now(), - enable: requestDetailProvider.activityMaintenanceHelperModel?.supplierStartTime != null, + enable: requestDetailProvider.activityMaintenanceHelperModel?.supplierStartTime != null, date: requestDetailProvider.activityMaintenanceHelperModel?.supplierEndTime, formatDateWithTime: true, onDatePicker: (selectedDate) { @@ -199,8 +204,6 @@ class _ExternalMaintenanceRequestState extends State // return; // } - - selectedDate = selectedDate.add(Duration(hours: selectedTime.hour, minutes: selectedTime.minute)); bool isBeforeCurrentTime = selectedDate.isBefore(DateTime.now()); bool isAfterStartTime = selectedDate.isAfter(requestDetailProvider.activityMaintenanceHelperModel!.supplierStartTime!); @@ -219,10 +222,6 @@ class _ExternalMaintenanceRequestState extends State // return; // } - - - - requestDetailProvider.activityMaintenanceHelperModel?.supplierEndTime = selectedDate; requestDetailProvider.updateActivityMaintenanceHelperModel(requestDetailProvider.activityMaintenanceHelperModel); CMRequestUtils.calculateAndAssignWorkingHours( @@ -242,7 +241,7 @@ class _ExternalMaintenanceRequestState extends State 8.height, AppTextFormField( labelText: context.translation.workingHours, - backgroundColor: AppColor.fieldBgColor(context), + backgroundColor: AppColor.fieldBgColor(context), controller: _workingHoursController, suffixIcon: "clock".toSvgAsset(width: 20, color: context.isDark ? AppColor.neutral10 : null).paddingOnly(end: 16), initialValue: 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 6030a062..68c6d2d5 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 @@ -162,7 +162,6 @@ class _InternalMaintenanceRequestState extends State 16.height, AppTextFormField( labelText: context.translation.assignedEmployee, - backgroundColor: AppColor.fieldBgColor(context), initialValue: requestDetailProvider.activityMaintenanceHelperModel?.assignedEmployee?.userName, textAlign: TextAlign.center, labelStyle: AppTextStyles.textFieldLabelStyle, 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 32f3b88c..75140eb4 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 @@ -28,6 +28,7 @@ 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/multi_image_picker.dart'; +import 'package:test_sa/views/widgets/item_views/info_text_widget.dart'; import 'package:test_sa/views/widgets/loaders/no_data_found.dart'; class SparePartRequest extends StatefulWidget { @@ -158,7 +159,7 @@ class _SparePartRequestState extends State with TickerProvider showAsBottomSheet: true, loading: _isLoading, initialValue: requestDetailProvider.sparePartHelperModel?.sparePart, - backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, + // backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, onSelect: (part) async { if (part != null) { requestDetailProvider.sparePartHelperModel?.sparePart = part; @@ -181,18 +182,15 @@ class _SparePartRequestState extends State with TickerProvider decorationColor: AppColor.primary10, decoration: TextDecoration.underline, )).onPress( - () async { + () async { requestDetailProvider.getStoreAvailabilityById(partId: requestDetailProvider.sparePartHelperModel?.sparePart?.id); showModalBottomSheet( context: context, + useSafeArea: true, isScrollControlled: true, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.vertical( - top: Radius.circular(20), - ), - ), - clipBehavior: Clip.antiAliasWithSaveLayer, - builder: (BuildContext context) => PartDetailBottomSheetSheet(), + isDismissible: true, + backgroundColor: AppColor.bottomSheetColor(context), + builder: (BuildContext context) => PartDetailBottomSheetSheet().bottomSheetContainer(context), ); }, ), @@ -204,14 +202,14 @@ class _SparePartRequestState extends State with TickerProvider labelText: context.translation.quantity, textInputType: TextInputType.number, labelStyle: AppTextStyles.textFieldLabelStyle, - showWithoutDecoration: true, - backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, + // showWithoutDecoration: true, + // backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, enable: requestDetailProvider.sparePartHelperModel?.sparePart?.id != null, validator: (value) => value == null || value.isEmpty ? context.translation.requiredField : Validator.isNumeric(value) - ? null - : context.translation.onlyNumbers, + ? null + : context.translation.onlyNumbers, onChange: (value) { requestDetailProvider.sparePartHelperModel?.quantity = num.tryParse(value ?? ""); }, @@ -226,14 +224,14 @@ class _SparePartRequestState extends State with TickerProvider labelText: context.translation.installedQty, textInputType: const TextInputType.numberWithOptions(decimal: true), labelStyle: AppTextStyles.textFieldLabelStyle, - showWithoutDecoration: true, - backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, + // showWithoutDecoration: true, + // backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, enable: requestDetailProvider.sparePartHelperModel?.sparePart?.id != null, validator: (value) => value == null || value.isEmpty ? context.translation.requiredField : Validator.isNumeric(value) - ? null - : context.translation.onlyNumbers, + ? null + : context.translation.onlyNumbers, onChange: (value) { requestDetailProvider.sparePartHelperModel?.installQty = num.tryParse(value ?? ""); }, @@ -247,14 +245,14 @@ class _SparePartRequestState extends State with TickerProvider labelText: context.translation.returnQty, textInputType: TextInputType.number, labelStyle: AppTextStyles.textFieldLabelStyle, - showWithoutDecoration: true, - backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, + // showWithoutDecoration: true, + // backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, enable: requestDetailProvider.sparePartHelperModel?.sparePart?.id != null, validator: (value) => value == null || value.isEmpty ? context.translation.requiredField : Validator.isNumeric(value) - ? null - : context.translation.onlyNumbers, + ? null + : context.translation.onlyNumbers, onChange: (value) { requestDetailProvider.sparePartHelperModel?.returnQty = num.tryParse(value ?? ""); }, @@ -269,8 +267,8 @@ class _SparePartRequestState extends State with TickerProvider controller: _oracleNoController, labelText: context.translation.oracleNo, textInputType: TextInputType.number, - showWithoutDecoration: true, - backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, + // showWithoutDecoration: true, + backgroundColor: AppColor.disableFieldBackground(context), enable: false, ), 12.height, @@ -279,10 +277,10 @@ class _SparePartRequestState extends State with TickerProvider labelStyle: AppTextStyles.textFieldLabelStyle, controller: _descriptionController, showSpeechToText: true, - backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, + // backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, labelText: "Engineer Comment", alignLabelWithHint: true, - showWithoutDecoration: true, + // showWithoutDecoration: true, textInputType: TextInputType.multiline, onChange: (value) { requestDetailProvider.sparePartHelperModel?.comment = value; @@ -309,12 +307,12 @@ class _SparePartRequestState extends State with TickerProvider FooterActionButton.footerContainer( context: context, child: AppFilledButton( - label: _requestDetailProvider?.sparePartHelperModel?.id == 0 ? context.translation.addSparePartActivity : context.translation.updateSparePartActivity, - buttonColor: AppColor.green70, - onPressed: () { - _onSubmit(requestDetailProvider: requestDetailProvider); - }, - )), + label: _requestDetailProvider?.sparePartHelperModel?.id == 0 ? context.translation.addSparePartActivity : context.translation.updateSparePartActivity, + buttonColor: AppColor.green70, + onPressed: () { + _onSubmit(requestDetailProvider: requestDetailProvider); + }, + )), ], ), ); @@ -390,7 +388,7 @@ class PartDetailBottomSheetSheet extends StatelessWidget { : requestDetailProvider.storeAvailability.isEmpty ? const NoDataFound().center : ListView.separated( - padding: const EdgeInsets.all(16), + padding: const EdgeInsets.only(top: 12), itemCount: requestDetailProvider.storeAvailability.length, separatorBuilder: (czt, index) => 12.height, itemBuilder: (context, index) { @@ -406,12 +404,9 @@ class PartDetailBottomSheetSheet extends StatelessWidget { Widget partAvailableQuantityCard({required StoreAvailability model, required BuildContext context}) { return Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - 'Site Name: ${model.siteName ?? ''}'.bodyText2(context).custom(color: AppColor.neutral120), - 8.height, - 'Store Name: ${model.storeName ?? ''}'.bodyText2(context).custom(color: AppColor.neutral120), - 8.height, - 'Available Quantity: ${model.availablityQty ?? ''}'.bodyText2(context).custom(color: AppColor.neutral120), - 8.height, - ]).toShadowContainer(context, padding: 12, showShadow: false, backgroundColor: AppColor.neutral110); + InfoTextWidget(label: "Site Name:".addTranslation, value: model.siteName ?? ''), + InfoTextWidget(label: "Store Name:".addTranslation, value: model.storeName ?? ''), + InfoTextWidget(label: "Available Quantity:".addTranslation, value: model.availablityQty != null ? model.availablityQty.toString() : ''), + ]).toShadowContainer(context, padding: 12, showShadow: false,); } } diff --git a/lib/modules/incident_module/create_incident_request_page.dart b/lib/modules/incident_module/create_incident_request_page.dart index 3085dc26..e00c4149 100644 --- a/lib/modules/incident_module/create_incident_request_page.dart +++ b/lib/modules/incident_module/create_incident_request_page.dart @@ -122,8 +122,10 @@ class _CreateIncidentRequestPageState extends State { 8.height, AssetPicker( device: device, + overWriteStyle: true, showLoading: false, borderColor: AppColor.black20, + showBorder: true, onPick: (asset) async { device = asset; payload["assetId"] = asset.modelDefinition?.id; diff --git a/lib/modules/internal_audit_module/pages/equipment_internal_audit/create_equipment_internal_audit_form.dart b/lib/modules/internal_audit_module/pages/equipment_internal_audit/create_equipment_internal_audit_form.dart index 638b7189..99889178 100644 --- a/lib/modules/internal_audit_module/pages/equipment_internal_audit/create_equipment_internal_audit_form.dart +++ b/lib/modules/internal_audit_module/pages/equipment_internal_audit/create_equipment_internal_audit_form.dart @@ -71,6 +71,7 @@ class _CreateEquipmentInternalAuditFormState extends State with TickerProviderStat ), 8.height, taskTypeWidget(selectedType?.relatedTo?.value), - 8.height, if (selectedType != null && selectedType!.isRecallAndAlert!) ...[ + 8.height, recallAndAlert(), ], 8.height, @@ -407,10 +407,13 @@ class _CreateTaskViewState extends State with TickerProviderStat Widget scanAssetButton() { return selectedType?.linkWithMultiAssets == true ? AssetPicker( + overWriteStyle: true, deviceList: _deviceList, showLoading: false, - borderColor: AppColor.black20, - buttonColor: AppColor.white936, + borderColor: AppColor.border2Color(context), + showBorder: true, + // buttonColor: AppColor.white936, + buttonColor: AppColor.dropDownBackground(context), multiSelection: true, onAssetRemove: (itemId) { _deviceList.removeWhere((asset) => asset.id?.toInt() == itemId); @@ -426,6 +429,7 @@ class _CreateTaskViewState extends State with TickerProviderStat ) : AssetPicker( device: device, + overWriteStyle: true, showLoading: false, borderColor: AppColor.black20, onPick: (asset) async { diff --git a/lib/modules/traf_module/create_traf_request_page.dart b/lib/modules/traf_module/create_traf_request_page.dart index ce3818f4..dbfdd646 100644 --- a/lib/modules/traf_module/create_traf_request_page.dart +++ b/lib/modules/traf_module/create_traf_request_page.dart @@ -155,6 +155,7 @@ class _CreateTRAFRequestPageState extends State { if (requestType?.value == 2) ...[ 12.height, AssetPicker( + overWriteStyle: true, device: asset, editable: false, showLoading: false, diff --git a/lib/modules/traf_module/update_traf_request_page.dart b/lib/modules/traf_module/update_traf_request_page.dart index 21297656..3e62c5cb 100644 --- a/lib/modules/traf_module/update_traf_request_page.dart +++ b/lib/modules/traf_module/update_traf_request_page.dart @@ -122,6 +122,7 @@ class _UpdateTrafRequestPageState extends State { if (requestType?.id == 733) ...[ 12.height, AssetPicker( + overWriteStyle: true, device: asset, editable: false, showLoading: false, @@ -163,6 +164,7 @@ class _UpdateTrafRequestPageState extends State { ), 8.height, AssetPicker( + overWriteStyle: true, deviceList: _deviceList, showLoading: false, borderColor: AppColor.black20, @@ -229,8 +231,7 @@ class _UpdateTrafRequestPageState extends State { onPressed: () { trafRequest.attachments = []; for (var item in attachments) { - String fileName = - CMRequestUtils.isLocalUrl(item.name ?? '') ? ("${item.name ?? ''.split("/").last}|${base64Encode(File(item.name ?? '').readAsBytesSync())}") : item.name ?? ''; + String fileName = CMRequestUtils.isLocalUrl(item.name ?? '') ? ("${item.name ?? ''.split("/").last}|${base64Encode(File(item.name ?? '').readAsBytesSync())}") : item.name ?? ''; trafRequest.attachments!.add( Attachments(id: item.id, trafId: item.id, attachmentName: fileName), ); diff --git a/lib/new_views/app_style/app_color.dart b/lib/new_views/app_style/app_color.dart index 1e85d065..8ada48d1 100644 --- a/lib/new_views/app_style/app_color.dart +++ b/lib/new_views/app_style/app_color.dart @@ -132,6 +132,8 @@ class AppColor { static Color dropDownBackground(BuildContext context) => context.isDark ? dropDownDark : backgroundLight; + static Color disableFieldBackground(BuildContext context) => context.isDark ? neutral60 : neutral40; + static Color scaffold2Background(BuildContext context) => context.isDark ? backgroundDark : white20; static Color assetGroupBackground(BuildContext context) => context.isDark ? containerDark : Colors.white30; 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 5b485df7..ad089ace 100644 --- a/lib/new_views/common_widgets/app_text_form_field.dart +++ b/lib/new_views/common_widgets/app_text_form_field.dart @@ -214,11 +214,12 @@ class _AppTextFormFieldState extends State { filled: !widget.isBackgroundTransparent, fillColor: widget.isBackgroundTransparent ? null - : (context.isDark && !widget.enable - ? AppColor.neutral50 - : !widget.enable - ? (widget.enableColor ?? AppColor.disableDark) - : AppColor.dropDownBackground(context)), + : !widget.enable?AppColor.disableFieldBackground(context):AppColor.dropDownBackground(context), + // (context.isDark && !widget.enable + // ? AppColor.neutral50 + // : !widget.enable + // ? (widget.enableColor ?? AppColor.disableDark) + // : AppColor.dropDownBackground(context)), errorStyle: AppTextStyle.tiny.copyWith(color: context.isDark ? AppColor.red50 : AppColor.red30), // floatingLabelStyle: widget.floatingLabelStyle ?? AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? AppColor.white10 : AppColor.neutral20), diff --git a/lib/new_views/swipe_module/dialoge/info_dialog.dart b/lib/new_views/swipe_module/dialoge/info_dialog.dart index 90057706..5809ab6d 100644 --- a/lib/new_views/swipe_module/dialoge/info_dialog.dart +++ b/lib/new_views/swipe_module/dialoge/info_dialog.dart @@ -5,6 +5,7 @@ import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart'; import 'package:test_sa/new_views/app_style/app_color.dart'; import 'package:test_sa/new_views/common_widgets/app_filled_button.dart'; +import 'package:test_sa/views/widgets/item_views/info_header_widget.dart'; class InfoContent { final String? title; @@ -40,10 +41,11 @@ class InfoDialog extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( - child: Text( - title ?? "Information", - style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: AppColor.headingTextColor(context), height: 35 / 24, letterSpacing: -0.96), - ).paddingOnly(top: 16), + child: InfoHeader16Widget("Information").paddingOnly(top: 16), + // Text( + // title ?? "Information", + // style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: AppColor.headingTextColor(context), height: 35 / 24, letterSpacing: -0.96), + // ).paddingOnly(top: 16), ), IconButton( padding: EdgeInsets.zero, @@ -55,7 +57,12 @@ class InfoDialog extends StatelessWidget { ) ], ), - message != null ? message!.bodyText(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20) : const SizedBox(), + message != null + ? Text( + message!, + style: AppTextStyles.bodyText2.copyWith(color: AppColor.lightTextColor(context)), + ) + : const SizedBox(), 8.height, ListView.separated( shrinkWrap: true, @@ -63,9 +70,13 @@ class InfoDialog extends StatelessWidget { itemBuilder: (cxt, index) => RichText( text: TextSpan( text: "${content[index].title}: ", - style: AppTextStyles.heading6.copyWith(fontWeight: FontWeight.w600, color: AppColor.textColor(context)), + // + style: AppTextStyles.heading6.copyWith(color: AppColor.textStyleColor(context), fontSize: 14), children: [ - TextSpan(text: content[index].message, style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20)), + TextSpan( + text: content[index].message, + style: AppTextStyles.bodyText2.copyWith(color: AppColor.lightTextColor(context), fontWeight: FontWeight.normal), + ), ], ), ), diff --git a/lib/new_views/swipe_module/swipe_history_view.dart b/lib/new_views/swipe_module/swipe_history_view.dart index c01458ad..c340f7bb 100644 --- a/lib/new_views/swipe_module/swipe_history_view.dart +++ b/lib/new_views/swipe_module/swipe_history_view.dart @@ -10,6 +10,7 @@ import 'package:test_sa/new_views/app_style/app_color.dart'; import 'package:test_sa/new_views/common_widgets/app_filled_button.dart'; import 'package:test_sa/new_views/common_widgets/default_app_bar.dart'; import 'package:test_sa/views/widgets/date_and_time/date_picker.dart'; +import 'package:test_sa/views/widgets/date_and_time/time_picker.dart'; import 'package:test_sa/views/widgets/item_views/info_text_widget.dart'; import 'package:test_sa/views/widgets/loaders/lazy_loading.dart'; import 'package:test_sa/views/widgets/loaders/no_data_found.dart'; @@ -62,7 +63,7 @@ class _SwipeHistoryViewState extends State { formatDateWithTime: true, onDatePicker: (selectedDate) { if (selectedDate != null) { - showTimePicker( + showThemedTimePicker( context: context, initialTime: TimeOfDay.now(), ).then((selectedTime) { @@ -93,7 +94,7 @@ class _SwipeHistoryViewState extends State { formatDateWithTime: true, onDatePicker: (selectedDate) { if (selectedDate != null) { - showTimePicker( + showThemedTimePicker( context: context, initialTime: TimeOfDay.now(), ).then((selectedTime) { @@ -121,10 +122,7 @@ class _SwipeHistoryViewState extends State { 12.height, AppFilledButton(label: context.translation.search, maxWidth: false, onPressed: getSwipeHistory), 8.height, - const Divider( - thickness: 2, - color: AppColor.white60, - ), + const Divider().defaultStyle(context), Consumer(builder: (context, snapshot, child) { return SwipeHistoryList(snapshot.swipeHistory ?? [], snapshot.isLoading).expanded; }), diff --git a/lib/new_views/swipe_module/swipe_success_view.dart b/lib/new_views/swipe_module/swipe_success_view.dart index 96b40979..cc96e9ea 100644 --- a/lib/new_views/swipe_module/swipe_success_view.dart +++ b/lib/new_views/swipe_module/swipe_success_view.dart @@ -21,7 +21,17 @@ class SwipeSuccessView extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ - 'swipe_success'.toSvgAsset(), + // 'swipe_success'.toSvgAsset(), + Container( + padding: const EdgeInsets.all(20), + width: 150.toScreenWidth, + height: 150.toScreenHeight, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: AppColor.background(context), + ), + child: 'swipe'.toSvgAsset(width: 24, height: 24, color: AppColor.green70), + ), 17.height, Text( context.translation.successful, diff --git a/lib/views/pages/user/requests/add_supplier_engineer_bottom_sheet.dart b/lib/views/pages/user/requests/add_supplier_engineer_bottom_sheet.dart index 80aa0a6b..40b03c2b 100644 --- a/lib/views/pages/user/requests/add_supplier_engineer_bottom_sheet.dart +++ b/lib/views/pages/user/requests/add_supplier_engineer_bottom_sheet.dart @@ -46,106 +46,92 @@ class _AddSupplierEngineerBottomSheetState extends State(context, listen: false); return Wrap( children: [ - Container( - clipBehavior: Clip.antiAlias, - margin: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), - decoration: BoxDecoration( - color: Theme.of(context).scaffoldBackgroundColor, - borderRadius: const BorderRadius.only(topRight: Radius.circular(20), topLeft: Radius.circular(20)), - ), - padding: EdgeInsets.only( - left: 16.toScreenWidth, - right: 16.toScreenHeight, - top: 8.toScreenHeight, - bottom: MediaQuery.of(context).viewInsets.bottom + MediaQuery.of(context).padding.bottom, - ), - child: Form( - key: _formKey, - child: SingleChildScrollView( - child: Column( - children: [ - Container( - width: 40.toScreenWidth, - height: 5.toScreenHeight, - decoration: BoxDecoration(color: AppColor.neutral40, borderRadius: BorderRadius.circular(30)), - ), - Align( - alignment: AlignmentDirectional.centerStart, - child: "Add Engineer For Supplier".heading5(context).custom(fontWeight: FontWeight.w600).paddingOnly(top: 16, bottom: 16), - ), - 8.height, - AppTextFormField( - labelText: "Engineer Supplier Name".addTranslation, - textInputType: TextInputType.name, - onChange: (text) { - engineer.personName = text.isEmpty ? null : text; - }, - onSaved: (text) { - engineer.personName = text.isEmpty ? null : text; - }, - ), - 8.height, - SingleItemDropDownMenu( - context: context, - title: "Role", - initialValue: suppEngRole, - onSelect: (value) { - if (value != null) { - suppEngRole = value; - } - }, - ), - 8.height, - AppTextFormField( - labelText: "Contact".addTranslation, - textInputType: TextInputType.name, - onChange: (text) { - engineer.contact = text.isEmpty ? null : text; - }, - onSaved: (text) { - engineer.contact = text.isEmpty ? null : text; - }, - ), - 8.height, - AppTextFormField( - labelText: "Email".addTranslation, - textInputType: TextInputType.emailAddress, - onChange: (text) { - engineer.email = text.isEmpty ? null : text; - }, - onSaved: (text) { - engineer.email = text.isEmpty ? null : text; - }, - ), - 8.height, - 16.height, - Consumer( - builder: (context, snapshot, _) => AppFilledButton( - label: context.translation.save, - loading: snapshot.isLoading ?? false, - onPressed: () async { - _formKey.currentState!.save(); + Form( + key: _formKey, + child: SingleChildScrollView( + child: Column( + children: [ + Container( + width: 40.toScreenWidth, + height: 5.toScreenHeight, + decoration: BoxDecoration(color: AppColor.neutral40, borderRadius: BorderRadius.circular(30)), + ), + Align( + alignment: AlignmentDirectional.centerStart, + child: "Add Engineer For Supplier".heading5(context).custom(fontWeight: FontWeight.w600).paddingOnly(top: 16, bottom: 16), + ), + 8.height, + AppTextFormField( + labelText: "Engineer Supplier Name".addTranslation, + textInputType: TextInputType.name, + onChange: (text) { + engineer.personName = text.isEmpty ? null : text; + }, + onSaved: (text) { + engineer.personName = text.isEmpty ? null : text; + }, + ), + 8.height, + SingleItemDropDownMenu( + context: context, + title: "Role", + initialValue: suppEngRole, + onSelect: (value) { + if (value != null) { + suppEngRole = value; + } + }, + ), + 8.height, + AppTextFormField( + labelText: "Contact".addTranslation, + textInputType: TextInputType.name, + onChange: (text) { + engineer.contact = text.isEmpty ? null : text; + }, + onSaved: (text) { + engineer.contact = text.isEmpty ? null : text; + }, + ), + 8.height, + AppTextFormField( + labelText: "Email".addTranslation, + textInputType: TextInputType.emailAddress, + onChange: (text) { + engineer.email = text.isEmpty ? null : text; + }, + onSaved: (text) { + engineer.email = text.isEmpty ? null : text; + }, + ), + 8.height, + 16.height, + Consumer( + builder: (context, snapshot, _) => AppFilledButton( + label: context.translation.save, + loading: snapshot.isLoading ?? false, + onPressed: () async { + _formKey.currentState!.save(); - if (engineer.personName?.isEmpty ?? true) { - "Engineer supplier name is empty".showToast; - return; - } + if (engineer.personName?.isEmpty ?? true) { + "Engineer supplier name is empty".showToast; + return; + } - engineer.personRoleId = suppEngRole?.id; + engineer.personRoleId = suppEngRole?.id; - SuppEngineerWorkOrders? suppEngineer = await snapshot.addSupplierEngineer(engineer); - if (suppEngineer == null) { - Fluttertoast.showToast(msg: context.translation.failedToCompleteRequest); - return; - } - Fluttertoast.showToast(msg: context.translation.successfulRequestMessage); - Navigator.pop(context, suppEngineer); - }, - ), + SuppEngineerWorkOrders? suppEngineer = await snapshot.addSupplierEngineer(engineer); + if (suppEngineer == null) { + Fluttertoast.showToast(msg: context.translation.failedToCompleteRequest); + return; + } + Fluttertoast.showToast(msg: context.translation.successfulRequestMessage); + Navigator.pop(context, suppEngineer); + }, ), - 16.height, - ], - ), + ), + 16.height, + ], ), ), ) diff --git a/lib/views/widgets/date_and_time/date_picker.dart b/lib/views/widgets/date_and_time/date_picker.dart index 58fab5d6..bc459639 100644 --- a/lib/views/widgets/date_and_time/date_picker.dart +++ b/lib/views/widgets/date_and_time/date_picker.dart @@ -43,11 +43,7 @@ class ADatePicker extends StatelessWidget { return Container( height: height, decoration: BoxDecoration( - color: (context.isDark && !enable - ? AppColor.neutral50 - : !enable - ? AppColor.neutral40 - : AppColor.background(context)), + color: !enable ? AppColor.disableFieldBackground(context) : AppColor.dropDownBackground(context), borderRadius: BorderRadius.circular(16), border: withBorder ? Border.all(width: 1, color: AppColor.border2Color(context)) : const Border(), boxShadow: hideShadow ? null : [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)], @@ -96,6 +92,8 @@ class ADatePicker extends StatelessWidget { headerBackgroundColor: AppColor.primary10, headerForegroundColor: Colors.white, + subHeaderForegroundColor: AppColor.textColor(context), + // Background backgroundColor: AppColor.bottomSheetColor(context), @@ -135,7 +133,7 @@ class ADatePicker extends StatelessWidget { return Colors.transparent; }), - todayBorder: BorderSide(color: AppColor.primary10, width: 1), + todayBorder: const BorderSide(color: AppColor.primary10, width: 1), // Year selector styling yearForegroundColor: WidgetStateColor.resolveWith((states) { @@ -181,7 +179,7 @@ class ADatePicker extends StatelessWidget { // Input decoration for text field mode inputDecorationTheme: InputDecorationTheme( - focusedBorder: UnderlineInputBorder( + focusedBorder: const UnderlineInputBorder( borderSide: BorderSide(color: AppColor.primary10, width: 2), ), enabledBorder: UnderlineInputBorder( @@ -202,7 +200,7 @@ class ADatePicker extends StatelessWidget { ), // Icon theme for navigation arrows - iconTheme: IconThemeData( + iconTheme: const IconThemeData( color: Colors.white, ), ), diff --git a/lib/views/widgets/equipment/asset_picker.dart b/lib/views/widgets/equipment/asset_picker.dart index ff611a91..9088ad37 100644 --- a/lib/views/widgets/equipment/asset_picker.dart +++ b/lib/views/widgets/equipment/asset_picker.dart @@ -18,6 +18,7 @@ class AssetPicker extends StatelessWidget { final Asset? device; final List deviceList; final bool editable; + bool overWriteStyle; final bool showAssetInfo; final bool showBorder; final Color? borderColor; @@ -34,6 +35,7 @@ class AssetPicker extends StatelessWidget { AssetPicker( {Key? key, this.editable = true, + this.overWriteStyle = false, this.device, this.deviceList = const [], this.onPick, @@ -46,7 +48,7 @@ class AssetPicker extends StatelessWidget { this.labelColor, this.backgroundColor, this.showAssetInfo = true, - this.showBorder = false, + this.showBorder = true, this.multiSelection = false, this.forPPM = false, this.enablePickManually = true, @@ -63,22 +65,29 @@ class AssetPicker extends StatelessWidget { return Column( children: [ if (device == null && deviceList.isEmpty) + // showBorder: true, + // // buttonColor: AppColor.white936, + // buttonColor: AppColor.dropDownBackground(context), Container( height: 50.toScreenHeight, alignment: Alignment.center, decoration: BoxDecoration( - color: buttonColor ?? backgroundColor ?? AppColor.primary10, + color: overWriteStyle ? AppColor.dropDownBackground(context) : buttonColor ?? backgroundColor ?? AppColor.primary10, borderRadius: BorderRadius.circular(10), - border: showBorder ? Border.all(color: borderColor ?? AppColor.border2Color(context), width: 1) : null, + border: showBorder + ? Border.all( + color: overWriteStyle ? AppColor.border2Color(context) : borderColor ?? AppColor.border2Color(context), + ) + : null, // boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.03), blurRadius: 14)], ), padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight), child: Row( mainAxisSize: MainAxisSize.min, children: [ - "scan_asset".toSvgAsset(height: 22, fit: BoxFit.fitHeight, color: AppColor.white10), + "scan_asset".toSvgAsset(height: 22, fit: BoxFit.fitHeight, color: AppColor.icon2Color(context)), 8.width, - ' ${label ?? "Scan or Pick Asset"}'.bodyText(context).custom(color: AppColor.white10), + ' ${label ?? "Scan or Pick Asset"}'.bodyText(context).custom(color: AppColor.labelTextStyleColor(context)), ], ), ).onPress(() async { @@ -109,20 +118,22 @@ class AssetPicker extends StatelessWidget { height: 50, alignment: Alignment.center, decoration: BoxDecoration( - // // color: Colors.white, - // borderRadius: BorderRadius.circular(10), - // border: Border.all(color: borderColor ?? AppColor.border2Color(context), width: 1), - color: buttonColor ?? backgroundColor ?? AppColor.primary10, + color: overWriteStyle ? AppColor.dropDownBackground(context) : buttonColor ?? backgroundColor ?? AppColor.primary10, borderRadius: BorderRadius.circular(10), - border: showBorder ? Border.all(color: borderColor ?? AppColor.border2Color(context), width: 1) : null, + border: showBorder + ? Border.all( + color: overWriteStyle ? AppColor.border2Color(context) : borderColor ?? AppColor.border2Color(context), + ) + : null, + // border: showBorder ? Border.all(color: borderColor ?? AppColor.border2Color(context), width: 1) : null, ), padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight), child: Row( mainAxisSize: MainAxisSize.min, children: [ - "scan_asset".toSvgAsset(height: 22, fit: BoxFit.fitHeight, color: AppColor.white10), + "scan_asset".toSvgAsset(height: 22, fit: BoxFit.fitHeight, color: AppColor.iconColor(context)), 8.width, - "Re-Scan or Pick Asset".bodyText(context).custom(color: AppColor.white10), + "Re-Scan or Pick Asset".bodyText(context).custom(color: AppColor.labelTextStyleColor(context)), ], ), ).onPress(() async { @@ -165,9 +176,10 @@ class AssetPicker extends StatelessWidget { return Container( padding: const EdgeInsets.all(12), decoration: BoxDecoration( + //AppColor.background(context) color: showLoading ? Colors.white : AppColor.background(context), borderRadius: BorderRadius.circular(16), - border: Border.all(color: borderColor ?? AppColor.borderColor(context)), + border: Border.all(color: overWriteStyle ? AppColor.border2Color(context) : borderColor ?? AppColor.border2Color(context)), ), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, diff --git a/lib/views/widgets/status/assistant_employee_menu.dart b/lib/views/widgets/status/assistant_employee_menu.dart index 07788fc3..45717169 100644 --- a/lib/views/widgets/status/assistant_employee_menu.dart +++ b/lib/views/widgets/status/assistant_employee_menu.dart @@ -72,8 +72,9 @@ class _SingleAssistantEmployeeMenuState extends State { height: 60.toScreenHeight, padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth), decoration: BoxDecoration( - color: widget.backgroundColor ?? (context.isDark ? AppColor.neutral50 : AppColor.neutral120), + color: widget.backgroundColor ?? AppColor.dropDownBackground(context), borderRadius: BorderRadius.circular(10), + boxShadow: widget.hideShadow ? null : [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)], ), child: Stack( diff --git a/lib/views/widgets/status/report/service_report_assistant_employee_menu.dart b/lib/views/widgets/status/report/service_report_assistant_employee_menu.dart index 5024585e..0f974099 100644 --- a/lib/views/widgets/status/report/service_report_assistant_employee_menu.dart +++ b/lib/views/widgets/status/report/service_report_assistant_employee_menu.dart @@ -1,21 +1,29 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:test_sa/models/new_models/assistant_employee.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/loaders/loading_manager.dart'; -import 'package:test_sa/views/widgets/status/assistant_employee_menu.dart'; import '../../../../controllers/providers/api/status_drop_down/report/service_report_assistants_employee_provider.dart'; class ServiceReportAssistantEmployeeMenu extends StatelessWidget { final Function(AssistantEmployees?) onSelect; - final AssistantEmployees? initialValue; // Now nullable - Color? backgroundColor; + final AssistantEmployees? initialValue; + final Color? backgroundColor; final String title; - final num ?assetId; + final num? assetId; final bool enable; - ServiceReportAssistantEmployeeMenu({Key? key, required this.onSelect, required this.title, required this.initialValue, this.assetId, this.backgroundColor, this.enable = true}) - : super(key: key); + const ServiceReportAssistantEmployeeMenu({ + Key? key, + required this.onSelect, + required this.title, + required this.initialValue, + this.assetId, + this.backgroundColor, + this.enable = true, + }) : super(key: key); @override Widget build(BuildContext context) { @@ -25,88 +33,23 @@ class ServiceReportAssistantEmployeeMenu extends StatelessWidget { isFailedLoading: menuProvider.assistantEmployees == null, stateCode: menuProvider.stateCode, onRefresh: () async { - await menuProvider.getAssistantEmployees(assetId:assetId); + await menuProvider.getAssistantEmployees(assetId: assetId); }, - child: AssistantEmployeeMenu( - initialStatus: initialValue, + child: SingleItemDropDownMenu( + context: context, title: title, + staticData: menuProvider.assistantEmployees ?? [], + showShadow: false, showAsBottomSheet: true, - hideShadow: true, - statuses: menuProvider.assistantEmployees ?? [], - backgroundColor: backgroundColor, - // Provide an empty list if null - onSelect: onSelect, - // Pass onSelect directly - enable: enable, + loading: menuProvider.isLoading, + initialValue: initialValue, + enabled: enable, + onSelect: (employee) async { + if (employee != null) { + onSelect(employee); + } + }, ), ); } } - -// import 'package:flutter/material.dart'; -// import 'package:provider/provider.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/loaders/loading_manager.dart'; -// -// import '../../../../controllers/providers/api/status_drop_down/report/service_report_assistants_employee_provider.dart'; -// import '../../../../models/new_models/assistant_employee.dart'; -// -// class ServiceReportAssistantEmployeeMenu extends StatefulWidget { -// final Function(AssistantEmployees) onSelect; -// final AssistantEmployees initialValue; -// final String title; -// final num assetId; -// final bool enabled; -// -// const ServiceReportAssistantEmployeeMenu({Key? key, this.enabled = true, required this.onSelect, required this.assetId, this.title, this.initialValue}) : super(key: key); -// -// @override -// State createState() => _ServiceReportAssistantEmployeeMenuState(); -// } -// -// class _ServiceReportAssistantEmployeeMenuState extends State { -// AssistantEmployees _initialValue; -// -// @override -// void initState() { -// _initialValue = widget.initialValue; -// super.initState(); -// } -// -// @override -// void didUpdateWidget(covariant ServiceReportAssistantEmployeeMenu oldWidget) { -// if (widget.initialValue != oldWidget.initialValue) { -// _initialValue = widget.initialValue; -// setState(() {}); -// } -// super.didUpdateWidget(oldWidget); -// } -// -// @override -// Widget build(BuildContext context) { -// ServiceReportAssistantsEmployeeProvider menuProvider = Provider.of(context); -// return LoadingManager( -// isLoading: menuProvider.isLoading, -// isFailedLoading: menuProvider.assistantEmployees == null, -// stateCode: menuProvider.stateCode, -// onRefresh: () async { -// await menuProvider.getAssistantEmployees(widget.assetId); -// }, -// child: SingleItemDropDownMenu( -// title: widget.title, -// context: context, -// enabled: widget.enabled, -// initialValue: _initialValue, -// staticData: menuProvider.assistantEmployees, -// onSelect: widget.onSelect, -// ), -// // child: AssistantEmployeeMenu( -// // title: title, -// // initialStatus: initialValue, -// // statuses: menuProvider.assistantEmployees, -// // onSelect: onSelect, -// // ), -// ); -// } -// } diff --git a/lib/views/widgets/timer/app_timer.dart b/lib/views/widgets/timer/app_timer.dart index d8c9b632..98e0abd2 100644 --- a/lib/views/widgets/timer/app_timer.dart +++ b/lib/views/widgets/timer/app_timer.dart @@ -10,6 +10,7 @@ import 'package:test_sa/extensions/widget_extensions.dart'; import 'package:test_sa/models/timer_model.dart'; import 'package:test_sa/modules/cm_module/cm_request_utils.dart'; import 'package:test_sa/views/widgets/date_and_time/date_picker.dart'; +import 'package:test_sa/views/widgets/date_and_time/time_picker.dart'; import '../../../new_views/app_style/app_color.dart'; @@ -165,33 +166,33 @@ class _AppTimerState extends State { ADatePicker( label: context.translation.startTime, hideShadow: true, - backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, + backgroundColor: AppColor.dropDownBackground(context), date: _pickerStartAt, from: widget.pickerFromDate, enable: widget.enabled ? _tempPickerTimer == null : false, formatDateWithTime: true, onDatePicker: (selectedDate) { - showTimePicker( + showThemedTimePicker( context: context, initialTime: TimeOfDay.now(), - builder: (BuildContext context, Widget? child) { - final ThemeData currentTheme = Theme.of(context); - return Theme( - data: currentTheme.copyWith( - timePickerTheme: TimePickerThemeData( - dialHandColor: AppColor.primary10, - dialBackgroundColor: Colors.grey.withOpacity(0.1), - hourMinuteColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? AppColor.primary10 : Colors.grey.withOpacity(0.1)), - dayPeriodColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? AppColor.primary10 : Colors.transparent), - dayPeriodTextColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? Colors.white : AppColor.primary10), - dayPeriodBorderSide: BorderSide(color: Colors.grey.withOpacity(0.2)), - entryModeIconColor: AppColor.primary10, - ), - textButtonTheme: TextButtonThemeData(style: TextButton.styleFrom(foregroundColor: AppColor.primary10)), - ), - child: child!, - ); - }, + // builder: (BuildContext context, Widget? child) { + // final ThemeData currentTheme = Theme.of(context); + // return Theme( + // data: currentTheme.copyWith( + // timePickerTheme: TimePickerThemeData( + // dialHandColor: AppColor.primary10, + // dialBackgroundColor: Colors.grey.withOpacity(0.1), + // hourMinuteColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? AppColor.primary10 : Colors.grey.withOpacity(0.1)), + // dayPeriodColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? AppColor.primary10 : Colors.transparent), + // dayPeriodTextColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? Colors.white : AppColor.primary10), + // dayPeriodBorderSide: BorderSide(color: Colors.grey.withOpacity(0.2)), + // entryModeIconColor: AppColor.primary10, + // ), + // textButtonTheme: TextButtonThemeData(style: TextButton.styleFrom(foregroundColor: AppColor.primary10)), + // ), + // child: child!, + // ); + // }, ).then((selectedTime) { if (selectedTime != null) { _pickerStartAt = DateTime(selectedDate.year, selectedDate.month, selectedDate.day, selectedTime.hour, selectedTime.minute); @@ -216,34 +217,34 @@ class _AppTimerState extends State { ADatePicker( label: context.translation.endTime, hideShadow: true, - backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, + // backgroundColor: AppColor.dropDownBackground(context), enable: widget.enabled ? _pickerStartAt != null : false, from: _pickerStartAt, date: _pickerEndAt, to: DateTime.now(), formatDateWithTime: true, onDatePicker: (selectedDate) { - showTimePicker( + showThemedTimePicker( context: context, initialTime: TimeOfDay.now(), - builder: (BuildContext context, Widget? child) { - final ThemeData currentTheme = Theme.of(context); - return Theme( - data: currentTheme.copyWith( - timePickerTheme: TimePickerThemeData( - dialHandColor: AppColor.primary10, - dialBackgroundColor: Colors.grey.withOpacity(0.1), - hourMinuteColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? AppColor.primary10 : Colors.grey.withOpacity(0.1)), - dayPeriodColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? AppColor.primary10 : Colors.transparent), - dayPeriodTextColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? Colors.white : AppColor.primary10), - dayPeriodBorderSide: BorderSide(color: Colors.grey.withOpacity(0.2)), - entryModeIconColor: AppColor.primary10, - ), - textButtonTheme: TextButtonThemeData(style: TextButton.styleFrom(foregroundColor: AppColor.primary10)), - ), - child: child!, - ); - }, + // builder: (BuildContext context, Widget? child) { + // final ThemeData currentTheme = Theme.of(context); + // return Theme( + // data: currentTheme.copyWith( + // timePickerTheme: TimePickerThemeData( + // dialHandColor: AppColor.primary10, + // dialBackgroundColor: Colors.grey.withOpacity(0.1), + // hourMinuteColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? AppColor.primary10 : Colors.grey.withOpacity(0.1)), + // dayPeriodColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? AppColor.primary10 : Colors.transparent), + // dayPeriodTextColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? Colors.white : AppColor.primary10), + // dayPeriodBorderSide: BorderSide(color: Colors.grey.withOpacity(0.2)), + // entryModeIconColor: AppColor.primary10, + // ), + // textButtonTheme: TextButtonThemeData(style: TextButton.styleFrom(foregroundColor: AppColor.primary10)), + // ), + // child: child!, + // ); + // }, ).then((selectedTime) { if (selectedTime != null) { selectedDate = selectedDate.add(Duration(hours: selectedTime.hour, minutes: selectedTime.minute));