import 'package:doctor_app_flutter/core/viewModel/medical_file_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/medical-file/medical_file_details.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; class MedicalFilePage extends StatefulWidget { @override _MedicalFilePageState createState() => _MedicalFilePageState(); } class _MedicalFilePageState extends State { PatiantInformtion patient; @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; patient = routeArgs['patient']; String patientType = routeArgs['patientType']; String arrivalType = routeArgs['arrivalType']; return BaseView( onModelReady: (model) => model.getMedicalFile(mrn: patient.patientId), builder: (BuildContext context, MedicalFileViewModel model, Widget child) => AppScaffold( appBar: PatientProfileHeaderNewDesignAppBar( patient, patientType.toString() ?? "0", arrivalType), isShowAppBar: true, appBarTitle: TranslationBase.of(context).medicalReport.toUpperCase(), body: NetworkBaseView( baseViewModel: model, child: SingleChildScrollView( child: Container( child: Column( children: [ Padding( padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0), child: Container( child: Padding( padding: const EdgeInsets.all(8.0), child: Column( children: [ Row( children: [ AppText( 'Medical', fontSize: 15.0, fontWeight: FontWeight.w600, fontFamily: 'Poppins', ), ], ), Row( children: [ AppText( 'Report', fontSize: 30.0, fontWeight: FontWeight.w700, ), ], ), ], ), ), ), ), (model.medicalFileList != null && model.medicalFileList.length != 0) ? ListView.builder( //physics: , physics: NeverScrollableScrollPhysics(), scrollDirection: Axis.vertical, shrinkWrap: true, itemCount: model.medicalFileList[0].entityList[0] .timelines.length, itemBuilder: (BuildContext ctxt, int index) { return InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => MedicalFileDetails( age: patient.age is String ? patient.age ?? "" : "${patient.age}", firstName: patient.firstName, lastName: patient.lastName, gender: patient.genderDescription, encounterNumber: index, pp: patient.patientId, patient: patient, doctorName: model .medicalFileList[0] .entityList[0] .timelines[index] .timeLineEvents[0] .consulations .isNotEmpty ? model .medicalFileList[0] .entityList[0] .timelines[index] .doctorName : "", clinicName: model .medicalFileList[0] .entityList[0] .timelines[index] .timeLineEvents[0] .consulations .isNotEmpty ? model .medicalFileList[0] .entityList[0] .timelines[index] .clinicName : "", doctorImage: model .medicalFileList[0] .entityList[0] .timelines[index] .timeLineEvents[0] .consulations .isNotEmpty ? model .medicalFileList[0] .entityList[0] .timelines[index] .doctorImage : "", episode: model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0].consulations.isNotEmpty ? model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0].consulations[0].episodeID.toString() : "", vistDate: model.medicalFileList[0].entityList[0].timelines[index].date.toString())), ); }, child: DoctorCard( doctorName: model.medicalFileList[0] .entityList[0].timelines[index].doctorName, clinic: model.medicalFileList[0].entityList[0] .timelines[index].clinicName, branch: model.medicalFileList[0].entityList[0] .timelines[index].projectName, profileUrl: model.medicalFileList[0] .entityList[0].timelines[index].doctorImage, appointmentDate: DateUtils.getDateTimeFromServerFormat( model.medicalFileList[0].entityList[0] .timelines[index].date, ), isPrescriptions: true, ), ); }) : Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( height: 100, ), Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(8.0), child: AppText('No Medical File Found'), ) ], ), ) ], ), ), ), ), ), ); } }