From 679ebe8fa69183182ea3dea196e89437f6ce4f8b Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 20 Apr 2021 16:19:56 +0300 Subject: [PATCH] Refacatoring Medical file --- .../medical-file/medical_file_details.dart | 190 +----------------- .../medical-file/medical_file_page.dart | 15 -- 2 files changed, 7 insertions(+), 198 deletions(-) diff --git a/lib/screens/medical-file/medical_file_details.dart b/lib/screens/medical-file/medical_file_details.dart index 9f12e8b7..1c3d832c 100644 --- a/lib/screens/medical-file/medical_file_details.dart +++ b/lib/screens/medical-file/medical_file_details.dart @@ -1,14 +1,10 @@ import 'package:doctor_app_flutter/core/viewModel/medical_file_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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/patients/profile/patient_profile_screen.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.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/patients/profile/patient-profile-header-new-design.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -100,7 +96,11 @@ class _MedicalFileDetailsState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getMedicalFile(mrn: pp), + onModelReady: (model) async { + if (model.medicalFileList.length == 0) { + model.getMedicalFile(mrn: pp); + } + }, builder: (BuildContext context, MedicalFileViewModel model, Widget child) => AppScaffold( @@ -128,8 +128,6 @@ class _MedicalFileDetailsState extends State { child: Container( child: Column( children: [ - // PatientProfileHeaderNewDesign(patient, - // patient.patientType.toString(), patient.arrivedOn), model.medicalFileList.length != 0 && model .medicalFileList[0] @@ -144,161 +142,6 @@ class _MedicalFileDetailsState extends State { child: Container( child: Column( children: [ - // Container( - // width: double.infinity, - // margin: EdgeInsets.only( - // top: 10, left: 10, right: 10), - // padding: EdgeInsets.all(8.0), - // decoration: BoxDecoration( - // color: Colors.white, - // borderRadius: BorderRadius.all( - // Radius.circular(10.0), - // ), - // border: Border.all( - // color: Colors.grey[200], width: 0.5), - // ), - // child: Column( - // children: [ - // Row( - // children: [ - // if (model.medicalFileList.length != - // 0 && - // model - // .medicalFileList[0] - // .entityList[0] - // .timelines[ - // encounterNumber] - // .timeLineEvents[0] - // .consulations - // .length != - // 0) - // Expanded( - // child: AppText( - // model - // .medicalFileList[0] - // .entityList[0] - // .timelines[ - // encounterNumber] - // .timeLineEvents[0] - // .consulations[0] - // .doctorName - // .toUpperCase(), - // fontWeight: FontWeight.w700, - // ), - // ), - // ], - // ), - // if (model.medicalFileList.length != 0) - // Row( - // children: [ - // AppText( - // TranslationBase.of(context) - // .clinic + - // ": ", - // ), - // if (model.medicalFileList - // .length != - // 0 && - // model - // .medicalFileList[0] - // .entityList[0] - // .timelines[ - // encounterNumber] - // .timeLineEvents[0] - // .consulations - // .length != - // 0) - // AppText( - // model - // .medicalFileList[0] - // .entityList[0] - // .timelines[ - // encounterNumber] - // .timeLineEvents[0] - // .consulations[0] - // .clinicName, - // fontWeight: FontWeight.w700, - // ), - // ], - // ), - // Row( - // children: [ - // AppText( - // TranslationBase.of(context) - // .episode + - // ": ", - // //fontWeight: FontWeight.w700, - // ), - // if (model.medicalFileList.length != - // 0 && - // model - // .medicalFileList[0] - // .entityList[0] - // .timelines[ - // encounterNumber] - // .timeLineEvents[0] - // .consulations - // .length != - // 0) - // AppText( - // model - // .medicalFileList[0] - // .entityList[0] - // .timelines[encounterNumber] - // .timeLineEvents[0] - // .consulations[0] - // .episodeID - // .toString(), - // fontWeight: FontWeight.w700, - // ), - // ], - // ), - // Row( - // children: [ - // AppText( - // TranslationBase.of(context) - // .visitDate + - // ": ", - // //fontWeight: FontWeight.w700, - // ), - // if (model.medicalFileList.length != - // 0 && - // model - // .medicalFileList[0] - // .entityList[0] - // .timelines[ - // encounterNumber] - // .timeLineEvents[0] - // .consulations - // .length != - // 0) - // AppText( - // '${DateUtils.getDayMonthYearDateFormatted(DateUtils.getDateTimeFromServerFormat( - // model - // .medicalFileList[0] - // .entityList[0] - // .timelines[ - // encounterNumber] - // .date, - // ), isArabic: projectViewModel.isArabic)}', - // color: Colors.black, - // fontWeight: FontWeight.w700, - // fontSize: 14, - // ), - // SizedBox(width: 35.0), - // // AppText( - // // 'Appt Date : ', - // // fontWeight: FontWeight.w700, - // // ), - // // AppText( - // // '23/12/2020', - // // ), - // ], - // ), - // ], - // ), - // ), - SizedBox(height: 25.0), if (model.medicalFileList.length != 0 && model @@ -655,14 +498,7 @@ class _MedicalFileDetailsState extends State { ), ), ), - // SizedBox( - // height: 30, - // ), - // Container( - // width: double.infinity, - // height: 1, - // color: Color(0xffCCCCCC), - // ), + SizedBox( height: 30, ), @@ -889,14 +725,7 @@ class _MedicalFileDetailsState extends State { ), ), ), - // SizedBox( - // height: 30, - // ), - // Container( - // width: double.infinity, - // height: 1, - // color: Color(0xffCCCCCC), - // ), + SizedBox( height: 30, ), @@ -1086,11 +915,6 @@ class _MedicalFileDetailsState extends State { SizedBox( height: 30, ), - // Container( - // width: double.infinity, - // height: 1, - // color: Color(0xffCCCCCC), - // ), ], ), ), diff --git a/lib/screens/medical-file/medical_file_page.dart b/lib/screens/medical-file/medical_file_page.dart index 25b76fed..d9456453 100644 --- a/lib/screens/medical-file/medical_file_page.dart +++ b/lib/screens/medical-file/medical_file_page.dart @@ -1,25 +1,16 @@ -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/medical_file_view_model.dart'; -import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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/screens/patients/profile/patient_profile_screen.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.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'; -import 'package:hexcolor/hexcolor.dart'; class MedicalFilePage extends StatefulWidget { @override @@ -49,13 +40,7 @@ class _MedicalFilePageState extends State { child: SingleChildScrollView( child: Container( child: Column( - // mainAxisAlignment: model.medicalFileList.length != 0 && - // model.medicalFileList != null - // ? MainAxisAlignment.start - // : MainAxisAlignment.center, children: [ - // PatientProfileHeaderNewDesign( - // patient, patient.patientType.toString(), arrivalType), Padding( padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0),