import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.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/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import '../../../config/size_config.dart'; import '../../shared/app_texts_widget.dart'; /* *@author: Elham Rababah *@Date:22/4/2020 *@param: *@return:ProfileMedicalInfoWidget *@desc: Profile Medical Info Widget */ class ProfileMedicalInfoWidget extends StatelessWidget { ProfileMedicalInfoWidget( {Key key, this.patient, this.patientType, this.from, this.to}); String from; String to; PatiantInformtion patient; String patientType; @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) async {}, builder: (_, model, w) => SliverGrid.count( crossAxisSpacing: 10, mainAxisSpacing: 20, crossAxisCount: 2, childAspectRatio: 1.5, children: [ if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, isDisable: patient.episodeNo != 0 ? true : false, nameLine1: TranslationBase.of(context).createNew, nameLine2: TranslationBase.of(context).episode, route: CREATE_EPISODE, onTap: () async { PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel( appointmentNo: patient.appointmentNo, patientMRN: patient.patientMRN); await model.postEpisode(postEpisodeReqModel); patient.episodeNo = model.episodeID; Navigator.of(context).pushNamed(CREATE_EPISODE, arguments: {'patient': patient}); }, isLoading: model.state == ViewState.BusyLocal, icon: 'create-episod.png'), if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, isDisable: patient.episodeNo == 0 ? true : false, nameLine1: TranslationBase.of(context).update, nameLine2: TranslationBase.of(context).episode, route: UPDATE_EPISODE, icon: 'modilfy-episode.png'), if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, from: from, to: to, nameLine1: TranslationBase.of(context).vital, nameLine2: TranslationBase.of(context).signs, route: VITAL_SIGN_DETAILS /* PATIENT_VITAL_SIGN */ , icon: 'heartbeat.png'), if (selectedPatientType != 7) PatientProfileButton( key: key, patient: patient, route: LAB_ORDERS, nameLine1: TranslationBase.of(context).lab, nameLine2: TranslationBase.of(context).result, icon: 'lab.png'), PatientProfileButton( key: key, patient: patient, route: MEDICAL_FILE, nameLine1: TranslationBase.of(context).previewHealth, nameLine2: TranslationBase.of(context).summaryReport, icon: 'radiology-1.png'), if (selectedPatientType != 0 && selectedPatientType != 5 && selectedPatientType != 7) PatientProfileButton( key: key, patient: patient, route: PROGRESS_NOTE, nameLine1: TranslationBase.of(context).progress, nameLine2: TranslationBase.of(context).note, icon: 'heartbeat.png'), if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, route: PATIENT_ADMISSION_REQUEST, nameLine1: TranslationBase.of(context).admission, nameLine2: TranslationBase.of(context).request, icon: 'heartbeat.png'), if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, route: ORDER_PRESCRIPTION, nameLine1: TranslationBase.of(context).orders, nameLine2: TranslationBase.of(context).prescription, icon: 'lab.png'), if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, route: ORDER_PROCEDURE, nameLine1: TranslationBase.of(context).orders, nameLine2: TranslationBase.of(context).procedures, icon: 'lab.png'), if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, route: REFER_PATIENT_TO_DOCTOR, nameLine1: TranslationBase.of(context).myReferral, nameLine2: TranslationBase.of(context).patient, icon: 'note.png'), if (selectedPatientType != 0 && selectedPatientType != 5) PatientProfileButton( key: key, patient: patient, route: PATIENT_ORDERS, nameLine1: TranslationBase.of(context).orders, nameLine2: TranslationBase.of(context).list, icon: 'radiology-1.png'), if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, route: ADD_SICKLEAVE, nameLine1: TranslationBase.of(context).patientSick, nameLine2: TranslationBase.of(context).leave, icon: 'sick_leaves_icons.png'), if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, route: PATIENT_UCAF_REQUEST, nameLine1: TranslationBase.of(context).patient, nameLine2: TranslationBase.of(context).ucaf, icon: 'lab.png'), ], ), ); } } class CircleAvatarWidget extends StatelessWidget { const CircleAvatarWidget( {Key key, @required this.url, @required this.des, this.height, this.width}) : super(key: key); final String url; final String des; final double height; final double width; @override Widget build(BuildContext context) { return Container( child: Column( children: [ Container( height: height, width: width, // width: 50, // height: 50, decoration: new BoxDecoration( // color: Colors.green, // border color shape: BoxShape.circle, border: Border.all(color: HexColor('#B7831A'), width: 1.5)), child: CircleAvatar( radius: SizeConfig.imageSizeMultiplier * 12, child: Image.asset(url), backgroundColor: Colors.transparent, ), ), SizedBox( height: 10, ), AppText( des, fontSize: 1.5 * SizeConfig.textMultiplier, textAlign: TextAlign.center, ) ], ), ); } } class PatientProfileButton extends StatelessWidget { final String nameLine1; final String nameLine2; final String icon; final dynamic route; final PatiantInformtion patient; String from; String to; final String url = "assets/images/"; final bool isDisable; final bool isLoading; final Function onTap; PatientProfileButton( {Key key, this.patient, this.nameLine1, this.nameLine2, this.icon, this.route, this.isDisable = false, this.onTap, this.isLoading = false, this.from, this.to}) : super(key: key); @override Widget build(BuildContext context) { return new Container( margin: new EdgeInsets.symmetric(horizontal: 4.0), child: InkWell( onTap: isDisable ? null : onTap != null ? onTap : () { navigator(context, this.route); }, child: Column(children: [ Container( alignment: Alignment.topLeft, padding: EdgeInsets.all(5), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( this.nameLine1, color: Color(0xFFB9382C), fontWeight: FontWeight.w600, textAlign: TextAlign.left, fontSize: SizeConfig.textMultiplier * 2, ), AppText( this.nameLine2, color: Colors.black, fontWeight: FontWeight.w600, textAlign: TextAlign.left, fontSize: SizeConfig.textMultiplier * 2, ), if (isLoading) DrAppCircularProgressIndeicator() ], ), ), Expanded( child: Container( child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ Container( padding: EdgeInsets.all(10), child: new Image.asset(url + icon)) ], )), ) ]), ), decoration: BoxDecoration( // border: Border.all(), color: isDisable ? Colors.grey.withOpacity(0.4) : Colors.white, borderRadius: BorderRadius.all(Radius.circular(10)), border: Border.fromBorderSide(BorderSide( color: Color(0xffBBBBBB), width: 1, )), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.2), spreadRadius: 5, blurRadius: 7, offset: Offset(0, 3), // changes position of shadow ), ], ), padding: EdgeInsets.fromLTRB(5, 10, 5, 5), ); } void navigator(BuildContext context, route) { if (from == null) { from = DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'); } if (to == null) { to = DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'); } Navigator.of(context).pushNamed(route, arguments: {'patient': patient, 'from': from, 'to': to}); } }