Merge branch 'master' into dev_aamir
# Conflicts: # lib/presentation/authentication/register_step2.dartpull/50/head
						commit
						8240d3e78d
					
				| @ -0,0 +1,4 @@ | ||||
| <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||||
|     <path fill-rule="evenodd" clip-rule="evenodd" d="M15.8333 3.99984C15.8333 3.26346 16.4303 2.6665 17.1667 2.6665H29.1667C29.903 2.6665 30.5 3.26346 30.5 3.99984C30.5 4.73622 29.903 5.33317 29.1667 5.33317L29.1667 23.3332C29.1667 26.6469 26.4804 29.3332 23.1667 29.3332C19.853 29.3332 17.1667 26.6469 17.1667 23.3332L17.1667 9.33405C17.1667 9.33376 17.1667 9.33434 17.1667 9.33405C17.1667 9.33376 17.1667 9.33259 17.1667 9.33229V5.33317C16.4303 5.33317 15.8333 4.73622 15.8333 3.99984ZM19.8333 7.99984V5.33317H26.5L26.5 13.0676C26.1378 13.317 25.8055 13.5125 25.4733 13.6324C25.0059 13.8012 24.5708 13.8095 24.0425 13.4925C22.6945 12.6837 21.4241 12.879 20.3715 13.4052C20.1897 13.4961 20.0098 13.5996 19.8333 13.7111V10.6665H22.5C23.2364 10.6665 23.8333 10.0695 23.8333 9.33317C23.8333 8.59679 23.2364 7.99984 22.5 7.99984H19.8333Z" fill="#2E3039"/> | ||||
|     <path d="M7.14104 12.6116C7.52794 12.2404 8.13873 12.2404 8.52562 12.6116L8.53329 12.6193C8.69353 12.7817 9.1478 13.2422 9.40228 13.5185C9.91854 14.0791 10.6087 14.8721 11.3012 15.7994C11.9917 16.7239 12.6985 17.8007 13.2361 18.9287C13.7693 20.0478 14.1667 21.2805 14.1667 22.4998C14.1667 24.7601 13.4124 26.4319 12.1558 27.5235C10.9246 28.5931 9.33325 28.9998 7.83333 28.9998C6.33342 28.9998 4.74203 28.5931 3.51084 27.5235C2.25425 26.4319 1.5 24.7601 1.5 22.4998C1.5 21.2805 1.89732 20.0478 2.4306 18.9287C2.96813 17.8007 3.67498 16.7239 4.36544 15.7994C5.05795 14.8721 5.74813 14.0791 6.26439 13.5185C6.51888 13.2422 6.97318 12.7817 7.1334 12.6193L7.14104 12.6116Z" fill="#2E3039"/> | ||||
| </svg> | ||||
| After Width: | Height: | Size: 1.6 KiB | 
| @ -0,0 +1,162 @@ | ||||
| import 'dart:async'; | ||||
| 
 | ||||
| import 'package:flutter/material.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/utils.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/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/presentation/lab/collapsing_list_view.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/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 { | ||||
|   RadiologyResultPage({super.key, required this.patientRadiologyResponseModel}); | ||||
| 
 | ||||
|   PatientRadiologyResponseModel patientRadiologyResponseModel; | ||||
| 
 | ||||
|   @override | ||||
|   State<RadiologyResultPage> createState() => _RadiologyResultPageState(); | ||||
| } | ||||
| 
 | ||||
| class _RadiologyResultPageState extends State<RadiologyResultPage> { | ||||
|   late RadiologyViewModel radiologyViewModel; | ||||
| 
 | ||||
|   @override | ||||
|   void initState() { | ||||
|     scheduleMicrotask(() { | ||||
|       radiologyViewModel.getRadiologyImage(patientRadiologyResponseModel: widget.patientRadiologyResponseModel); | ||||
|     }); | ||||
|     super.initState(); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     radiologyViewModel = Provider.of<RadiologyViewModel>(context); | ||||
|     AppState _appState = getIt.get<AppState>(); | ||||
|     return Scaffold( | ||||
|       backgroundColor: AppColors.bgScaffoldColor, | ||||
|       body: Column( | ||||
|         children: [ | ||||
|           Expanded( | ||||
|             child: CollapsingListView( | ||||
|               title: "Radiology Result".needTranslation, | ||||
|               child: SingleChildScrollView( | ||||
|                 child: Padding( | ||||
|                   padding: EdgeInsets.symmetric(horizontal: 24.h), | ||||
|                   child: Column( | ||||
|                     crossAxisAlignment: CrossAxisAlignment.start, | ||||
|                     children: [ | ||||
|                       SizedBox(height: 24.h), | ||||
|                       Container( | ||||
|                         decoration: RoundedRectangleBorder().toSmoothCornerDecoration( | ||||
|                           color: AppColors.whiteColor, | ||||
|                           borderRadius: 20.h, | ||||
|                           hasShadow: true, | ||||
|                         ), | ||||
|                         child: Column( | ||||
|                           crossAxisAlignment: CrossAxisAlignment.start, | ||||
|                           children: [ | ||||
|                             SizedBox(height: 16.h), | ||||
|                             widget.patientRadiologyResponseModel.description!.toText16(isBold: true), | ||||
|                             SizedBox(height: 8.h), | ||||
|                             widget.patientRadiologyResponseModel.reportData!.trim().toText12(isBold: true, color: AppColors.textColorLight), | ||||
|                             SizedBox(height: 16.h), | ||||
|                             CustomButton( | ||||
|                               text: "View Radiology Image".needTranslation, | ||||
|                               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, | ||||
|                               borderColor: AppColors.primaryRedColor, | ||||
|                               textColor: AppColors.whiteColor, | ||||
|                               fontSize: 14, | ||||
|                               fontWeight: FontWeight.w500, | ||||
|                               borderRadius: 12, | ||||
|                               padding: EdgeInsets.fromLTRB(10, 0, 10, 0), | ||||
|                               height: 40.h, | ||||
|                               icon: AppAssets.download, | ||||
|                               iconColor: AppColors.whiteColor, | ||||
|                               iconSize: 20.h, | ||||
|                             ), | ||||
|                             SizedBox(height: 16.h), | ||||
|                           ], | ||||
|                         ).paddingSymmetrical(16.h, 0.h), | ||||
|                       ), | ||||
|                       SizedBox(height: 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), | ||||
|           ), | ||||
|         ], | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
					Loading…
					
					
				
		Reference in New Issue