|  |  | @ -1,13 +1,24 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import 'dart:async'; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import 'package:flutter/material.dart'; |  |  |  | import 'package:flutter/material.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import 'package:hmg_patient_app_new/core/app_assets.dart'; |  |  |  | import 'package:hmg_patient_app_new/core/app_assets.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import 'package:hmg_patient_app_new/core/app_state.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import 'package:hmg_patient_app_new/core/dependencies.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; |  |  |  | import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import 'package:hmg_patient_app_new/core/utils/utils.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; |  |  |  | import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; |  |  |  | import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import 'package:hmg_patient_app_new/features/radiology/models/resp_models/patient_radiology_response_model.dart'; |  |  |  | import 'package:hmg_patient_app_new/features/radiology/models/resp_models/patient_radiology_response_model.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import 'package:hmg_patient_app_new/features/radiology/radiology_view_model.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; |  |  |  | import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import 'package:hmg_patient_app_new/presentation/lab/collapsing_list_view.dart'; |  |  |  | import 'package:hmg_patient_app_new/presentation/lab/collapsing_list_view.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import 'package:hmg_patient_app_new/theme/colors.dart'; |  |  |  | import 'package:hmg_patient_app_new/theme/colors.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; |  |  |  | import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import 'package:open_filex/open_filex.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import 'package:provider/provider.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import 'package:url_launcher/url_launcher.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | class RadiologyResultPage extends StatefulWidget { |  |  |  | class RadiologyResultPage extends StatefulWidget { | 
			
		
	
		
		
			
				
					
					|  |  |  |   RadiologyResultPage({super.key, required this.patientRadiologyResponseModel}); |  |  |  |   RadiologyResultPage({super.key, required this.patientRadiologyResponseModel}); | 
			
		
	
	
		
		
			
				
					|  |  | @ -19,11 +30,26 @@ class RadiologyResultPage extends StatefulWidget { | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | class _RadiologyResultPageState extends State<RadiologyResultPage> { |  |  |  | class _RadiologyResultPageState extends State<RadiologyResultPage> { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   late RadiologyViewModel radiologyViewModel; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   @override | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   void initState() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     scheduleMicrotask(() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       radiologyViewModel.getRadiologyImage(patientRadiologyResponseModel: widget.patientRadiologyResponseModel); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     }); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     super.initState(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   @override |  |  |  |   @override | 
			
		
	
		
		
			
				
					
					|  |  |  |   Widget build(BuildContext context) { |  |  |  |   Widget build(BuildContext context) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     radiologyViewModel = Provider.of<RadiologyViewModel>(context); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     AppState _appState = getIt.get<AppState>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |     return Scaffold( |  |  |  |     return Scaffold( | 
			
		
	
		
		
			
				
					
					|  |  |  |       backgroundColor: AppColors.bgScaffoldColor, |  |  |  |       backgroundColor: AppColors.bgScaffoldColor, | 
			
		
	
		
		
			
				
					
					|  |  |  |       body: CollapsingListView( |  |  |  |       body: Column( | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         children: [ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           Expanded( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             child: CollapsingListView( | 
			
		
	
		
		
			
				
					
					|  |  |  |               title: "Radiology Result".needTranslation, |  |  |  |               title: "Radiology Result".needTranslation, | 
			
		
	
		
		
			
				
					
					|  |  |  |               child: SingleChildScrollView( |  |  |  |               child: SingleChildScrollView( | 
			
		
	
		
		
			
				
					
					|  |  |  |                 child: Padding( |  |  |  |                 child: Padding( | 
			
		
	
	
		
		
			
				
					|  |  | @ -48,7 +74,14 @@ class _RadiologyResultPageState extends State<RadiologyResultPage> { | 
			
		
	
		
		
			
				
					
					|  |  |  |                             SizedBox(height: 16.h), |  |  |  |                             SizedBox(height: 16.h), | 
			
		
	
		
		
			
				
					
					|  |  |  |                             CustomButton( |  |  |  |                             CustomButton( | 
			
		
	
		
		
			
				
					
					|  |  |  |                               text: "View Radiology Image".needTranslation, |  |  |  |                               text: "View Radiology Image".needTranslation, | 
			
		
	
		
		
			
				
					
					|  |  |  |                         onPressed: () async {}, |  |  |  |                               onPressed: () async { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 if (radiologyViewModel.radiologyImageURL.isNotEmpty) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                   Uri uri = Uri.parse(radiologyViewModel.radiologyImageURL); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                   launchUrl(uri, mode: LaunchMode.platformDefault, webOnlyWindowName: ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                   Utils.showToast("Radiology image not available".needTranslation); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                               }, | 
			
		
	
		
		
			
				
					
					|  |  |  |                               backgroundColor: AppColors.primaryRedColor, |  |  |  |                               backgroundColor: AppColors.primaryRedColor, | 
			
		
	
		
		
			
				
					
					|  |  |  |                               borderColor: AppColors.primaryRedColor, |  |  |  |                               borderColor: AppColors.primaryRedColor, | 
			
		
	
		
		
			
				
					
					|  |  |  |                               textColor: AppColors.whiteColor, |  |  |  |                               textColor: AppColors.whiteColor, | 
			
		
	
	
		
		
			
				
					|  |  | @ -57,7 +90,7 @@ class _RadiologyResultPageState extends State<RadiologyResultPage> { | 
			
		
	
		
		
			
				
					
					|  |  |  |                               borderRadius: 12, |  |  |  |                               borderRadius: 12, | 
			
		
	
		
		
			
				
					
					|  |  |  |                               padding: EdgeInsets.fromLTRB(10, 0, 10, 0), |  |  |  |                               padding: EdgeInsets.fromLTRB(10, 0, 10, 0), | 
			
		
	
		
		
			
				
					
					|  |  |  |                               height: 40.h, |  |  |  |                               height: 40.h, | 
			
		
	
		
		
			
				
					
					|  |  |  |                         icon: AppAssets.calendar, |  |  |  |                               icon: AppAssets.download, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                               iconColor: AppColors.whiteColor, |  |  |  |                               iconColor: AppColors.whiteColor, | 
			
		
	
		
		
			
				
					
					|  |  |  |                               iconSize: 20.h, |  |  |  |                               iconSize: 20.h, | 
			
		
	
		
		
			
				
					
					|  |  |  |                             ), |  |  |  |                             ), | 
			
		
	
	
		
		
			
				
					|  |  | @ -71,6 +104,59 @@ class _RadiologyResultPageState extends State<RadiologyResultPage> { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 ), |  |  |  |                 ), | 
			
		
	
		
		
			
				
					
					|  |  |  |               ), |  |  |  |               ), | 
			
		
	
		
		
			
				
					
					|  |  |  |             ), |  |  |  |             ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           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), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ], | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       ), | 
			
		
	
		
		
			
				
					
					|  |  |  |     ); |  |  |  |     ); | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |