|  |  |  | @ -2,6 +2,7 @@ import 'package:easy_localization/easy_localization.dart' | 
		
	
		
			
				|  |  |  |  |     show tr, StringTranslateExtension; | 
		
	
		
			
				|  |  |  |  | import 'package:flutter/material.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:hmg_patient_app_new/core/app_assets.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; | 
		
	
	
		
			
				
					|  |  |  | @ -12,58 +13,119 @@ import 'package:hmg_patient_app_new/presentation/lab/lab_result_via_hospital/Lab | 
		
	
		
			
				|  |  |  |  | import 'package:hmg_patient_app_new/presentation/lab/lab_result_via_hospital/lab_order_specialResult.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:hmg_patient_app_new/theme/colors.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:provider/provider.dart'; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | class LabResultByHospitals extends StatelessWidget { | 
		
	
		
			
				|  |  |  |  |   @override | 
		
	
		
			
				|  |  |  |  |   Widget build(BuildContext context) { | 
		
	
		
			
				|  |  |  |  |     return CollapsingListView( | 
		
	
		
			
				|  |  |  |  |         title: LocaleKeys.labResults.tr(), | 
		
	
		
			
				|  |  |  |  |         child: SingleChildScrollView( | 
		
	
		
			
				|  |  |  |  |           child: Column( | 
		
	
		
			
				|  |  |  |  |             spacing: 8.h, | 
		
	
		
			
				|  |  |  |  |             crossAxisAlignment: CrossAxisAlignment.start, | 
		
	
		
			
				|  |  |  |  |             children: [ | 
		
	
		
			
				|  |  |  |  |               Selector<LabViewModel, bool>( | 
		
	
		
			
				|  |  |  |  |                 selector: (_, model) => model.isLabResultByHospitalLoading, | 
		
	
		
			
				|  |  |  |  |                 builder: (_, isLoading, __) { | 
		
	
		
			
				|  |  |  |  |                   if (isLoading) { | 
		
	
		
			
				|  |  |  |  |                     return Column( | 
		
	
		
			
				|  |  |  |  |                       children: [ | 
		
	
		
			
				|  |  |  |  |                         LabResultItemView( | 
		
	
		
			
				|  |  |  |  |                           onTap: () {}, | 
		
	
		
			
				|  |  |  |  |                           labOrder: null, | 
		
	
		
			
				|  |  |  |  |                           index: 0, | 
		
	
		
			
				|  |  |  |  |                           isLoading: true, | 
		
	
		
			
				|  |  |  |  |                         ), | 
		
	
		
			
				|  |  |  |  |                         LabResultItemView( | 
		
	
		
			
				|  |  |  |  |                           onTap: () {}, | 
		
	
		
			
				|  |  |  |  |                           labOrder: null, | 
		
	
		
			
				|  |  |  |  |                           index: 0, | 
		
	
		
			
				|  |  |  |  |                           isLoading: true, | 
		
	
		
			
				|  |  |  |  |                         ), | 
		
	
		
			
				|  |  |  |  |                         LabResultItemView( | 
		
	
		
			
				|  |  |  |  |                           onTap: () {}, | 
		
	
		
			
				|  |  |  |  |                           labOrder: null, | 
		
	
		
			
				|  |  |  |  |                           index: 0, | 
		
	
		
			
				|  |  |  |  |                           isLoading: true, | 
		
	
		
			
				|  |  |  |  |                         ), | 
		
	
		
			
				|  |  |  |  |                         LabResultItemView( | 
		
	
		
			
				|  |  |  |  |                           onTap: () {}, | 
		
	
		
			
				|  |  |  |  |                           labOrder: null, | 
		
	
		
			
				|  |  |  |  |                           index: 0, | 
		
	
		
			
				|  |  |  |  |                           isLoading: true, | 
		
	
		
			
				|  |  |  |  |                         ), | 
		
	
		
			
				|  |  |  |  |                       ], | 
		
	
		
			
				|  |  |  |  |                     ); | 
		
	
		
			
				|  |  |  |  |                   } else { | 
		
	
		
			
				|  |  |  |  |                     return LabResultList(); | 
		
	
		
			
				|  |  |  |  |                   } | 
		
	
		
			
				|  |  |  |  |                 }, | 
		
	
		
			
				|  |  |  |  |               ), | 
		
	
		
			
				|  |  |  |  |               LabOrderSpecialResult() | 
		
	
		
			
				|  |  |  |  |             ], | 
		
	
		
			
				|  |  |  |  |           ).paddingAll(24.h), | 
		
	
		
			
				|  |  |  |  |         )); | 
		
	
		
			
				|  |  |  |  |     return Scaffold( | 
		
	
		
			
				|  |  |  |  |       backgroundColor: AppColors.bgScaffoldColor, | 
		
	
		
			
				|  |  |  |  |       body: Column( | 
		
	
		
			
				|  |  |  |  |         children: [ | 
		
	
		
			
				|  |  |  |  |           Expanded( | 
		
	
		
			
				|  |  |  |  |             child: CollapsingListView( | 
		
	
		
			
				|  |  |  |  |                 title: LocaleKeys.labResults.tr(), | 
		
	
		
			
				|  |  |  |  |                 child: SingleChildScrollView( | 
		
	
		
			
				|  |  |  |  |                   child: Column( | 
		
	
		
			
				|  |  |  |  |                     spacing: 8.h, | 
		
	
		
			
				|  |  |  |  |                     crossAxisAlignment: CrossAxisAlignment.start, | 
		
	
		
			
				|  |  |  |  |                     children: [ | 
		
	
		
			
				|  |  |  |  |                       Selector<LabViewModel, bool>( | 
		
	
		
			
				|  |  |  |  |                         selector: (_, model) => model.isLabResultByHospitalLoading, | 
		
	
		
			
				|  |  |  |  |                         builder: (_, isLoading, __) { | 
		
	
		
			
				|  |  |  |  |                           if (isLoading) { | 
		
	
		
			
				|  |  |  |  |                             return Column( | 
		
	
		
			
				|  |  |  |  |                               children: [ | 
		
	
		
			
				|  |  |  |  |                                 LabResultItemView( | 
		
	
		
			
				|  |  |  |  |                                   onTap: () {}, | 
		
	
		
			
				|  |  |  |  |                                   labOrder: null, | 
		
	
		
			
				|  |  |  |  |                                   index: 0, | 
		
	
		
			
				|  |  |  |  |                                   isLoading: true, | 
		
	
		
			
				|  |  |  |  |                                 ), | 
		
	
		
			
				|  |  |  |  |                                 LabResultItemView( | 
		
	
		
			
				|  |  |  |  |                                   onTap: () {}, | 
		
	
		
			
				|  |  |  |  |                                   labOrder: null, | 
		
	
		
			
				|  |  |  |  |                                   index: 0, | 
		
	
		
			
				|  |  |  |  |                                   isLoading: true, | 
		
	
		
			
				|  |  |  |  |                                 ), | 
		
	
		
			
				|  |  |  |  |                                 LabResultItemView( | 
		
	
		
			
				|  |  |  |  |                                   onTap: () {}, | 
		
	
		
			
				|  |  |  |  |                                   labOrder: null, | 
		
	
		
			
				|  |  |  |  |                                   index: 0, | 
		
	
		
			
				|  |  |  |  |                                   isLoading: true, | 
		
	
		
			
				|  |  |  |  |                                 ), | 
		
	
		
			
				|  |  |  |  |                                 LabResultItemView( | 
		
	
		
			
				|  |  |  |  |                                   onTap: () {}, | 
		
	
		
			
				|  |  |  |  |                                   labOrder: null, | 
		
	
		
			
				|  |  |  |  |                                   index: 0, | 
		
	
		
			
				|  |  |  |  |                                   isLoading: true, | 
		
	
		
			
				|  |  |  |  |                                 ), | 
		
	
		
			
				|  |  |  |  |                               ], | 
		
	
		
			
				|  |  |  |  |                             ); | 
		
	
		
			
				|  |  |  |  |                           } else { | 
		
	
		
			
				|  |  |  |  |                             return LabResultList(); | 
		
	
		
			
				|  |  |  |  |                           } | 
		
	
		
			
				|  |  |  |  |                         }, | 
		
	
		
			
				|  |  |  |  |                       ), | 
		
	
		
			
				|  |  |  |  |                       LabOrderSpecialResult() | 
		
	
		
			
				|  |  |  |  |                     ], | 
		
	
		
			
				|  |  |  |  |                   ).paddingAll(24.h), | 
		
	
		
			
				|  |  |  |  |                 )), | 
		
	
		
			
				|  |  |  |  |           ), | 
		
	
		
			
				|  |  |  |  |           Container( | 
		
	
		
			
				|  |  |  |  |             decoration: RoundedRectangleBorder().toSmoothCornerDecoration( | 
		
	
		
			
				|  |  |  |  |               color: AppColors.whiteColor, | 
		
	
		
			
				|  |  |  |  |               borderRadius: 24.h, | 
		
	
		
			
				|  |  |  |  |               hasShadow: true, | 
		
	
		
			
				|  |  |  |  |             ), | 
		
	
		
			
				|  |  |  |  |             child: CustomButton( | 
		
	
		
			
				|  |  |  |  |               text: "Download report".needTranslation, | 
		
	
		
			
				|  |  |  |  |               onPressed: () async { | 
		
	
		
			
				|  |  |  |  |                 // LoaderBottomSheet.showLoader(); | 
		
	
		
			
				|  |  |  |  |                 // await radiologyViewModel.getRadiologyPDF(patientRadiologyResponseModel: widget.patientRadiologyResponseModel, authenticatedUser: _appState.getAuthenticatedUser()!, onError: (err) { | 
		
	
		
			
				|  |  |  |  |                 //   LoaderBottomSheet.hideLoader(); | 
		
	
		
			
				|  |  |  |  |                 //   showCommonBottomSheetWithoutHeight( | 
		
	
		
			
				|  |  |  |  |                 //     context, | 
		
	
		
			
				|  |  |  |  |                 //     child: Utils.getErrorWidget(loadingText: err), | 
		
	
		
			
				|  |  |  |  |                 //     callBackFunc: () {}, | 
		
	
		
			
				|  |  |  |  |                 //     isFullScreen: false, | 
		
	
		
			
				|  |  |  |  |                 //     isCloseButtonVisible: true, | 
		
	
		
			
				|  |  |  |  |                 //   ); | 
		
	
		
			
				|  |  |  |  |                 // }).then((val) async { | 
		
	
		
			
				|  |  |  |  |                 //   LoaderBottomSheet.hideLoader(); | 
		
	
		
			
				|  |  |  |  |                 //   if (radiologyViewModel.patientRadiologyReportPDFBase64.isNotEmpty) { | 
		
	
		
			
				|  |  |  |  |                 //     String path = await Utils.createFileFromString(radiologyViewModel.patientRadiologyReportPDFBase64, "pdf"); | 
		
	
		
			
				|  |  |  |  |                 //     try { | 
		
	
		
			
				|  |  |  |  |                 //       OpenFilex.open(path); | 
		
	
		
			
				|  |  |  |  |                 //     } catch (ex) { | 
		
	
		
			
				|  |  |  |  |                 //       showCommonBottomSheetWithoutHeight( | 
		
	
		
			
				|  |  |  |  |                 //         context, | 
		
	
		
			
				|  |  |  |  |                 //         child: Utils.getErrorWidget(loadingText: "Cannot open file".needTranslation), | 
		
	
		
			
				|  |  |  |  |                 //         callBackFunc: () {}, | 
		
	
		
			
				|  |  |  |  |                 //         isFullScreen: false, | 
		
	
		
			
				|  |  |  |  |                 //         isCloseButtonVisible: true, | 
		
	
		
			
				|  |  |  |  |                 //       ); | 
		
	
		
			
				|  |  |  |  |                 //     } | 
		
	
		
			
				|  |  |  |  |                 //   } | 
		
	
		
			
				|  |  |  |  |                 // }); | 
		
	
		
			
				|  |  |  |  |               }, | 
		
	
		
			
				|  |  |  |  |               backgroundColor: AppColors.successColor, | 
		
	
		
			
				|  |  |  |  |               borderColor: AppColors.successColor, | 
		
	
		
			
				|  |  |  |  |               textColor: AppColors.whiteColor, | 
		
	
		
			
				|  |  |  |  |               fontSize: 16, | 
		
	
		
			
				|  |  |  |  |               fontWeight: FontWeight.w500, | 
		
	
		
			
				|  |  |  |  |               borderRadius: 12, | 
		
	
		
			
				|  |  |  |  |               padding: EdgeInsets.fromLTRB(10, 0, 10, 0), | 
		
	
		
			
				|  |  |  |  |               height: 45.h, | 
		
	
		
			
				|  |  |  |  |               icon: AppAssets.download, | 
		
	
		
			
				|  |  |  |  |               iconColor: AppColors.whiteColor, | 
		
	
		
			
				|  |  |  |  |               iconSize: 20.h, | 
		
	
		
			
				|  |  |  |  |             ).paddingSymmetrical(24.h, 24.h), | 
		
	
		
			
				|  |  |  |  |           ), | 
		
	
		
			
				|  |  |  |  |         ], | 
		
	
		
			
				|  |  |  |  |       ), | 
		
	
		
			
				|  |  |  |  |     ); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | } | 
		
	
	
		
			
				
					|  |  |  | 
 |