From 7a02b2e715fb66f540b4f3c8b85d34590e12facf Mon Sep 17 00:00:00 2001 From: zaid_daoud Date: Sun, 20 Aug 2023 12:38:24 +0300 Subject: [PATCH] fault description is disabled when create new work order --- .../user/requests/report/create_service_report.dart | 1 + .../status/report/service_report_fault_description.dart | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/views/pages/user/requests/report/create_service_report.dart b/lib/views/pages/user/requests/report/create_service_report.dart index 89fdf8da..ff09c44c 100644 --- a/lib/views/pages/user/requests/report/create_service_report.dart +++ b/lib/views/pages/user/requests/report/create_service_report.dart @@ -545,6 +545,7 @@ class _CreateServiceReportState extends State with TickerPr ServiceReportFaultDescription( requestId: widget.request?.id, initialValue: _serviceReport.faultDescription, + enabled: false, onSelect: (status) { _serviceReport.faultDescription = status; setState(() {}); diff --git a/lib/views/widgets/status/report/service_report_fault_description.dart b/lib/views/widgets/status/report/service_report_fault_description.dart index 544fcbb3..facda9dd 100644 --- a/lib/views/widgets/status/report/service_report_fault_description.dart +++ b/lib/views/widgets/status/report/service_report_fault_description.dart @@ -13,8 +13,9 @@ class ServiceReportFaultDescription extends StatelessWidget { final String requestId; final Function(FaultDescription) onSelect; final FaultDescription initialValue; + final bool enabled; - const ServiceReportFaultDescription({Key key, this.requestId, this.onSelect, this.initialValue}) : super(key: key); + const ServiceReportFaultDescription({Key key, this.requestId, this.onSelect, this.initialValue, this.enabled = true}) : super(key: key); @override Widget build(BuildContext context) { SettingProvider settingProvider = Provider.of(context); @@ -28,9 +29,9 @@ class ServiceReportFaultDescription extends StatelessWidget { menuProvider.reset(); await menuProvider.getCallRequestForWorkOrder(user: userProvider.user, host: settingProvider.host, requestId: requestId); }, - child: (menuProvider.items?.isEmpty ?? true) - ? const ATextFormField( - initialValue: "", + child: ((menuProvider.items?.isEmpty ?? true) || (!enabled)) + ? ATextFormField( + initialValue: (!enabled) ? initialValue?.defectName ?? "" : "", enable: false, ) : FaultDescriptionMenu(