From 0ee21c001178b8a5cd980de9dda94aa4595b7a20 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Sun, 17 May 2026 15:59:51 +0300 Subject: [PATCH 1/2] improvements --- lib/controllers/api_routes/urls.dart | 5 +- .../views/components/asset_detail_card.dart | 2 +- .../components/assistant_employee_list.dart | 6 +- .../components/external_request.dart | 4 +- lib/new_views/app_style/app_color.dart | 24 ++- .../add_supplier_engineer_bottom_sheet.dart | 175 +++++++++--------- 6 files changed, 117 insertions(+), 99 deletions(-) diff --git a/lib/controllers/api_routes/urls.dart b/lib/controllers/api_routes/urls.dart index 96d4fe22..63f83c86 100644 --- a/lib/controllers/api_routes/urls.dart +++ b/lib/controllers/api_routes/urls.dart @@ -7,8 +7,9 @@ class URLs { // static const host1 = "https://atomsmdev.hmg.com"; // local DEV url static const host1 = "https://atomsmuat.hmg.com"; // local UAT url - static final String _baseUrl = "$_host/mobile"; // host local UAT - // static final String _baseUrl = "$_host/v1/mobile"; // new V2 apis + // static final String _baseUrl = "$_host/mobile"; // host local UAT + // static final String _baseUrl = "$_host/v1/mobile"; + static final String _baseUrl = "$_host/v2/mobile"; // new V2 apis // static final String _baseUrl = "$_host/v3/mobile"; // v3 for production CM,PM,TM // static final String _baseUrl = "$_host/v4/mobile"; // v4 for Demo module // static final String _baseUrl = "$_host/v5/mobile"; // v5 for data segregation 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 4352ba27..8443e3ed 100644 --- a/lib/modules/cm_module/views/components/asset_detail_card.dart +++ b/lib/modules/cm_module/views/components/asset_detail_card.dart @@ -29,7 +29,7 @@ class AssetDetailCard extends StatelessWidget { label: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.equipmentStatus?.name, id: requestDetailProvider.engineerUpdateWorkOrderHelperModel!.equipmentStatus!.id ?? 0, radius: 4, - textColor: AppColor.white10, + textColor: AppColor.getEquipmentStatusTextColor(context, requestDetailProvider.engineerUpdateWorkOrderHelperModel!.equipmentStatus!.id ?? 0), backgroundColor: AppColor.getEquipmentStatusColor(context, requestDetailProvider.engineerUpdateWorkOrderHelperModel!.equipmentStatus!.id ?? 0), ), if (requestDetailProvider.engineerUpdateWorkOrderHelperModel?.cmFrameId != null) ...[ 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 5124868e..708c8b50 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 @@ -81,9 +81,9 @@ class _ServiceRequestAssistantEmployeeListState extends State width: 60.toScreenWidth, decoration: BoxDecoration( // color: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? AppColor.neutral40 : AppColor.neutral100, - color: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? AppColor.disableFieldBackground(context) : AppColor.fieldBgColor(context), + color: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? AppColor.disableFieldBackground(context) : AppColor.primary10, borderRadius: BorderRadius.circular(10), //boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)], ), - child: Icon(Icons.add, color: context.isDark ? null : AppColor.neutral60), + child: Icon(Icons.add, color: AppColor.background(context)), ).onPress(requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? null : () async { diff --git a/lib/new_views/app_style/app_color.dart b/lib/new_views/app_style/app_color.dart index 70515d71..ad7abf2a 100644 --- a/lib/new_views/app_style/app_color.dart +++ b/lib/new_views/app_style/app_color.dart @@ -431,15 +431,31 @@ class AppColor { switch (id) { case 368: //partially Down - return greenStatus(context); + return greenStatusColor; case 369: // Completely Down - return redStatus(context); + return redStatusColor; case 790: //UP - return blueStatus(context); + return blueStatusColor; + default: + return blueStatusColor; + } + } + + static Color getEquipmentStatusTextColor(BuildContext context, int id) { + switch (id) { + case 368: + //partially Down + return greenStatusTextColor; + case 369: + // Completely Down + return redStatusTextColor; + case 790: + //UP + return blueStatusTextColor; default: - return blueStatus(context); + return blueStatusTextColor; } } } 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 40b03c2b..d2017b58 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 @@ -44,98 +44,99 @@ class _AddSupplierEngineerBottomSheetState extends State(context, listen: false); - return Wrap( - children: [ - 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; + return SafeArea( + child: Wrap( + children: [ + 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), + ), + 12.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; + }, + ), + 12.height, + SingleItemDropDownMenu( + context: context, + title: "Role", + initialValue: suppEngRole, + onSelect: (value) { + if (value != null) { + suppEngRole = value; } + }, + ), + 12.height, + AppTextFormField( + labelText: "Contact".addTranslation, + textInputType: TextInputType.name, + onChange: (text) { + engineer.contact = text.isEmpty ? null : text; + }, + onSaved: (text) { + engineer.contact = text.isEmpty ? null : text; + }, + ), + 12.height, + AppTextFormField( + labelText: "Email".addTranslation, + textInputType: TextInputType.emailAddress, + onChange: (text) { + engineer.email = text.isEmpty ? null : text; + }, + onSaved: (text) { + engineer.email = text.isEmpty ? null : text; + }, + ), + 24.height, + Consumer( + builder: (context, snapshot, _) => AppFilledButton( + label: context.translation.save, + loading: snapshot.isLoading ?? false, + onPressed: () async { + _formKey.currentState!.save(); - engineer.personRoleId = suppEngRole?.id; + if (engineer.personName?.isEmpty ?? true) { + "Engineer supplier name is empty".showToast; + return; + } - 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); - }, + 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); + }, + ), ), - ), - 16.height, - ], + 16.height, + ], + ), ), - ), - ) - ], + ) + ], + ), ); } } From 16a79b039b753ca5c1ac3bf15f07047a3bd597f3 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Sun, 17 May 2026 16:06:44 +0300 Subject: [PATCH 2/2] improvements --- lib/modules/cm_module/cm_detail_page.dart | 8 +------- .../export_module/widgets/file_success_dialog.dart | 6 +++--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/modules/cm_module/cm_detail_page.dart b/lib/modules/cm_module/cm_detail_page.dart index 4af6c299..61135f6f 100644 --- a/lib/modules/cm_module/cm_detail_page.dart +++ b/lib/modules/cm_module/cm_detail_page.dart @@ -264,13 +264,7 @@ class _CMDetailPageState extends State { if (filePath != null) { // Show success dialog using the reusable FileSuccessDialog widget - await FileSuccessDialog.show( - context: context, - filePath: filePath, - title: 'Print Successful', - message: 'Your PDF has been generated successfully', - logPrefix: 'printed', - ); + await FileSuccessDialog.show(context: context, filePath: filePath, title: 'Export Successful', message: 'Your PDF has been generated successfully', logPrefix: 'printed'); } else if (exportProvider.errorMessage != null) { if (mounted) { exportProvider.errorMessage?.showToast; diff --git a/lib/modules/export_module/widgets/file_success_dialog.dart b/lib/modules/export_module/widgets/file_success_dialog.dart index 94b07e2f..015ff7e0 100644 --- a/lib/modules/export_module/widgets/file_success_dialog.dart +++ b/lib/modules/export_module/widgets/file_success_dialog.dart @@ -42,7 +42,7 @@ class FileSuccessDialog { Align( alignment: Alignment.topRight, child: 'clear'.toSvgAsset( - color: AppColor.iconColor(context), + color: AppColor.icon2Color(context), width: 18, height: 18, ).onPress(() { @@ -89,9 +89,9 @@ class FileSuccessDialog { } }, label: 'Open', - buttonColor: AppColor.primary10, + // buttonColor: AppColor.primary10, showIcon: true, - icon: const Icon(Icons.folder_open, color: Colors.white), + icon: Icon(Icons.folder_open, color: AppColor.background(context)), height: 48, ), ),