Merge pull request 'lang id to lab ai analysis & radiology ai analysis' (#217) from dev_aamir into master

Reviewed-on: https://34.17.182.140/Haroon6138/HMG_Patient_App_New/pulls/217
master
Haroon6138 18 hours ago
commit 909bbab48b

@ -26,9 +26,9 @@ abstract class LabRepo {
Future<Either<Failure, GenericApiModel<dynamic>>> getLabResultsByAppointmentNo({required num appointmentNo, required num projectID, required num clinicID}); Future<Either<Failure, GenericApiModel<dynamic>>> getLabResultsByAppointmentNo({required num appointmentNo, required num projectID, required num clinicID});
Future<Either<Failure, GenericApiModel<LabOrdersResponseByAi>>> getPatientAiOverViewLabOrders(var payload); Future<Either<Failure, GenericApiModel<LabOrdersResponseByAi>>> getPatientAiOverViewLabOrders({required int langId, required dynamic payload});
Future<Either<Failure, GenericApiModel<LabOrderResponseByAi>>> getPatientAiOverViewLabOrder(var payload); Future<Either<Failure, GenericApiModel<LabOrderResponseByAi>>> getPatientAiOverViewLabOrder(var payloa);
} }
class LabRepoImp implements LabRepo { class LabRepoImp implements LabRepo {
@ -358,7 +358,7 @@ class LabRepoImp implements LabRepo {
} }
@override @override
Future<Either<Failure, GenericApiModel<LabOrdersResponseByAi>>> getPatientAiOverViewLabOrders(var labOrder) async { Future<Either<Failure, GenericApiModel<LabOrdersResponseByAi>>> getPatientAiOverViewLabOrders({required int langId, required dynamic payload}) async {
try { try {
GenericApiModel<LabOrdersResponseByAi>? apiResponse; GenericApiModel<LabOrdersResponseByAi>? apiResponse;
Failure? failure; Failure? failure;
@ -372,7 +372,7 @@ class LabRepoImp implements LabRepo {
'X-API-KEY': '9d9d2ac4c1fc302299dbb0fbb1b7fea1', 'X-API-KEY': '9d9d2ac4c1fc302299dbb0fbb1b7fea1',
'accept': 'application/json', 'accept': 'application/json',
}, },
body: {"lab_results": labOrder}, body: {"lab_results": payload, "language_id": langId},
onFailure: (error, statusCode, {messageStatus, failureType}) { onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType; failure = failureType;
}, },

@ -447,20 +447,19 @@ class LabViewModel extends ChangeNotifier {
minY = resultValue; minY = resultValue;
} }
// if (highRefrenceValue < double.parse(element.referenceHigh ?? "0.0")) { // if (highRefrenceValue < double.parse(element.referenceHigh ?? "0.0")) {
highRefrenceValue = double.parse(element.referenceHigh ?? "0.0"); highRefrenceValue = double.parse(element.referenceHigh ?? "0.0");
flagForHighReferenceRange = element.calculatedResultFlag; flagForHighReferenceRange = element.calculatedResultFlag;
// } // }
// if (lowRefenceValue > double.parse(element.referenceLow ?? "0.0")) { // if (lowRefenceValue > double.parse(element.referenceLow ?? "0.0")) {
lowRefenceValue = double.parse(element.referenceLow ?? "0.0"); lowRefenceValue = double.parse(element.referenceLow ?? "0.0");
flagForLowReferenceRange = element.calculatedResultFlag; flagForLowReferenceRange = element.calculatedResultFlag;
// } // }
if(double.parse(element.referenceHigh ?? "0.0") == 0 ){ if (double.parse(element.referenceHigh ?? "0.0") == 0) {
highRefrenceValue = double.negativeInfinity; highRefrenceValue = double.negativeInfinity;
} }
if (double.parse(element.referenceLow ?? "0.0") == 0) {
if(double.parse(element.referenceLow ?? "0.0") == 0 ){
lowRefenceValue = double.negativeInfinity; lowRefenceValue = double.negativeInfinity;
} }
@ -473,18 +472,16 @@ class LabViewModel extends ChangeNotifier {
time: DateUtil.convertStringToDate(element.verifiedOnDateTime), time: DateUtil.convertStringToDate(element.verifiedOnDateTime),
referenceValue: element.calculatedResultFlag ?? "", referenceValue: element.calculatedResultFlag ?? "",
)); ));
} catch (e) {}
} catch (e) {
}
}); });
if (flagForLowReferenceRange == null && flagForHighReferenceRange == null) { if (flagForLowReferenceRange == null && flagForHighReferenceRange == null) {
highRefrenceValue = maxY; highRefrenceValue = maxY;
lowRefenceValue = minY; lowRefenceValue = minY;
} }
// //
if (lowRefenceValue != double.negativeInfinity &&minY > lowRefenceValue) { if (lowRefenceValue != double.negativeInfinity && minY > lowRefenceValue) {
minY = lowRefenceValue - getInterval(); minY = lowRefenceValue - getInterval();
}else if (highRefrenceValue != double.negativeInfinity && minY > highRefrenceValue) { } else if (highRefrenceValue != double.negativeInfinity && minY > highRefrenceValue) {
minY = highRefrenceValue - getInterval(); minY = highRefrenceValue - getInterval();
} }
@ -494,17 +491,16 @@ class LabViewModel extends ChangeNotifier {
lowTransformedReferenceValue = double.parse(transformValueInRange(lowRefenceValue, flagForLowReferenceRange ?? "").toStringAsFixed(1)); lowTransformedReferenceValue = double.parse(transformValueInRange(lowRefenceValue, flagForLowReferenceRange ?? "").toStringAsFixed(1));
this.highRefrenceValue = double.parse(highRefrenceValue.toStringAsFixed(2)); this.highRefrenceValue = double.parse(highRefrenceValue.toStringAsFixed(2));
this.lowRefenceValue = double.parse(lowRefenceValue.toStringAsFixed(2)); this.lowRefenceValue = double.parse(lowRefenceValue.toStringAsFixed(2));
if(highRefrenceValue != double.negativeInfinity &&maxY<highRefrenceValue){ if (highRefrenceValue != double.negativeInfinity && maxY < highRefrenceValue) {
maxY = highRefrenceValue+ getInterval(); maxY = highRefrenceValue + getInterval();
maxX = maxY; maxX = maxY;
}else if(lowRefenceValue != double.negativeInfinity && maxY<lowRefenceValue){ } else if (lowRefenceValue != double.negativeInfinity && maxY < lowRefenceValue) {
maxY = lowRefenceValue+ getInterval()/2; maxY = lowRefenceValue + getInterval() / 2;
maxX = maxY; maxX = maxY;
} }
// if (maxY < highRefrenceValue) { // if (maxY < highRefrenceValue) {
// minY = highRefrenceValue - getInterval(); // minY = highRefrenceValue - getInterval();
// } // }
@ -530,15 +526,16 @@ class LabViewModel extends ChangeNotifier {
bool isNumeric(String s) { bool isNumeric(String s) {
return num.tryParse(s) != null; return num.tryParse(s) != null;
} }
num getInterval() { num getInterval() {
// return .1; // return .1;
var maxX = maxY; var maxX = maxY;
if(maxX<1) return .2; if (maxX < 1) return .2;
if(maxX >=1.0 && maxX < 5.0) return .3; if (maxX >= 1.0 && maxX < 5.0) return .3;
if(maxX >=5.0 && maxX < 10.0) return 1.5; if (maxX >= 5.0 && maxX < 10.0) return 1.5;
if(maxX >=10.0 && maxX < 50.0) return 2.5; if (maxX >= 10.0 && maxX < 50.0) return 2.5;
if(maxX >=50.0 && maxX < 100.0) return 5; if (maxX >= 50.0 && maxX < 100.0) return 5;
if(maxX >=100.0 && maxX < 200.0) return 10; if (maxX >= 100.0 && maxX < 200.0) return 10;
return 15; return 15;
} }
@ -617,7 +614,7 @@ class LabViewModel extends ChangeNotifier {
rangeStart = 40.0; rangeStart = 40.0;
rangeEnd = 59.0; rangeEnd = 59.0;
break; break;
// throw ArgumentError('Invalid flag: $flag'); // throw ArgumentError('Invalid flag: $flag');
} }
// Clamp input value to 0-100 and map it to the range bounds // Clamp input value to 0-100 and map it to the range bounds
@ -845,9 +842,7 @@ class LabViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
Future<void> getAiOverviewLabOrders({required PatientLabOrdersResponseModel labOrder, required String loadingText}) async { Future<void> getAiOverviewLabOrders({required int langId, required PatientLabOrdersResponseModel labOrder, required String loadingText}) async {
// LoadingUtils.showFullScreenLoader(loadingText: "Loading and analysing your data,\nPlease be patient and let the AI do the magic. \nPlease be patient, This might take some time.");
// LoadingUtils.showFullScreenLoader(loadingText: loadingText);
isLabAIAnalysisNeedsToBeShown = true; isLabAIAnalysisNeedsToBeShown = true;
notifyListeners(); notifyListeners();
@ -875,7 +870,8 @@ class LabViewModel extends ChangeNotifier {
} }
orderData["results"] = testResults; orderData["results"] = testResults;
results.add(orderData); results.add(orderData);
final result = await labRepo.getPatientAiOverViewLabOrders(results);
final result = await labRepo.getPatientAiOverViewLabOrders(payload: results, langId: langId);
result.fold( result.fold(
(failure) async { (failure) async {
LoaderBottomSheet.hideLoader(); LoaderBottomSheet.hideLoader();
@ -903,7 +899,7 @@ class LabViewModel extends ChangeNotifier {
// LoadingUtils.hideFullScreenLoader(); // LoadingUtils.hideFullScreenLoader();
} }
Future<void> getAiOverviewSingleLabResult({required String langId, required LabResult recentLabResult, required String loadingText}) async { Future<void> getAiOverviewSingleLabResult({required int langId, required LabResult recentLabResult, required String loadingText}) async {
LoaderBottomSheet.showLoader( LoaderBottomSheet.showLoader(
loadingText: loadingText, loadingText: loadingText,
showCloseButton: true, showCloseButton: true,

@ -19,7 +19,7 @@ abstract class RadiologyRepo {
Future<Either<Failure, GenericApiModel<List<PatientRadiologyResponseModel>>>> getPatientRadiologyOrderByAppointment({required num appointmentNo, required num projectID}); Future<Either<Failure, GenericApiModel<List<PatientRadiologyResponseModel>>>> getPatientRadiologyOrderByAppointment({required num appointmentNo, required num projectID});
Future<Either<Failure, GenericApiModel<RadiologyAiAnalysisResponse>>> getRadiologyAiAnalysis({required String reportData}); Future<Either<Failure, GenericApiModel<RadiologyAiAnalysisResponse>>> getRadiologyAiAnalysis({required String reportData, required int langId,});
} }
class RadiologyRepoImp implements RadiologyRepo { class RadiologyRepoImp implements RadiologyRepo {
@ -223,9 +223,10 @@ class RadiologyRepoImp implements RadiologyRepo {
} }
@override @override
Future<Either<Failure, GenericApiModel<RadiologyAiAnalysisResponse>>> getRadiologyAiAnalysis({required String reportData}) async { Future<Either<Failure, GenericApiModel<RadiologyAiAnalysisResponse>>> getRadiologyAiAnalysis({required String reportData, required int langId}) async {
Map<String, dynamic> payload = { Map<String, dynamic> payload = {
"text": reportData, "text": reportData,
"language_id": langId
}; };
try { try {

@ -127,8 +127,7 @@ class RadiologyViewModel extends ChangeNotifier {
); );
} }
Future<void> getRadiologyImage( Future<void> getRadiologyImage({required PatientRadiologyResponseModel patientRadiologyResponseModel, Function(dynamic)? onSuccess, Function(String)? onError}) async {
{required PatientRadiologyResponseModel patientRadiologyResponseModel, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await radiologyRepo.getRadiologyImage(patientRadiologyResponseModel: patientRadiologyResponseModel); final result = await radiologyRepo.getRadiologyImage(patientRadiologyResponseModel: patientRadiologyResponseModel);
result.fold( result.fold(
@ -149,12 +148,8 @@ class RadiologyViewModel extends ChangeNotifier {
} }
Future<void> getRadiologyPDF( Future<void> getRadiologyPDF(
{required PatientRadiologyResponseModel patientRadiologyResponseModel, {required PatientRadiologyResponseModel patientRadiologyResponseModel, required AuthenticatedUser authenticatedUser, Function(dynamic)? onSuccess, Function(String)? onError}) async {
required AuthenticatedUser authenticatedUser, final result = await radiologyRepo.getRadiologyReportPDF(patientRadiologyResponseModel: patientRadiologyResponseModel, authenticatedUser: authenticatedUser);
Function(dynamic)? onSuccess,
Function(String)? onError}) async {
final result =
await radiologyRepo.getRadiologyReportPDF(patientRadiologyResponseModel: patientRadiologyResponseModel, authenticatedUser: authenticatedUser);
result.fold( result.fold(
(failure) async => await errorHandlerService.handleError( (failure) async => await errorHandlerService.handleError(
@ -229,7 +224,7 @@ class RadiologyViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
Future<void> getRadiologyAiAnalysis({required String reportData, required String loadingText}) async { Future<void> getRadiologyAiAnalysis({required String reportData, required String loadingText, required int langId}) async {
LoaderBottomSheet.showLoader( LoaderBottomSheet.showLoader(
loadingText: loadingText, loadingText: loadingText,
showCloseButton: true, showCloseButton: true,
@ -238,7 +233,7 @@ class RadiologyViewModel extends ChangeNotifier {
}, },
); );
final result = await radiologyRepo.getRadiologyAiAnalysis(reportData: reportData); final result = await radiologyRepo.getRadiologyAiAnalysis(reportData: reportData, langId: langId);
result.fold( result.fold(
(failure) async { (failure) async {

@ -168,15 +168,16 @@ class LabResultByClinic extends StatelessWidget {
], ],
), ),
).paddingSymmetrical(24.h, 24.h).onPress(() async { ).paddingSymmetrical(24.h, 24.h).onPress(() async {
final _dialogService = getIt.get<DialogService>(); final dialogService = getIt.get<DialogService>();
await _dialogService.showCommonBottomSheetWithoutH( final appState = getIt.get<AppState>();
await dialogService.showCommonBottomSheetWithoutH(
message: LocaleKeys.aiDisclaimer.tr(), message: LocaleKeys.aiDisclaimer.tr(),
label: LocaleKeys.consent.tr(), label: LocaleKeys.consent.tr(),
okLabel: LocaleKeys.acceptLbl.tr(), okLabel: LocaleKeys.acceptLbl.tr(),
cancelLabel: LocaleKeys.rejectView.tr(), cancelLabel: LocaleKeys.rejectView.tr(),
onOkPressed: () { onOkPressed: () {
context.pop(); context.pop();
labViewModel.getAiOverviewLabOrders(labOrder: labOrder, loadingText: LocaleKeys.loadingAIAnalysis.tr(context: context)); labViewModel.getAiOverviewLabOrders(langId: appState.getLanguageID(), labOrder: labOrder, loadingText: LocaleKeys.loadingAIAnalysis.tr(context: context));
}, },
onCancelPressed: () { onCancelPressed: () {
context.pop(); context.pop();

@ -197,7 +197,7 @@ class _LabResultDetailsState extends State<LabResultDetails> {
onOkPressed: () { onOkPressed: () {
context.pop(); context.pop();
labViewModel.getAiOverviewSingleLabResult( labViewModel.getAiOverviewSingleLabResult(
langId: appState.getLanguageID().toString(), recentLabResult: recentLabResult, loadingText: LocaleKeys.loadingAIAnalysis.tr(context: context)); langId: appState.getLanguageID(), recentLabResult: recentLabResult, loadingText: LocaleKeys.loadingAIAnalysis.tr(context: context));
}, },
onCancelPressed: () { onCancelPressed: () {
context.pop(); context.pop();

@ -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(),
],
);
}), }),
); );
} }

Loading…
Cancel
Save