From 1d4ed83a4b792b8a6c6f6baa63145809d4c4c292 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Tue, 18 Aug 2026 11:50:18 +0300 Subject: [PATCH] asset open to details screen --- .../ppm_wo/update_ppm/wo_info_form.dart | 26 ++++++------------- lib/views/widgets/equipment/asset_picker.dart | 15 +++-------- 2 files changed, 12 insertions(+), 29 deletions(-) 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 c206bef0..ce4e2de4 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 @@ -32,6 +32,7 @@ import 'package:test_sa/providers/ppm_task_status_provider.dart'; import 'package:test_sa/views/widgets/bottom_sheets/asset_detail_bottom_sheet.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/equipment/asset_detail_page.dart'; import 'package:test_sa/views/widgets/images/multi_image_picker.dart'; import 'package:test_sa/views/widgets/item_views/info_header_widget.dart'; import 'package:test_sa/views/widgets/item_views/info_text_widget.dart'; @@ -61,7 +62,10 @@ class _WoInfoFormState extends State { calculateWorkingTime(); if (widget.planPreventiveVisit.preventiveVisitAttachments != null && widget.planPreventiveVisit.preventiveVisitAttachments!.isNotEmpty) { ppmProvider.ppmPlanAttachments = []; - ppmProvider.ppmPlanAttachments.addAll(widget.planPreventiveVisit.preventiveVisitAttachments!.whereType().map((e) => GenericAttachmentModel(id: e.id, name: e.name ?? '',documentType: e.documentType)).toList()); + ppmProvider.ppmPlanAttachments.addAll(widget.planPreventiveVisit.preventiveVisitAttachments! + .whereType() + .map((e) => GenericAttachmentModel(id: e.id, name: e.name ?? '', documentType: e.documentType)) + .toList()); } }); @@ -156,23 +160,9 @@ class _WoInfoFormState extends State { children: [ InfoHeader16Widget(widget.planPreventiveVisit.assetName ?? '').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... - showModalBottomSheet( - context: context, - backgroundColor: AppColor.bottomSheetColor(context), - isScrollControlled: true, - // shape: const RoundedRectangleBorder( - // borderRadius: BorderRadius.vertical( - // top: Radius.circular(20), - // ), - // ), - clipBehavior: Clip.antiAliasWithSaveLayer, - builder: (BuildContext context) => _buildAssetDetailBottomSheet(context), - ); - }, - ) + const Icon(Icons.open_in_new_rounded, color: AppColor.primary10, size: 20).onPress(() { + Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: widget.planPreventiveVisit.asset!.id); + }), ], ), // 2.height, diff --git a/lib/views/widgets/equipment/asset_picker.dart b/lib/views/widgets/equipment/asset_picker.dart index 9088ad37..762adac9 100644 --- a/lib/views/widgets/equipment/asset_picker.dart +++ b/lib/views/widgets/equipment/asset_picker.dart @@ -10,6 +10,7 @@ import 'package:test_sa/views/widgets/qr/asset_scan_qr.dart'; import '../../../models/device/asset.dart'; import '../../../new_views/app_style/app_color.dart'; +import 'asset_detail_page.dart'; class AssetPicker extends StatelessWidget { final Function(Asset)? onPick; @@ -185,21 +186,13 @@ class AssetPicker extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ InfoHeaderWidget( device.modelDefinition?.assetName?.cleanupWhitespace.capitalizeFirstOfEach ?? "", ).toShimmer(isShow: showLoading, context: context).expanded, - Icon(Icons.info, color: AppColor.icon2Color(context), size: 20).onPress(() { - showModalBottomSheet( - context: context, - isScrollControlled: true, - backgroundColor: AppColor.bottomSheetColor(context), - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.vertical(top: Radius.circular(20)), - ), - clipBehavior: Clip.antiAliasWithSaveLayer, - builder: (BuildContext context) => AssetDetailBottomSheet(device), - ); + const Icon(Icons.open_in_new_rounded, color: AppColor.primary10, size: 20).onPress(() { + Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: device.id); }), if (multiSelection) ...[ 4.width,