ipd-changes-for-vida-plus
haroon amjad 2 months ago
parent 34c7b7ddcd
commit 87ed1aed5e

@ -153,6 +153,8 @@ class _AllLabSpecialResultState extends State<AllLabSpecialResult> {
resultData: model.allSpecialLabList[index] resultData: model.allSpecialLabList[index]
.resultDataHTML!, .resultDataHTML!,
patient: patient!, patient: patient!,
labResult: model.allSpecialLabList[index],
model: model
), ),
), ),
), ),

@ -1,24 +1,32 @@
import 'package:doctor_app_flutter/core/model/labs/all_special_lab_result_model.dart';
import 'package:doctor_app_flutter/core/viewModel/PatientMedicalReportViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientMedicalReportViewModel.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/viewModel/labs_view_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart'; import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart'; import 'package:flutter_html/flutter_html.dart';
import '../../../../../config/size_config.dart';
import '../../../../../core/model/labs/lab_result.dart';
import '../../../../../widgets/shared/app_texts_widget.dart';
class SpecialLabResultDetailsPage extends StatelessWidget { class SpecialLabResultDetailsPage extends StatelessWidget {
final String resultData; final String resultData;
final PatiantInformtion patient; final PatiantInformtion patient;
const SpecialLabResultDetailsPage({Key? key, required this.resultData, required this.patient}) final AllSpecialLabResultModel labResult;
: super(key: key);
const SpecialLabResultDetailsPage({Key? key, required this.resultData, required this.patient, required this.labResult}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<PatientMedicalReportViewModel>( return BaseView<LabsViewModel>(
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
@ -26,47 +34,214 @@ class SpecialLabResultDetailsPage extends StatelessWidget {
appBar: PatientProfileAppBar( appBar: PatientProfileAppBar(
patient, patient,
), ),
body: Container( body: NetworkBaseView(
child: SingleChildScrollView( baseViewModel: model,
child: Container(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ServiceTitle(
title: TranslationBase.of(context).special + " " + TranslationBase.of(context).lab,
subTitle: TranslationBase.of(context).result,
),
Row(
children: [
Expanded(
child: Column(
children: [
(resultData != null && resultData.isNotEmpty)
? Container(
width: double.infinity,
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(8)),
border: Border.fromBorderSide(
BorderSide(
color: Colors.white,
width: 1.0,
),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Html(data: resultData ?? ""),
Visibility(
visible: labResult.IsLabTestAttachment ?? false,
child: InkWell(
onTap: () async {
var labAccessNumber = labResult.LabAccessionNo;
// if (patientLabResultList[index].FileNameWithExtensionList?.isNotEmpty == true || patientLabResultList[index].FileNameWithExtensionList?.length == 1) {
// await model.getLabAttachments(patient, labAccessNumber: labAccessNumber, FileName: patientLabResultList[index].FileNameWithExtensionList?.first);
// model.openPDF();
// return;
// }
//
// if (patientLabResultList[index].UploadedDocuments?.isNotEmpty == true || patientLabResultList[index].UploadedDocuments?.length == 1) {
// await model.getLabAttachments(patient, labAccessNumber: labAccessNumber, uploadedDocument: patientLabResultList[index].UploadedDocuments?.first);
// model.openPDF();
// return;
// }
showUploadedDocumentsBottomSheet(context,
documents: labResult.UploadedDocuments,
fileName: labResult.FileNameWithExtensionList,
labAccessNumber: labAccessNumber,
projectID: int.parse(labResult.projectID!),
// projectID: 160,
setupID: labResult.setupID,
model: model);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AppText(
TranslationBase
.of(context)
.showAttachment,
textDecoration: TextDecoration.underline,
color: Colors.red.shade700,
fontSize: SizeConfig.textMultiplier! * 1.2,
fontWeight: FontWeight.w700,
),
],
),
),
),
],
),
)
: Container(
child: ErrorMessage(
error: TranslationBase
.of(context)
.noItem,
),
),
],
),
),
],
),
],
),
),
),
),
),
);
}
void showUploadedDocumentsBottomSheet(
BuildContext context, {
List<UploadedDocument>? documents,
List<String>? fileName,
String? labAccessNumber,
int? projectID,
String? setupID,
required LabsViewModel model,
}) {
const double kItemHeight = 66.0; // ListTile with contentPadding: 10
final double screenHeight = MediaQuery.of(context).size.height;
final double maxSheetHeight = screenHeight * 0.5;
final double minSheetHeight = (kItemHeight + 100).clamp(0, maxSheetHeight);
showModalBottomSheet(
context: context,
isScrollControlled: true, // lets the sheet respect custom height constraints
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
),
builder: (BuildContext context) {
return ConstrainedBox(
constraints: BoxConstraints(
minHeight: minSheetHeight,
maxHeight: maxSheetHeight,
),
child: SafeArea(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min,
children: [ children: [
ServiceTitle( // Drag handle
title: TranslationBase.of(context).special + Container(
" " + margin: const EdgeInsets.symmetric(vertical: 8),
TranslationBase.of(context).lab, width: 40,
subTitle: TranslationBase.of(context).result, height: 4,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(2),
),
), ),
resultData != null Padding(
? Container( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
width: double.infinity, child: Align(
margin: alignment: AlignmentDirectional.centerStart,
EdgeInsets.symmetric(horizontal: 16, vertical: 16), child: Text(
padding: TranslationBase.of(context).selectAnAttachment,
EdgeInsets.symmetric(horizontal: 16, vertical: 16), style: const TextStyle(
decoration: BoxDecoration( fontSize: 16,
color: Colors.white, fontWeight: FontWeight.bold,
shape: BoxShape.rectangle, ),
borderRadius: BorderRadius.all(Radius.circular(8)), ),
border: Border.fromBorderSide( ),
BorderSide( ),
color: Colors.white, Flexible(
width: 1.0, child: Padding(
), padding: const EdgeInsets.all(16),
), child: Material(
), color: const Color(0X55F2F2F2),
child: Html(data: resultData ?? ""), child: ListView.separated(
) shrinkWrap: true,
: Container( padding: EdgeInsets.zero,
child: ErrorMessage( itemCount: documents?.length ?? fileName?.length ?? 0,
error: TranslationBase.of(context).noItem, separatorBuilder: (context, index) => Padding(
padding: const EdgeInsets.all(8.0),
child: const Divider(height: 1, color: Colors.grey),
), ),
itemBuilder: (context, index) {
final docName = documents?[index]?.fileName ?? fileName?[index];
return ListTile(
contentPadding: const EdgeInsets.all(10),
title: Text(
docName ?? "Unnamed Document",
style: const TextStyle(
fontSize: 15,
fontWeight: FontWeight.w500,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
trailing: const Icon(
Icons.chevron_right,
color: Colors.grey,
),
onTap: () async {
Navigator.pop(context);
if (documents?.isNotEmpty == true) {
await model.getLabAttachments(patient, uploadedDocument: documents![index], projectID: projectID, setupID: setupID);
model.openPDF();
}
if (fileName?.isNotEmpty == true) {
await model.getLabAttachments(patient, labAccessNumber: labAccessNumber, FileName: fileName![index], projectID: projectID, setupID: setupID);
model.openPDF();
}
},
);
},
), ),
),
),
),
const SizedBox(height: 8),
], ],
), ),
), ),
), );
), },
); );
} }
} }

Loading…
Cancel
Save