From 0528323e15e6bb97111bebf23921570fee1e04c9 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Tue, 6 Apr 2021 15:21:02 +0300 Subject: [PATCH] fix patient card appbare bugs --- ...ent-profile-header-new-design-app-bar.dart | 510 +++++----- .../patient-profile-header-new-design.dart | 9 +- ..._profile_header_with_appointment_card.dart | 32 +- ..._header_with_appointment_card_app_bar.dart | 33 +- .../soap_update/update_objective_page.dart | 878 ++++++++++-------- 5 files changed, 780 insertions(+), 682 deletions(-) diff --git a/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart b/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart index 6e0192a8..74bb1be7 100644 --- a/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart +++ b/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart @@ -20,296 +20,294 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred @override Widget build(BuildContext context) { - return PreferredSize( - preferredSize: Size(double.infinity, 200), + return Container( + padding: EdgeInsets.only( + left: 0, right: 5, bottom: 5,), + decoration: BoxDecoration( + color: Colors.white, + ), + height: 200, child: Container( padding: EdgeInsets.only( - left: 0, right: 5, bottom: 5,), - decoration: BoxDecoration( - color: Colors.white, - ), - height: 200, - child: Container( - padding: EdgeInsets.only( - left: 10, right: 10, bottom: 10), - margin: EdgeInsets.only(top: 50), - child: Column( - children: [ - Container( - padding: EdgeInsets.only(left: 12.0), - child: Row(children: [ - IconButton( - icon: Icon(Icons.arrow_back_ios), - color: Colors.black, //Colors.black, - onPressed: () => Navigator.pop(context), - ), - AppText( + left: 10, right: 10, bottom: 10), + margin: EdgeInsets.only(top: 50), + child: Column( + children: [ + Container( + padding: EdgeInsets.only(left: 12.0), + child: Row(children: [ + IconButton( + icon: Icon(Icons.arrow_back_ios), + color: Colors.black, //Colors.black, + onPressed: () => Navigator.pop(context), + ), + Expanded( + child: AppText( patient.firstName != null ? (Helpers.capitalize(patient.firstName) + " " + Helpers.capitalize( patient.lastName)) : Helpers.capitalize(patient.patientDetails.fullName), - fontSize: SizeConfig.textMultiplier * 2.5, + fontSize: SizeConfig.textMultiplier *2.5, fontWeight: FontWeight.bold, backGroundcolor: Colors.white, fontFamily: 'Poppins', ), - patient.gender == 1 - ? Icon( - DoctorApp.male_2, - color: Colors.blue, - ) - : Icon( - DoctorApp.female_1, - color: Colors.pink, - ), - ]), - ), - Row(children: [ - Padding( - padding: EdgeInsets.only(left: 12.0), - child: Container( - width: 60, - height: 60, - child: Image.asset( - patient.gender == 1 - ? 'assets/images/male_avatar.png' - : 'assets/images/female_avatar.png', - fit: BoxFit.cover, - ), - ), ), - SizedBox( - width: 10, + patient.patientDetails != null ? patient.patientDetails.gender == 1 : patient.gender == 1 + ? Icon( + DoctorApp.male_2, + color: Colors.blue, + ) + : Icon( + DoctorApp.female_1, + color: Colors.pink, ), - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SERVICES_PATIANT2[ - int.parse(patientType)] == - "patientArrivalList" - ? Container( - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - patient.patientStatusType == - 43 - ? AppText( - TranslationBase.of( - context) - .arrivedP, - color: Colors.green, - fontWeight: - FontWeight.bold, - fontFamily: - 'Poppins', - fontSize: 12, - ) - : AppText( - TranslationBase.of( - context) - .notArrived, - color: - Colors.red[800], + ]), + ), + Row(children: [ + Padding( + padding: EdgeInsets.only(left: 12.0), + child: Container( + width: 60, + height: 60, + child: Image.asset( + patient.patientDetails != null ? patient.patientDetails.gender == 1 : patient.gender == 1 + ? 'assets/images/male_avatar.png' + : 'assets/images/female_avatar.png', + fit: BoxFit.cover, + ), + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + SERVICES_PATIANT2[ + int.parse(patientType)] == + "patientArrivalList" + ? Container( + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + patient.patientStatusType == + 43 + ? AppText( + TranslationBase.of( + context) + .arrivedP, + color: Colors.green, + fontWeight: + FontWeight.bold, + fontFamily: + 'Poppins', + fontSize: 12, + ) + : AppText( + TranslationBase.of( + context) + .notArrived, + color: + Colors.red[800], + fontWeight: + FontWeight.bold, + fontFamily: + 'Poppins', + fontSize: 12, + ), + arrivalType == '1' + ? AppText( + patient.startTime != + null + ? patient + .startTime + : '', + fontFamily: + 'Poppins', + fontWeight: + FontWeight.w600, + ) + : AppText( + DateUtils.convertStringToDateFormat( + patient + .arrivedOn, + 'MM-dd-yyyy HH:mm'), + fontFamily: + 'Poppins', + fontWeight: + FontWeight.w600, + ) + ], + )) + : SizedBox(), + if (SERVICES_PATIANT2[ + int.parse(patientType)] == + "List_MyOutPatient") + Container( + child: Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .appointmentDate + + " : ", + fontSize: 14, + ), + patient.startTime != null + ? Container( + height: 15, + width: 60, + decoration: + BoxDecoration( + borderRadius: + BorderRadius + .circular( + 25), + color: HexColor( + "#20A169"), + ), + child: AppText( + patient.startTime, + color: Colors.white, + fontSize: 1.5 * + SizeConfig + .textMultiplier, + textAlign: TextAlign + .center, fontWeight: FontWeight.bold, - fontFamily: - 'Poppins', - fontSize: 12, ), - arrivalType == '1' - ? AppText( - patient.startTime != - null - ? patient - .startTime - : '', - fontFamily: - 'Poppins', - fontWeight: - FontWeight.w600, - ) - : AppText( - DateUtils.convertStringToDateFormat( - patient - .arrivedOn, - 'MM-dd-yyyy HH:mm'), - fontFamily: - 'Poppins', + ) + : SizedBox(), + SizedBox( + width: 3.5, + ), + Container( + child: AppText( + convertDateFormat2(patient.appointmentDate.toString()?? ''), + fontSize: 1.5 * + SizeConfig + .textMultiplier, fontWeight: - FontWeight.w600, - ) - ], - )) - : SizedBox(), - if (SERVICES_PATIANT2[ - int.parse(patientType)] == - "List_MyOutPatient") - Container( - child: Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .appointmentDate + - " : ", - fontSize: 14, - ), - patient.startTime != null - ? Container( - height: 15, - width: 60, - decoration: - BoxDecoration( - borderRadius: - BorderRadius - .circular( - 25), - color: HexColor( - "#20A169"), - ), - child: AppText( - patient.startTime, - color: Colors.white, - fontSize: 1.5 * - SizeConfig - .textMultiplier, - textAlign: TextAlign - .center, - fontWeight: - FontWeight.bold, - ), - ) - : SizedBox(), - SizedBox( - width: 3.5, - ), - Container( - child: AppText( - convertDateFormat2(patient.appointmentDate.toString()?? ''), - fontSize: 1.5 * - SizeConfig - .textMultiplier, - fontWeight: - FontWeight.bold, - ), + FontWeight.bold, ), - SizedBox( - height: 0.5, - ) - ], - ), - margin: EdgeInsets.only( - top: 8, - ), - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - RichText( - text: TextSpan( - style: TextStyle( - fontSize: 1.6 * - SizeConfig - .textMultiplier, - color: Colors.black), - children: [ - new TextSpan( - text: - TranslationBase.of( - context) - .fileNumber, - style: TextStyle( - fontSize: 12, - fontFamily: - 'Poppins')), - new TextSpan( - text: patient.patientId - .toString(), - style: TextStyle( - fontWeight: - FontWeight.w700, - fontFamily: - 'Poppins', - fontSize: 14)), - ], ), - ), - Row( - children: [ - AppText( - patient.nationalityName ?? - patient.nationality, - fontWeight: FontWeight.bold, - fontSize: 12, - ), - patient.nationality != null - ? ClipRRect( - borderRadius: - BorderRadius - .circular( - 20.0), - child: Image.network( - patient - .nationalityFlagURL, - height: 25, - width: 30, - errorBuilder: - (BuildContext - context, - Object - exception, - StackTrace - stackTrace) { - return Text( - 'No Image'); - }, - )) - : SizedBox() - ], - ) - ], + SizedBox( + height: 0.5, + ) + ], + ), + margin: EdgeInsets.only( + top: 8, + ), ), - Container( - child: RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: 1.6 * - SizeConfig.textMultiplier, - color: Colors.black, - fontFamily: 'Poppins', - ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + RichText( + text: TextSpan( + style: TextStyle( + fontSize: 1.6 * + SizeConfig + .textMultiplier, + color: Colors.black), children: [ new TextSpan( - text: TranslationBase.of( + text: + TranslationBase.of( context) - .age + - " : ", + .fileNumber, style: TextStyle( - fontSize: 14)), + fontSize: 12, + fontFamily: + 'Poppins')), new TextSpan( - text: - "${DateUtils.getAgeByBirthday(patient.dateofBirth, context)}", + text: patient.patientId + .toString(), style: TextStyle( fontWeight: FontWeight.w700, + fontFamily: + 'Poppins', fontSize: 14)), ], ), ), + Row( + children: [ + AppText( + patient.nationalityName ?? + patient.nationality, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + patient.nationality != null + ? ClipRRect( + borderRadius: + BorderRadius + .circular( + 20.0), + child: Image.network( + patient.nationalityFlagURL, + height: 25, + width: 30, + errorBuilder: + (BuildContext + context, + Object + exception, + StackTrace + stackTrace) { + return Text( + 'No Image'); + }, + )) + : SizedBox() + ], + ) + ], + ), + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 1.6 * + SizeConfig.textMultiplier, + color: Colors.black, + fontFamily: 'Poppins', + ), + children: [ + new TextSpan( + text: TranslationBase.of( + context) + .age + + " : ", + style: TextStyle( + fontSize: 14)), + new TextSpan( + text: + "${DateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth : patient.dateofBirth, context)}", + style: TextStyle( + fontWeight: + FontWeight.w700, + fontSize: 14)), + ], + ), ), - ], - ), + ), + ], ), - ]), - ], - ), + ), + ]), + ], ), ), ); diff --git a/lib/widgets/patients/profile/patient-profile-header-new-design.dart b/lib/widgets/patients/profile/patient-profile-header-new-design.dart index de0302a2..8f8e47a0 100644 --- a/lib/widgets/patients/profile/patient-profile-header-new-design.dart +++ b/lib/widgets/patients/profile/patient-profile-header-new-design.dart @@ -54,7 +54,7 @@ class PatientProfileHeaderNewDesign extends StatelessWidget { fontFamily: 'Poppins', ), ), - patient.gender == 1 + patient.patientDetails != null ? patient.patientDetails.gender == 1 : patient.gender == 1 ? Icon( DoctorApp.male_2, color: Colors.blue, @@ -72,7 +72,7 @@ class PatientProfileHeaderNewDesign extends StatelessWidget { width: 60, height: 60, child: Image.asset( - patient.gender == 1 + patient.patientDetails != null ? patient.patientDetails.gender == 1 : patient.gender == 1 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png', fit: BoxFit.cover, @@ -256,8 +256,7 @@ class PatientProfileHeaderNewDesign extends StatelessWidget { .circular( 20.0), child: Image.network( - patient - .nationalityFlagURL, + patient.nationalityFlagURL, height: 25, width: 30, errorBuilder: @@ -295,7 +294,7 @@ class PatientProfileHeaderNewDesign extends StatelessWidget { fontSize: 14)), new TextSpan( text: - "${DateUtils.getAgeByBirthday(patient.dateofBirth, context)}", + "${DateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth : patient.dateofBirth, context)}", style: TextStyle( fontWeight: FontWeight.w700, diff --git a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart index 57f79f7a..6f806c91 100644 --- a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart +++ b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart @@ -63,17 +63,20 @@ class PatientProfileHeaderWhitAppointment extends StatelessWidget { color: Colors.black, //Colors.black, onPressed: () => Navigator.pop(context), ), - AppText( - (Helpers.capitalize(patient.firstName) + - " " + - Helpers.capitalize( - patient.lastName)), - fontSize: SizeConfig.textMultiplier * 3, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - fontFamily: 'Poppins', + Expanded( + child: AppText( + patient.firstName != null ? + (Helpers.capitalize(patient.firstName) + + " " + + Helpers.capitalize( + patient.lastName)) : Helpers.capitalize(patient.patientDetails.fullName), + fontSize: SizeConfig.textMultiplier *2.5, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, + fontFamily: 'Poppins', + ), ), - patient.gender == 1 + patient.patientDetails != null ? patient.patientDetails.gender == 1 : patient.gender == 1 ? Icon( DoctorApp.male_2, color: Colors.blue, @@ -91,7 +94,7 @@ class PatientProfileHeaderWhitAppointment extends StatelessWidget { width: 60, height: 60, child: Image.asset( - patient.gender == 1 + patient.patientDetails != null ? patient.patientDetails.gender == 1 : patient.gender == 1 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png', fit: BoxFit.cover, @@ -210,7 +213,7 @@ class PatientProfileHeaderWhitAppointment extends StatelessWidget { ), Container( child: AppText( - convertDateFormat2(patient.appointmentDate??''), + convertDateFormat2(patient.appointmentDate.toString()?? ''), fontSize: 1.5 * SizeConfig .textMultiplier, @@ -275,8 +278,7 @@ class PatientProfileHeaderWhitAppointment extends StatelessWidget { .circular( 20.0), child: Image.network( - patient - .nationalityFlagURL, + patient.nationalityFlagURL, height: 25, width: 30, errorBuilder: @@ -314,7 +316,7 @@ class PatientProfileHeaderWhitAppointment extends StatelessWidget { fontSize: 14)), new TextSpan( text: - "${DateUtils.getAgeByBirthday(patient.dateofBirth, context)}", + "${DateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth : patient.dateofBirth, context)}", style: TextStyle( fontWeight: FontWeight.w700, diff --git a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart index 274d2264..e93ba37b 100644 --- a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart +++ b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart @@ -63,18 +63,20 @@ class PatientProfileHeaderWhitAppointmentAppBar extends StatelessWidget with Pre color: Colors.black, //Colors.black, onPressed: () => Navigator.pop(context), ), - AppText( - patient.firstName != null ? - (Helpers.capitalize(patient.firstName) + - " " + - Helpers.capitalize( - patient.lastName)) : Helpers.capitalize(patient.patientDetails.fullName), - fontSize: SizeConfig.textMultiplier * 2.5, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - fontFamily: 'Poppins', + Expanded( + child: AppText( + patient.firstName != null ? + (Helpers.capitalize(patient.firstName) + + " " + + Helpers.capitalize( + patient.lastName)) : Helpers.capitalize(patient.patientDetails.fullName), + fontSize: SizeConfig.textMultiplier *2.5, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, + fontFamily: 'Poppins', + ), ), - patient.gender == 1 + patient.patientDetails != null ? patient.patientDetails.gender == 1 : patient.gender == 1 ? Icon( DoctorApp.male_2, color: Colors.blue, @@ -92,7 +94,7 @@ class PatientProfileHeaderWhitAppointmentAppBar extends StatelessWidget with Pre width: 60, height: 60, child: Image.asset( - patient.gender == 1 + patient.patientDetails != null ? patient.patientDetails.gender == 1 : patient.gender == 1 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png', fit: BoxFit.cover, @@ -211,7 +213,7 @@ class PatientProfileHeaderWhitAppointmentAppBar extends StatelessWidget with Pre ), Container( child: AppText( - convertDateFormat2(patient.appointmentDate??''), + convertDateFormat2(patient.appointmentDate.toString()?? ''), fontSize: 1.5 * SizeConfig .textMultiplier, @@ -276,8 +278,7 @@ class PatientProfileHeaderWhitAppointmentAppBar extends StatelessWidget with Pre .circular( 20.0), child: Image.network( - patient - .nationalityFlagURL, + patient.nationalityFlagURL, height: 25, width: 30, errorBuilder: @@ -315,7 +316,7 @@ class PatientProfileHeaderWhitAppointmentAppBar extends StatelessWidget with Pre fontSize: 14)), new TextSpan( text: - "${DateUtils.getAgeByBirthday(patient.dateofBirth, context)}", + "${DateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth : patient.dateofBirth, context)}", style: TextStyle( fontWeight: FontWeight.w700, diff --git a/lib/widgets/patients/profile/soap_update/update_objective_page.dart b/lib/widgets/patients/profile/soap_update/update_objective_page.dart index af960ff7..1ce5fbea 100644 --- a/lib/widgets/patients/profile/soap_update/update_objective_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_objective_page.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; @@ -13,6 +14,7 @@ import 'package:doctor_app_flutter/models/doctor/doctor_profile_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/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/expandable_SOAP_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; @@ -25,6 +27,7 @@ import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class UpdateObjectivePage extends StatefulWidget { @@ -33,8 +36,13 @@ class UpdateObjectivePage extends StatefulWidget { final List mySelectedExamination; final PatiantInformtion patientInfo; + UpdateObjectivePage( - {Key key, this.changePageViewIndex, this.mySelectedExamination, this.patientInfo, this.changeLoadingState}); + {Key key, + this.changePageViewIndex, + this.mySelectedExamination, + this.patientInfo, + this.changeLoadingState}); @override _UpdateObjectivePageState createState() => _UpdateObjectivePageState(); @@ -55,6 +63,7 @@ class _UpdateObjectivePageState extends State { )), ); } + @override Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; @@ -97,350 +106,435 @@ class _UpdateObjectivePageState extends State { builder: (_, model, w) => AppScaffold( isShowAppBar: false, // baseViewModel: model, - - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 30, - ), - HeaderBodyExpandableNotifier( - headerWidget: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Texts(TranslationBase.of(context).physicalSystemExamination, - variant: isSysExaminationExpand - ? "bodyText" - : '', - bold: isSysExaminationExpand ? true : false, - color: Colors.black), - Icon( - FontAwesomeIcons.asterisk, - color: AppGlobal.appPrimaryColor, - size: 12, - ) - ], + body: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + color: Color.fromRGBO(248, 248, 248, 1), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.95, + child: Container( + margin: EdgeInsets.all(8.0), + padding: EdgeInsets.all(12.0), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.circular(12), + border: Border.fromBorderSide(BorderSide( + color: Colors.grey.shade400, + width: 0.4, + )), ), - InkWell( - onTap: () { - setState(() { - isSysExaminationExpand = - !isSysExaminationExpand; - }); - }, - child: Icon(isSysExaminationExpand - ? EvaIcons.minus - : EvaIcons.plus)) - ], - ), - bodyWidget: Column(children: [ - SizedBox( - height: 20, - ), - Column( - children: [ - Container( - margin: - EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: TranslationBase.of(context).physicalSystemExamination, - fontSize: 13.5, - onTapTextFields: () { - openExaminationList(context); - }, - readOnly: true, - // hintColor: Colors.black, - suffixIcon: EvaIcons.plusCircleOutline, - suffixIconColor: AppGlobal.appPrimaryColor, - fontWeight: FontWeight.w600, - // controller: messageController, - validator: (value) { - if (value == null) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - Column( - children: - widget.mySelectedExamination.map((examination) { - TextEditingController remarksController= TextEditingController(text :examination.remark); - - return Container( - margin: EdgeInsets.only( - left: 15, right: 15, top: 15), - child: Column(children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Texts( - ( examination - .selectedExamination.nameEn ) - .toUpperCase(), - variant: "bodyText", - bold: true, - color: Colors.black) - ], - ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).physicalSystemExamination}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 2.0, + fontWeight: isSysExaminationExpand ? FontWeight.w700 : FontWeight.normal, + ), + /*Texts( + TranslationBase.of(context) + .physicalSystemExamination, + variant: isSysExaminationExpand + ? "bodyText" + : '', + bold: isSysExaminationExpand + ? true + : false, + color: Colors.black),*/ + Icon( + FontAwesomeIcons.asterisk, + color: AppGlobal.appPrimaryColor, + size: 12, + ) + ], + ), + InkWell( + onTap: () { + setState(() { + isSysExaminationExpand = + !isSysExaminationExpand; + }); + }, + child: Icon(isSysExaminationExpand + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down)) + ], + ), + bodyWidget: Column(children: [ SizedBox( - height: 8, + height: 20, ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + Column( children: [ - Row( - children: [ - InkWell( - child: Center( - child: Container( - height: - screenSize.height * - 0.070, - decoration: - containerBorderDecoration( - examination - .isNormal - ? Color( - 0xFF515A5D) - : Colors - .white, - Colors.grey), - child: Center( - child: Padding( - padding: - const EdgeInsets - .all(8.0), - child: Text( - TranslationBase.of(context).normal, - style: TextStyle( - fontSize: 12, - color: - examination - .isNormal - ? Colors.white - : Colors - .black, - //Colors.black, - fontWeight: - FontWeight - .bold, - ), - ), - ), - )), - ), - onTap: () { - setState(() { - examination.isAbnormal = - false; - examination.isNormal = - true; - examination.notExamined = false; - }); - }), - SizedBox( - width: 12, - ), - InkWell( - child: Center( - child: Container( - height: - screenSize.height * - 0.070, - decoration: - containerBorderDecoration( - examination - .isAbnormal - ? Color( - 0xFF515A5D) - : Colors - .white, - Colors.black), - child: Center( - child: Padding( - padding: - const EdgeInsets - .all(8.0), - child: Text( - TranslationBase.of(context).abnormal, - style: TextStyle( - fontSize: 12, - color: - examination - .isAbnormal - ? Colors.white - : Colors - .black, - //Colors.black, - fontWeight: - FontWeight - .bold, - ), + Container( + margin: EdgeInsets.only( + left: 10, right: 10, top: 15), + child: TextFields( + hintText: TranslationBase.of(context) + .physicalSystemExamination, + fontSize: 13.5, + onTapTextFields: () { + openExaminationList(context); + }, + readOnly: true, + // hintColor: Colors.black, + suffixIcon: + EvaIcons.plusCircleOutline, + suffixIconColor: + AppGlobal.appPrimaryColor, + fontWeight: FontWeight.w600, + // controller: messageController, + validator: (value) { + if (value == null) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + Column( + children: widget.mySelectedExamination + .map((examination) { + TextEditingController + remarksController = + TextEditingController( + text: examination.remark); + + return Container( + margin: EdgeInsets.only( + left: 15, right: 15, top: 15), + child: Column(children: [ + Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + Texts( + (examination + .selectedExamination + .nameEn) + .toUpperCase(), + variant: "bodyText", + bold: true, + color: Colors.black) + ], + ), + SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + Row( + children: [ + InkWell( + child: Center( + child: Container( + height: screenSize + .height * + 0.070, + decoration: containerBorderDecoration( + examination + .isNormal + ? Color( + 0xFF515A5D) + : Colors + .white, + Colors + .grey), + child: Center( + child: + Padding( + padding: + const EdgeInsets.all( + 8.0), + child: Text( + TranslationBase.of( + context) + .normal, + style: + TextStyle( + fontSize: + 12, + color: examination.isNormal + ? Colors.white + : Colors.black, + //Colors.black, + fontWeight: + FontWeight.bold, + ), + ), + ), + )), + ), + onTap: () { + setState(() { + examination + .isAbnormal = + false; + examination + .isNormal = + true; + examination + .notExamined = + false; + }); + }), + SizedBox( + width: 12, ), - ), - )), - ), - onTap: () { - setState(() { - examination.isNormal = - false; - examination.isAbnormal = - true; - examination.notExamined = false; - }); - }),SizedBox( - width: 12, - ), - InkWell( - child: Center( - child: Container( - height: - screenSize.height * - 0.070, - decoration: - containerBorderDecoration( - examination - .notExamined - ? Color( - 0xFF515A5D) - : Colors - .white, - Colors.black), - child: Center( - child: Padding( - padding: - const EdgeInsets - .all(8.0), - child: Text( - "Not Examined", - style: TextStyle( - fontSize: 12, - color: - examination - .notExamined - ? Colors.white - : Colors - .black, - //Colors.black, - fontWeight: - FontWeight - .bold, - ), + InkWell( + child: Center( + child: Container( + height: screenSize + .height * + 0.070, + decoration: containerBorderDecoration( + examination + .isAbnormal + ? Color( + 0xFF515A5D) + : Colors + .white, + Colors + .black), + child: Center( + child: + Padding( + padding: + const EdgeInsets.all( + 8.0), + child: Text( + TranslationBase.of( + context) + .abnormal, + style: + TextStyle( + fontSize: + 12, + color: examination.isAbnormal + ? Colors.white + : Colors.black, + //Colors.black, + fontWeight: + FontWeight.bold, + ), + ), + ), + )), + ), + onTap: () { + setState(() { + examination + .isNormal = + false; + examination + .isAbnormal = + true; + examination + .notExamined = + false; + }); + }), + SizedBox( + width: 12, ), + InkWell( + child: Center( + child: Container( + height: screenSize + .height * + 0.070, + decoration: containerBorderDecoration( + examination + .notExamined + ? Color( + 0xFF515A5D) + : Colors + .white, + Colors + .black), + child: Center( + child: + Padding( + padding: + const EdgeInsets.all( + 8.0), + child: Text( + "Not Examined", + style: + TextStyle( + fontSize: + 12, + color: examination.notExamined + ? Colors.white + : Colors.black, + //Colors.black, + fontWeight: + FontWeight.bold, + ), + ), + ), + )), + ), + onTap: () { + setState(() { + examination + .isAbnormal = + false; + examination + .isNormal = + false; + examination + .notExamined = + true; + }); + }), + ], + ), + InkWell( + child: Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, ), - )), - ), - onTap: () { - setState(() { - examination.isAbnormal = - false; - examination.isNormal = - false; - examination.notExamined = true; - }); - }), - ], - ), - InkWell( - - child: Icon( - FontAwesomeIcons.trash, - color: Colors.grey, - size: 20, - ), - onTap: () => removeExamination( - examination.selectedExamination), + onTap: () => removeExamination( + examination + .selectedExamination), + ) + ], + ), + SizedBox( + height: 20, + ), + Container( + margin: EdgeInsets.only( + left: 0, right: 0, top: 15), + child: TextFields( + hasLabelText: + remarksController + .text != + '' + ? true + : false, + showLabelText: true, + hintText: + TranslationBase.of( + context) + .remarks, + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 4, + controller: + remarksController, + onChanged: (val) { + examination.remark = val; + }, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + ])); + }).toList(), ) ], - ), - SizedBox( - height: 20, - ), - Container( - margin: EdgeInsets.only( - left: 0, right: 0, top: 15), - child: TextFields( - hasLabelText: remarksController.text != ''?true:false, - showLabelText: true, - hintText: TranslationBase.of(context).remarks, - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 4, - controller: remarksController, - onChanged: (val) { - examination.remark = val; - }, - validator: (value) { - if (value == null) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - ])); - }).toList(), - ) - ], - ) - ]), - isExpand: isSysExaminationExpand, + ) + ]), + isExpand: isSysExaminationExpand, + ), + ], + ), + ), + ), + ), + ), ), - DividerWithSpacesAround(height: 30,), - AppButton( - title: TranslationBase.of(context).next, - loading: model.state == ViewState.BusyLocal, - onPressed: () async { - await submitUpdateObjectivePage(model); - }, + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: HexColor("#EAEAEA"), + fontColor: Colors.black, + onPressed: () { + widget.changePageViewIndex(0); + }, + ), + ), + SizedBox( + width: 10, ), - SizedBox( - height: 30, + Expanded( + child: AppButton( + title: TranslationBase.of(context).next, + loading: model.state == ViewState.BusyLocal, + color: HexColor("#A5A5A5"), + fontColor: HexColor("#5A5A5A"), + fontWeight: FontWeight.bold, + onPressed: () async { + await submitUpdateObjectivePage(model); + }, + ), + ), + ], ), - ], - ), - ), - ), - ))); + ), + ], + ))); } submitUpdateObjectivePage(SOAPViewModel model) async { - - if(widget.mySelectedExamination.isNotEmpty){ + if (widget.mySelectedExamination.isNotEmpty) { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); + PostPhysicalExamRequestModel postPhysicalExamRequestModel = + new PostPhysicalExamRequestModel(); widget.mySelectedExamination.forEach((exam) { if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == null) - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = + []; - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add( - ListHisProgNotePhysicalExaminationVM( + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM + .add(ListHisProgNotePhysicalExaminationVM( patientMRN: widget.patientInfo.patientMRN, episodeId: widget.patientInfo.episodeNo, appointmentNo: widget.patientInfo.appointmentNo, remarks: exam.remark ?? '', - createdBy: exam.createdBy??doctorProfile.doctorID, + createdBy: exam.createdBy ?? doctorProfile.doctorID, createdOn: DateTime.now().toIso8601String(), editedBy: doctorProfile.doctorID, editedOn: DateTime.now().toIso8601String(), @@ -450,15 +544,20 @@ class _UpdateObjectivePageState extends State { isNormal: exam.isNormal, // masterDescription: exam.selectedExamination, notExamined: exam.notExamined, - examinationType: exam.isNormal?1:exam.isAbnormal?2:3, - examinationTypeName: exam.isNormal?"Normal":exam.isAbnormal?'AbNormal':"Not Examined", - isNew:exam.isNew - - )); + examinationType: exam.isNormal + ? 1 + : exam.isAbnormal + ? 2 + : 3, + examinationTypeName: exam.isNormal + ? "Normal" + : exam.isAbnormal + ? 'AbNormal' + : "Not Examined", + isNew: exam.isNew)); }); - if(model.patientPhysicalExamList.isEmpty) { - + if (model.patientPhysicalExamList.isEmpty) { await model.postPhysicalExam(postPhysicalExamRequestModel); } else { await model.patchPhysicalExam(postPhysicalExamRequestModel); @@ -482,9 +581,8 @@ class _UpdateObjectivePageState extends State { removeExamination(MasterKeyModel masterKey) { Iterable history = widget.mySelectedExamination - .where( - (element) => - masterKey.id == element.selectedExamination.id && + .where((element) => + masterKey.id == element.selectedExamination.id && masterKey.typeId == element.selectedExamination.typeId); if (history.length > 0) @@ -494,11 +592,9 @@ class _UpdateObjectivePageState extends State { } openExaminationList(BuildContext context) { - final screenSize = MediaQuery - .of(context) - .size; - InputDecoration textFieldSelectorDecoration(String hintText, - String selectedText, bool isDropDown) { + final screenSize = MediaQuery.of(context).size; + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown) { return InputDecoration( focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), @@ -533,7 +629,8 @@ class _UpdateObjectivePageState extends State { Navigator.of(context).pop(); }); }, - removeExamination: (masterKey) => removeExamination(masterKey),); + removeExamination: (masterKey) => removeExamination(masterKey), + ); }); } } @@ -541,10 +638,13 @@ class _UpdateObjectivePageState extends State { class AddExaminationDailog extends StatefulWidget { final List mySelectedExamination; final Function addSelectedExamination; - final Function (MasterKeyModel) removeExamination; + final Function(MasterKeyModel) removeExamination; const AddExaminationDailog( - {Key key, this.mySelectedExamination, this.addSelectedExamination, this.removeExamination}) + {Key key, + this.mySelectedExamination, + this.addSelectedExamination, + this.removeExamination}) : super(key: key); @override @@ -559,71 +659,69 @@ class _AddExaminationDailogState extends State { child: BaseView( onModelReady: (model) async { if (model.physicalExaminationList.length == 0) { - await model.getMasterLookup( - MasterKeysService.PhysicalExamination); + await model + .getMasterLookup(MasterKeysService.PhysicalExamination); } }, - builder: (_, model, w) => - AppScaffold( + builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: false, body: Center( child: Container( child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).physicalSystemExamination, - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - MasterKeyCheckboxSearchWidget( - model: model, - hintSearchText: TranslationBase.of(context).searchExamination, - buttonName: TranslationBase.of(context).addExamination, - masterList: model.physicalExaminationList, - removeHistory: (history){ - setState(() { - widget.removeExamination(history); - }); - }, - addHistory: (history){ - setState(() { - MySelectedExamination mySelectedExamination = new MySelectedExamination( - selectedExamination: history - ); - widget - .mySelectedExamination - .add( - mySelectedExamination); - }); - }, - addSelectedHistories: (){ - widget.addSelectedExamination(); - }, - isServiceSelected: (master) =>isServiceSelected(master), - ), - ]), - ))), + widthFactor: 0.9, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).physicalSystemExamination, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + MasterKeyCheckboxSearchWidget( + model: model, + hintSearchText: + TranslationBase.of(context).searchExamination, + buttonName: + TranslationBase.of(context).addExamination, + masterList: model.physicalExaminationList, + removeHistory: (history) { + setState(() { + widget.removeExamination(history); + }); + }, + addHistory: (history) { + setState(() { + MySelectedExamination mySelectedExamination = + new MySelectedExamination( + selectedExamination: history); + widget.mySelectedExamination + .add(mySelectedExamination); + }); + }, + addSelectedHistories: () { + widget.addSelectedExamination(); + }, + isServiceSelected: (master) => + isServiceSelected(master), + ), + ]), + ))), )), ); } isServiceSelected(MasterKeyModel masterKey) { - Iterable exam = - widget - .mySelectedExamination - .where((element) => - masterKey.id == element.selectedExamination.id && - masterKey.typeId == element.selectedExamination.typeId); + Iterable exam = widget.mySelectedExamination.where( + (element) => + masterKey.id == element.selectedExamination.id && + masterKey.typeId == element.selectedExamination.typeId); if (exam.length > 0) { return true; }