@ -48,6 +48,14 @@ class _RadiologyResultPageState extends State<RadiologyResultPage> {
super . initState ( ) ;
super . initState ( ) ;
}
}
@ override
void dispose ( ) {
/ / Clear AI analysis data when leaving the screen
radiologyViewModel . closeRadiologyAIAnalysis ( ) ;
radiologyViewModel . setIsRadiologyAIAnalysisNeedsToBeShown ( true ) ;
super . dispose ( ) ;
}
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
radiologyViewModel = Provider . of < RadiologyViewModel > ( context , listen: false ) ;
radiologyViewModel = Provider . of < RadiologyViewModel > ( context , listen: false ) ;
@ -80,198 +88,199 @@ class _RadiologyResultPageState extends State<RadiologyResultPage> {
} ) ;
} ) ;
return Column (
return Column (
children: [
children: [
Expanded (
Expanded (
child: CollapsingListView (
child: CollapsingListView (
title: LocaleKeys . radiologyResult . tr ( context: context ) ,
title: LocaleKeys . radiologyResult . tr ( context: context ) ,
downloadReport: ( ) async {
downloadReport: ( ) async {
LoaderBottomSheet . showLoader ( ) ;
LoaderBottomSheet . showLoader ( ) ;
await radiologyViewModel
await radiologyViewModel
. getRadiologyPDF (
. getRadiologyPDF (
patientRadiologyResponseModel: widget . patientRadiologyResponseModel ,
patientRadiologyResponseModel: widget . patientRadiologyResponseModel ,
authenticatedUser: _appState . getAuthenticatedUser ( ) ! ,
authenticatedUser: _appState . getAuthenticatedUser ( ) ! ,
onError: ( err ) {
onError: ( err ) {
LoaderBottomSheet . hideLoader ( ) ;
LoaderBottomSheet . hideLoader ( ) ;
showCommonBottomSheetWithoutHeight (
showCommonBottomSheetWithoutHeight (
context ,
context ,
child: Utils . getErrorWidget ( loadingText: err ) ,
child: Utils . getErrorWidget ( loadingText: err ) ,
callBackFunc: ( ) { } ,
callBackFunc: ( ) { } ,
isFullScreen: false ,
isFullScreen: false ,
isCloseButtonVisible: true ,
isCloseButtonVisible: true ,
) ;
) ;
} )
} )
. then ( ( val ) async {
. then ( ( val ) async {
LoaderBottomSheet . hideLoader ( ) ;
LoaderBottomSheet . hideLoader ( ) ;
if ( radiologyViewModel . patientRadiologyReportPDFBase64 . isNotEmpty ) {
if ( radiologyViewModel . patientRadiologyReportPDFBase64 . isNotEmpty ) {
String path = await Utils . createFileFromString ( radiologyViewModel . patientRadiologyReportPDFBase64 , " pdf " ) ;
String path = await Utils . createFileFromString ( radiologyViewModel . patientRadiologyReportPDFBase64 , " pdf " ) ;
try {
try {
OpenFilex . open ( path ) ;
OpenFilex . open ( path ) ;
} catch ( ex ) {
} catch ( ex ) {
showCommonBottomSheetWithoutHeight (
showCommonBottomSheetWithoutHeight (
context ,
context ,
child: Utils . getErrorWidget ( loadingText: " Cannot open file " ) ,
child: Utils . getErrorWidget ( loadingText: " Cannot open file " ) ,
callBackFunc: ( ) { } ,
callBackFunc: ( ) { } ,
isFullScreen: false ,
isFullScreen: false ,
isCloseButtonVisible: true ,
isCloseButtonVisible: true ,
) ;
) ;
}
}
}
}
} ) ;
} ) ;
} ,
} ,
/ / viewImage: ( ) {
/ / viewImage: ( ) {
/ / if ( radiologyViewModel . radiologyImageURL . isNotEmpty ) {
/ / if ( radiologyViewModel . radiologyImageURL . isNotEmpty ) {
/ / Uri uri = Uri . parse ( radiologyViewModel . radiologyImageURL ) ;
/ / Uri uri = Uri . parse ( radiologyViewModel . radiologyImageURL ) ;
/ / launchUrl ( uri , mode: LaunchMode . platformDefault , webOnlyWindowName: " " ) ;
/ / launchUrl ( uri , mode: LaunchMode . platformDefault , webOnlyWindowName: " " ) ;
/ / } else {
/ / } else {
/ / Utils . showToast ( " Radiology image not available " ) ;
/ / Utils . showToast ( " Radiology image not available " ) ;
/ / }
/ / }
/ / } ,
/ / } ,
child: SingleChildScrollView (
child: SingleChildScrollView (
child: Padding (
child: Padding (
padding: EdgeInsets . symmetric ( horizontal: 24. h ) ,
padding: EdgeInsets . symmetric ( horizontal: 24. h ) ,
child: Column (
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
children: [
SizedBox ( height: 24. h ) ,
SizedBox ( height: 24. h ) ,
Container (
Container (
decoration: RoundedRectangleBorder ( ) . toSmoothCornerDecoration (
decoration: RoundedRectangleBorder ( ) . toSmoothCornerDecoration (
color: AppColors . whiteColor ,
color: AppColors . whiteColor ,
borderRadius: 20. h ,
borderRadius: 20. h ,
hasShadow: true ,
hasShadow: true ,
) ,
) ,
child: Column (
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
children: [
SizedBox ( height: 16. h ) ,
SizedBox ( height: 16. h ) ,
/ / widget . patientRadiologyResponseModel . description ! . toText16 ( isBold: true ) ,
/ / widget . patientRadiologyResponseModel . description ! . toText16 ( isBold: true ) ,
SizedBox ( height: 8. h ) ,
SizedBox ( height: 8. h ) ,
Directionality (
Directionality (
textDirection: ui . TextDirection . ltr ,
textDirection: ui . TextDirection . ltr ,
child: widget . patientRadiologyResponseModel . reportData ! . trim ( ) . toText12 ( isBold: true , color: AppColors . textColorLight , isEnglishOnly: true ) ,
child: widget . patientRadiologyResponseModel . reportData ! . trim ( ) . toText12 ( isBold: true , color: AppColors . textColorLight , isEnglishOnly: true ) ,
) ,
) ,
SizedBox ( height: 16. h ) ,
SizedBox ( height: 16. h ) ,
/ / CustomButton (
/ / CustomButton (
/ / text: LocaleKeys . viewRadiologyImage . tr ( context: context ) ,
/ / text: LocaleKeys . viewRadiologyImage . tr ( context: context ) ,
/ / onPressed: ( ) async {
/ / onPressed: ( ) async {
/ / if ( radiologyViewModel . radiologyImageURL . isNotEmpty ) {
/ / if ( radiologyViewModel . radiologyImageURL . isNotEmpty ) {
/ / Uri uri = Uri . parse ( radiologyViewModel . radiologyImageURL ) ;
/ / Uri uri = Uri . parse ( radiologyViewModel . radiologyImageURL ) ;
/ / launchUrl ( uri , mode: LaunchMode . platformDefault , webOnlyWindowName: " " ) ;
/ / launchUrl ( uri , mode: LaunchMode . platformDefault , webOnlyWindowName: " " ) ;
/ / } else {
/ / } else {
/ / Utils . showToast ( " Radiology image not available " ) ;
/ / Utils . showToast ( " Radiology image not available " ) ;
/ / }
/ / }
/ / } ,
/ / } ,
/ / backgroundColor: AppColors . primaryRedColor ,
/ / backgroundColor: AppColors . primaryRedColor ,
/ / borderColor: AppColors . primaryRedColor ,
/ / borderColor: AppColors . primaryRedColor ,
/ / textColor: Colors . white ,
/ / textColor: Colors . white ,
/ / fontSize: 14 ,
/ / fontSize: 14 ,
/ / isBold: true ,
/ / isBold: true ,
/ / 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 . download ,
/ / icon: AppAssets . download ,
/ / iconColor: Colors . white ,
/ / iconColor: Colors . white ,
/ / iconSize: 20. h ,
/ / iconSize: 20. h ,
/ / ) ,
/ / ) ,
/ / SizedBox ( height: 16. h ) ,
/ / SizedBox ( height: 16. h ) ,
] ,
] ,
) . paddingSymmetrical ( 16. h , 0. h ) ,
) . paddingSymmetrical ( 16. h , 0. h ) ,
) ,
SizedBox ( height: 24. h ) ,
if ( radVM . radiologyAiAnalysisResponse ! = null )
RadiologyAiAnalysisWidget (
key: _aiAnalysisKey ,
data: radVM . radiologyAiAnalysisResponse ! ,
) ,
) ,
] ,
SizedBox ( height: 24. h ) ,
if ( radVM . radiologyAiAnalysisResponse ! = null )
RadiologyAiAnalysisWidget (
key: _aiAnalysisKey ,
data: radVM . radiologyAiAnalysisResponse ! ,
) ,
] ,
) ,
) ,
) ,
) ,
) ,
) ,
) ,
) ,
) ,
) ,
radVM . radiologyAiAnalysisResponse = = null
radVM . radiologyAiAnalysisResponse = = null
? Container (
? Container (
decoration: RoundedRectangleBorder ( ) . toSmoothCornerDecoration (
decoration: RoundedRectangleBorder ( ) . toSmoothCornerDecoration (
color: AppColors . whiteColor ,
color: AppColors . whiteColor ,
borderRadius: 24. h ,
borderRadius: 24. h ,
hasShadow: true ,
hasShadow: true ,
) ,
) ,
child: Column (
child: Column (
children: [
children: [
SizedBox ( height: 24. h ) ,
SizedBox ( height: 24. h ) ,
widget . patientRadiologyResponseModel . dIAPACSURL ! = " "
widget . patientRadiologyResponseModel . dIAPACSURL ! = " "
? CustomButton (
? CustomButton (
text: LocaleKeys . openRad . tr ( context: context ) ,
text: LocaleKeys . openRad . tr ( context: context ) ,
onPressed: ( ) async {
onPressed: ( ) async {
if ( radiologyViewModel . radiologyImageURL . isNotEmpty ) {
if ( radiologyViewModel . radiologyImageURL . isNotEmpty ) {
Uri uri = Uri . parse ( radiologyViewModel . radiologyImageURL ) ;
Uri uri = Uri . parse ( radiologyViewModel . radiologyImageURL ) ;
launchUrl ( uri , mode: LaunchMode . platformDefault , webOnlyWindowName: " " ) ;
launchUrl ( uri , mode: LaunchMode . platformDefault , webOnlyWindowName: " " ) ;
} else {
} else {
Utils . showToast ( " Radiology image not available " ) ;
Utils . showToast ( " Radiology image not available " ) ;
}
}
} ,
} ,
backgroundColor: AppColors . primaryRedColor ,
backgroundColor: AppColors . primaryRedColor ,
borderColor: AppColors . primaryRedColor ,
borderColor: AppColors . primaryRedColor ,
textColor: Colors . white ,
textColor: Colors . white ,
fontSize: 16 ,
fontSize: 16 ,
isBold: true ,
isBold: true ,
borderRadius: 12 ,
borderRadius: 12 ,
padding: EdgeInsets . fromLTRB ( 10 , 0 , 10 , 0 ) ,
padding: EdgeInsets . fromLTRB ( 10 , 0 , 10 , 0 ) ,
height: 56. h ,
height: 56. h ,
icon: AppAssets . imageIcon ,
icon: AppAssets . imageIcon ,
iconColor: Colors . white ,
iconColor: Colors . white ,
iconSize: 20. h ,
iconSize: 20. h ,
) . paddingSymmetrical ( 24. h , 0. h )
) . paddingSymmetrical ( 24. h , 0. h )
: SizedBox . shrink ( ) ,
: SizedBox . shrink ( ) ,
Container (
Container (
height: 56. h ,
height: 56. h ,
decoration: BoxDecoration (
decoration: BoxDecoration (
borderRadius: BorderRadius . circular ( 12. r ) ,
borderRadius: BorderRadius . circular ( 12. r ) ,
gradient: LinearGradient (
gradient: LinearGradient (
begin: Alignment . centerLeft ,
begin: Alignment . centerLeft ,
end: Alignment . centerRight ,
end: Alignment . centerRight ,
stops: [ 0.236 , 1.0 ] , / / 53.6 % and 100 %
stops: [ 0.236 , 1.0 ] , / / 53.6 % and 100 %
colors: [
colors: [
Color ( 0xFF8A38F5 ) , / / Transparent
Color ( 0xFF8A38F5 ) , / / Transparent
Color ( 0xFFE20BBB ) , / / Solid # F8F8F8
Color ( 0xFFE20BBB ) , / / Solid # F8F8F8
] ,
) ,
) ,
child: Row (
crossAxisAlignment: CrossAxisAlignment . center ,
mainAxisAlignment: MainAxisAlignment . center ,
children: [
Padding (
padding: EdgeInsets . only ( right: 4. w , left: 4. w ) ,
child: Utils . buildSvgWithAssets ( icon: AppAssets . aiOverView , width: 16. h , height: 16. h , iconColor: Colors . white ) ,
) ,
LocaleKeys . generateAiAnalysisRadResult . tr ( context: context ) . toText16 ( isBold: true , color: Colors . white )
] ,
] ,
) ,
) ,
) ,
) . paddingSymmetrical ( 24. h , 12. h ) . onPress ( ( ) async {
child: Row (
final _dialogService = getIt . get < DialogService > ( ) ;
crossAxisAlignment: CrossAxisAlignment . center ,
await _dialogService . showCommonBottomSheetWithoutH (
mainAxisAlignment: MainAxisAlignment . center ,
message: LocaleKeys . aiDisclaimer . tr ( ) ,
children: [
label: LocaleKeys . consent . tr ( ) ,
Padding (
okLabel: LocaleKeys . acceptLbl . tr ( ) ,
padding: EdgeInsets . only ( right: 4. w , left: 4. w ) ,
cancelLabel: LocaleKeys . rejectView . tr ( ) ,
child: Utils . buildSvgWithAssets ( icon: AppAssets . aiOverView , width: 16. h , height: 16. h , iconColor: Colors . white ) ,
onOkPressed: ( ) {
) ,
context . pop ( ) ;
LocaleKeys . generateAiAnalysisRadResult . tr ( context: context ) . toText16 ( isBold: true , color: Colors . white )
radiologyViewModel . getRadiologyAiAnalysis (
] ,
reportData: widget . patientRadiologyResponseModel . reportData ? ? " " ,
) ,
loadingText: LocaleKeys . loadingAIAnalysis . tr ( context: context ) ,
) . paddingSymmetrical ( 24. h , 12. h ) . onPress ( ( ) async {
langId: _appState . getLanguageID ( ) ,
final _dialogService = getIt . get < DialogService > ( ) ;
) ;
await _dialogService . showCommonBottomSheetWithoutH (
} ,
message: LocaleKeys . aiDisclaimer . tr ( ) ,
onCancelPressed: ( ) {
label: LocaleKeys . consent . tr ( ) ,
context . pop ( ) ;
okLabel: LocaleKeys . acceptLbl . tr ( ) ,
} ,
cancelLabel: LocaleKeys . rejectView . tr ( ) ,
) ;
onOkPressed: ( ) {
} ) ,
context . pop ( ) ;
] ,
radiologyViewModel . getRadiologyAiAnalysis (
) ,
reportData: widget . patientRadiologyResponseModel . reportData ? ? " " ,
)
loadingText: LocaleKeys . loadingAIAnalysis . tr ( context: context ) ,
: SizedBox . shrink ( ) ,
) ;
] ,
} ,
) ;
onCancelPressed: ( ) {
context . pop ( ) ;
} ,
) ;
} ) ,
] ,
) ,
)
: SizedBox . shrink ( ) ,
] ,
) ;
} ) ,
} ) ,
) ;
) ;
}
}