first step from fixing header

fixes_before_live
Elham Rababh 5 years ago
parent 794c935d05
commit a5f3731b9a

@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]"; const ONLY_DATE = "[0-9/]";
const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
// const BASE_URL = 'https://hmgwebservices.com/'; const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/'; // const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient";

@ -12,8 +12,7 @@ import 'package:url_launcher/url_launcher.dart';
import 'large_avatar.dart'; import 'large_avatar.dart';
class PatientProfileAppBar extends StatelessWidget class PatientProfileAppBar extends StatelessWidget with PreferredSizeWidget {
with PreferredSizeWidget {
final PatiantInformtion patient; final PatiantInformtion patient;
final double height; final double height;
final bool isInpatient; final bool isInpatient;
@ -35,8 +34,7 @@ class PatientProfileAppBar extends StatelessWidget
final bool isFromLabResult; final bool isFromLabResult;
final VoidCallback onPressed; final VoidCallback onPressed;
PatientProfileAppBar( PatientProfileAppBar(this.patient,
this.patient,
{this.height = 0.0, {this.height = 0.0,
this.isInpatient = false, this.isInpatient = false,
this.isDischargedPatient = false, this.isDischargedPatient = false,
@ -53,8 +51,8 @@ class PatientProfileAppBar extends StatelessWidget
this.episode, this.episode,
this.visitDate, this.visitDate,
this.isAppointmentHeader = false, this.isAppointmentHeader = false,
this.isFromLabResult = false, this.onPressed}); this.isFromLabResult = false,
this.onPressed});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -75,24 +73,21 @@ class PatientProfileAppBar extends StatelessWidget
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
border: Border( bottom: BorderSide(color:Color(0xFFEFEFEF))) border: Border(bottom: BorderSide(color: Color(0xFFEFEFEF)))),
),
child: Container( child: Container(
padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), padding: EdgeInsets.only(left: 10, right: 10, bottom: 10),
margin: EdgeInsets.only(top: SizeConfig.isHeightVeryShort ? 30 : 50),
margin: EdgeInsets.only(top: SizeConfig.isHeightVeryShort?30: 50),
child: Column( child: Column(
children: [ children: [
Container( Container(
padding: EdgeInsets.only(left: SizeConfig.isHeightVeryShort?0: 12.0), padding: EdgeInsets.only(
left: SizeConfig.isHeightVeryShort ? 0 : 12.0),
child: Row(children: [ child: Row(children: [
IconButton( IconButton(
icon: Icon(Icons.arrow_back_ios), icon: Icon(Icons.arrow_back_ios),
color: Color(0xFF2B353E), //Colors.black, color: Color(0xFF2B353E), //Colors.black,
onPressed: () { onPressed: () {
if(onPressed!=null) if (onPressed != null) onPressed();
onPressed();
Navigator.pop(context); Navigator.pop(context);
}, },
), ),
@ -102,7 +97,8 @@ class PatientProfileAppBar extends StatelessWidget
? (Helpers.capitalize(patient.firstName) + ? (Helpers.capitalize(patient.firstName) +
" " + " " +
Helpers.capitalize(patient.lastName)) Helpers.capitalize(patient.lastName))
: Helpers.capitalize(patient.fullName??patient.patientDetails.fullName), : Helpers.capitalize(patient.fullName ??
patient.patientDetails.fullName),
fontSize: SizeConfig.textMultiplier * 1.8, fontSize: SizeConfig.textMultiplier * 1.8,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
@ -134,10 +130,11 @@ class PatientProfileAppBar extends StatelessWidget
), ),
Row(children: [ Row(children: [
Padding( Padding(
padding: EdgeInsets.only(left: SizeConfig.isHeightVeryShort?0: 12.0), padding: EdgeInsets.only(
left: SizeConfig.isHeightVeryShort ? 0 : 12.0),
child: Container( child: Container(
width: SizeConfig.getTextMultiplierBasedOnWidth()*20, width: SizeConfig.getTextMultiplierBasedOnWidth() * 20,
height: SizeConfig.getTextMultiplierBasedOnWidth()*20, height: SizeConfig.getTextMultiplierBasedOnWidth() * 20,
child: Image.asset( child: Image.asset(
gender == 1 gender == 1
? 'assets/images/male_avatar.png' ? 'assets/images/male_avatar.png'
@ -160,20 +157,22 @@ class PatientProfileAppBar extends StatelessWidget
children: [ children: [
patient.patientStatusType == 43 patient.patientStatusType == 43
? AppText( ? AppText(
TranslationBase TranslationBase.of(context).arrivedP,
.of(context)
.arrivedP,
color: Colors.green, color: Colors.green,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.5,
) )
: AppText( : AppText(
TranslationBase.of(context).notArrived, TranslationBase.of(context).notArrived,
color: Colors.red[800], color: Colors.red[800],
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.5,
), ),
patient.startTime != null patient.startTime != null
? AppText( ? AppText(
@ -181,7 +180,9 @@ class PatientProfileAppBar extends StatelessWidget
? patient.startTime ? patient.startTime
: '', : '',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.5,
color: Color(0xFF2E303A)) color: Color(0xFF2E303A))
: SizedBox() : SizedBox()
], ],
@ -194,17 +195,21 @@ class PatientProfileAppBar extends StatelessWidget
Row( Row(
children: [ children: [
AppText( AppText(
TranslationBase TranslationBase.of(context).fileNumber,
.of(context) fontSize:
.fileNumber, SizeConfig.getTextMultiplierBasedOnWidth() *
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, 3,
color: Color(0xFF575757), color: Color(0xFF575757),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
SizedBox(width: 1,), SizedBox(
width: 1,
),
AppText( AppText(
patient.patientId.toString(), patient.patientId.toString(),
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, fontSize:
SizeConfig.getTextMultiplierBasedOnWidth() *
3.5,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
isCopyable: true, isCopyable: true,
@ -214,9 +219,14 @@ class PatientProfileAppBar extends StatelessWidget
Row( Row(
children: [ children: [
AppText( AppText(
patient.nationalityName ?? patient.nationality?? patient.nationalityId ?? '', patient.nationalityName ??
patient.nationality ??
patient.nationalityId ??
'',
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, fontSize:
SizeConfig.getTextMultiplierBasedOnWidth() *
3.5,
), ),
patient.nationalityFlagURL != null patient.nationalityFlagURL != null
? ClipRRect( ? ClipRRect(
@ -236,166 +246,60 @@ class PatientProfileAppBar extends StatelessWidget
) )
], ],
), ),
Container(
child: RichText(
text: new TextSpan(
style: new TextStyle(
fontSize: 1.6 * SizeConfig.textMultiplier,
color: Colors.black,
fontFamily: 'Poppins',
),
children: <TextSpan>[
new TextSpan(
text: TranslationBase
.of(context)
.age + " : ",
style: TextStyle(fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),)),
new TextSpan(
text:
"${AppDateUtils.getAgeByBirthday(
patient.patientDetails != null
? patient.patientDetails.dateofBirth ??
""
: patient.dateofBirth ?? "", context,
isServerFormat: !isFromLiveCare)}",
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5,
color: Color(0xFF2E303A),)),
],
),
),
),
if ( patient.appointmentDate != null && patient.appointmentDate.isNotEmpty && !isFromLabResult) HeaderRow(
Row( label: TranslationBase.of(context).age + " : ",
mainAxisAlignment: MainAxisAlignment.start, value:
children: <Widget>[ "${AppDateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth ?? "" : patient.dateofBirth ?? "", context, isServerFormat: !isFromLiveCare)}",
AppText(
TranslationBase.of(context).appointmentDate +
" : ",
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3,
color: Color(0xFF575757),
fontWeight: FontWeight.w600,
fontFamily: 'Poppins',
),
SizedBox(
width: 3.5,
), ),
AppText(
AppDateUtils if (patient.appointmentDate != null &&
.getDayMonthYearDateFormatted( patient.appointmentDate.isNotEmpty &&
!isFromLabResult)
HeaderRow(
label:
TranslationBase.of(context).appointmentDate + " : ",
value: AppDateUtils.getDayMonthYearDateFormatted(
AppDateUtils.convertStringToDate( AppDateUtils.convertStringToDate(
patient.appointmentDate)) patient.appointmentDate)),
,
fontWeight: FontWeight.w700,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5,
color: Color(0xFF2E303A),
),
SizedBox(
height: 0.5,
)
],
),
if(isFromLabResult)Container(
child: RichText(
text: new TextSpan(
style: new TextStyle(
fontSize: 1.6 * SizeConfig.textMultiplier,
color: Colors.black,
fontFamily: 'Poppins',
), ),
children: <TextSpan>[ if (isFromLabResult)
new TextSpan( HeaderRow(
text: "Result Date: ", label: "Result Date: ",
style: TextStyle( fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, value:
color: Color(0xFF575757),
fontWeight: FontWeight.w600,
fontFamily: 'Poppins',)),
new TextSpan(
text:
'${AppDateUtils.getDayMonthYearDateFormatted(appointmentDate, isArabic: projectViewModel.isArabic)}', '${AppDateUtils.getDayMonthYearDateFormatted(appointmentDate, isArabic: projectViewModel.isArabic)}',
style: TextStyle(
fontWeight: FontWeight.w700, fontSize: 12)),
],
),
),
), ),
// if(isInpatient) // if(isInpatient)
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if(patient.admissionDate != null && patient.admissionDate.isNotEmpty) if (patient.admissionDate != null &&
Container( patient.admissionDate.isNotEmpty)
child: RichText( HeaderRow(
text: new TextSpan( label: patient.admissionDate == null
style: new TextStyle(
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),
fontFamily: 'Poppins',
),
children: <TextSpan>[
new TextSpan(
text: patient.admissionDate == null
? "" ? ""
: TranslationBase.of(context) : TranslationBase.of(context).admissionDate +
.admissionDate +
" : ", " : ",
style: TextStyle(fontSize: 10)), value: patient.admissionDate == null
new TextSpan(
text: patient.admissionDate == null
? "" ? ""
: "${AppDateUtils : "${AppDateUtils.getDayMonthYearDateFormatted((AppDateUtils.getDateTimeFromServerFormat(patient.admissionDate.toString())))}",
.getDayMonthYearDateFormatted(
(AppDateUtils
.getDateTimeFromServerFormat(
patient.admissionDate
.toString())))}",
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5,
color: Color(0xFF2E303A),)),
]))),
if (patient.admissionDate != null)
Row(
children: [
AppText(
"${TranslationBase.of(context).numOfDays}: ",
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757)
), ),
if(isDischargedPatient && if (patient.admissionDate != null)
patient.dischargeDate != null) HeaderRow(
AppText( label: "${TranslationBase.of(context).numOfDays}: ",
"${AppDateUtils value: isDischargedPatient &&
.getDateTimeFromServerFormat( patient.dischargeDate != null
patient.dischargeDate) ? "${AppDateUtils.getDateTimeFromServerFormat(patient.dischargeDate).difference(AppDateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}"
.difference(AppDateUtils : "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}",
.getDateTimeFromServerFormat(
patient.admissionDate))
.inDays + 1}",
fontWeight: FontWeight.w700,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5,
color: Color(0xFF2E303A),
) )
else
AppText(
"${DateTime
.now()
.difference(AppDateUtils
.getDateTimeFromServerFormat(
patient.admissionDate))
.inDays + 1}",
fontWeight: FontWeight.w700,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5,
color: Color(0xFF2E303A),),
],
),
], ],
), ),
], ],
), ),
), ),
]), ]),
if(isAppointmentHeader) if (isAppointmentHeader)
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -409,10 +313,9 @@ class PatientProfileAppBar extends StatelessWidget
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
border: Border( border: Border(
bottom: BorderSide( bottom:
color: Colors.grey[400], width: 2.5), BorderSide(color: Colors.grey[400], width: 2.5),
left: BorderSide( left: BorderSide(color: Colors.grey[400], width: 2.5),
color: Colors.grey[400], width: 2.5),
)), )),
), ),
Expanded( Expanded(
@ -430,101 +333,123 @@ class PatientProfileAppBar extends StatelessWidget
height: 25, height: 25,
margin: EdgeInsets.only(top: 10), margin: EdgeInsets.only(top: 10),
), ),
Expanded( Expanded(
flex: 5, flex: 5,
child: Container( child: Container(
margin: EdgeInsets.all(10), margin: EdgeInsets.all(10),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment crossAxisAlignment: CrossAxisAlignment.start,
.start,
children: <Widget>[ children: <Widget>[
AppText( AppText(
'${TranslationBase '${TranslationBase.of(context).dr}$doctorName',
.of(context)
.dr}$doctorName',
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.5,
), ),
if (orderNo != null && if (orderNo != null && !isPrescriptions)
!isPrescriptions)
Row( Row(
children: <Widget>[ children: <Widget>[
AppText('Order No: ', AppText(
'Order No: ',
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),), fontSize: SizeConfig
AppText(orderNo ?? '', .getTextMultiplierBasedOnWidth() *
fontSize: 12) 3,
fontWeight: FontWeight.w600,
color: Color(0xFF575757),
),
AppText(orderNo ?? '', fontSize: 12)
], ],
), ),
if (invoiceNO != null && if (invoiceNO != null && !isPrescriptions)
!isPrescriptions)
Row( Row(
children: <Widget>[ children: <Widget>[
AppText('Invoice: ', AppText(
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),), 'Invoice: ',
AppText(invoiceNO ?? "", fontSize: SizeConfig
fontSize: 12) .getTextMultiplierBasedOnWidth() *
3,
fontWeight: FontWeight.w600,
color: Color(0xFF575757),
),
AppText(invoiceNO ?? "", fontSize: 12)
], ],
), ),
if (branch != null) if (branch != null)
Row( Row(
children: [ children: [
AppText('Branch: ', AppText(
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),), 'Branch: ',
AppText(branch ?? '', fontSize: SizeConfig
fontSize: 12) .getTextMultiplierBasedOnWidth() *
3,
fontWeight: FontWeight.w600,
color: Color(0xFF575757),
),
AppText(branch ?? '', fontSize: 12)
], ],
), ),
if (clinic != null) if (clinic != null)
Row( Row(
children: [ children: [
AppText('Clinic: ', AppText(
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),), 'Clinic: ',
AppText(clinic ?? '', fontSize: SizeConfig
fontSize: 12) .getTextMultiplierBasedOnWidth() *
3,
fontWeight: FontWeight.w600,
color: Color(0xFF575757),
),
AppText(clinic ?? '', fontSize: 12)
], ],
), ),
if (isMedicalFile && if (isMedicalFile && episode != null)
episode != null)
Row( Row(
children: [ children: [
AppText('Episode: ', AppText(
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),), 'Episode: ',
AppText(episode ?? '', fontSize: SizeConfig
fontSize: 12) .getTextMultiplierBasedOnWidth() *
3,
fontWeight: FontWeight.w600,
color: Color(0xFF575757),
),
AppText(episode ?? '', fontSize: 12)
], ],
), ),
if (isMedicalFile && if (isMedicalFile && visitDate != null)
visitDate != null)
Row( Row(
children: [ children: [
AppText('Visit Date: ', AppText(
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),), 'Visit Date: ',
AppText(visitDate ?? '', fontSize: SizeConfig
fontSize: 12) .getTextMultiplierBasedOnWidth() *
3,
fontWeight: FontWeight.w600,
color: Color(0xFF575757),
),
AppText(visitDate ?? '', fontSize: 12)
], ],
), ),
if (!isMedicalFile) if (!isMedicalFile)
Row( Row(
children: <Widget>[ children: <Widget>[
AppText( AppText(
!isPrescriptions !isPrescriptions
? 'Result Date:' ? 'Result Date:'
: 'Prescriptions Date ', : 'Prescriptions Date ',
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757), fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3,
fontWeight: FontWeight.w600,
color: Color(0xFF575757),
), ),
AppText( AppText(
'${AppDateUtils '${AppDateUtils.getDayMonthYearDateFormatted(appointmentDate, isArabic: projectViewModel.isArabic)}',
.getDayMonthYearDateFormatted( fontSize: SizeConfig
appointmentDate, .getTextMultiplierBasedOnWidth() *
isArabic: projectViewModel 3.5,
.isArabic)}',
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5,
) )
], ],
) )
@ -542,9 +467,51 @@ class PatientProfileAppBar extends StatelessWidget
), ),
); );
} }
@override @override
Size get preferredSize => Size get preferredSize => Size(
Size(double.maxFinite, height == 0 double.maxFinite,
? isInpatient ? (isFromLabResult?200:190) : isAppointmentHeader ? 290 : SizeConfig.isHeightVeryShort?137:SizeConfig.isHeightShort?190: SizeConfig.heightMultiplier * (SizeConfig.isWidthLarge?25:20) height == 0
? isInpatient
? (isFromLabResult ? 200 : 190)
: isAppointmentHeader
? 290
: SizeConfig.isHeightVeryShort
? 137
: SizeConfig.isHeightShort
? 190
: SizeConfig.heightMultiplier *
(SizeConfig.isWidthLarge ? 25 : 20)
: height); : height);
} }
class HeaderRow extends StatelessWidget {
final String label;
final String value;
const HeaderRow({Key key, this.label, this.value}) : super(key: key);
@override
Widget build(BuildContext context) {
return Row(
children: [
AppText(
label,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3,
color: Color(0xFF575757),
fontWeight: FontWeight.w600,
),
SizedBox(
width: 1,
),
AppText(
value,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5,
color: Color(0xFF2E303A),
fontWeight: FontWeight.w700,
isCopyable: true,
),
],
);
}
}

@ -7,13 +7,15 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with PreferredSizeWidget { class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
with PreferredSizeWidget {
final PatiantInformtion patient; final PatiantInformtion patient;
final String patientType; final String patientType;
final String arrivalType; final String arrivalType;
@ -24,7 +26,8 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred
final Stream<String> videoCallDurationStream; final Stream<String> videoCallDurationStream;
PatientProfileHeaderNewDesignAppBar(this.patient, this.patientType, this.arrivalType, PatientProfileHeaderNewDesignAppBar(
this.patient, this.patientType, this.arrivalType,
{this.height = 0.0, {this.height = 0.0,
this.isInpatient = false, this.isInpatient = false,
this.isDischargedPatient = false, this.isDischargedPatient = false,
@ -69,8 +72,11 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred
Expanded( Expanded(
child: AppText( child: AppText(
patient.firstName != null patient.firstName != null
? (Helpers.capitalize(patient.firstName) + " " + Helpers.capitalize(patient.lastName)) ? (Helpers.capitalize(patient.firstName) +
: Helpers.capitalize(patient.fullName ?? patient.patientDetails.fullName), " " +
Helpers.capitalize(patient.lastName))
: Helpers.capitalize(patient.fullName ??
patient.patientDetails.fullName),
fontSize: SizeConfig.textMultiplier * 1.8, fontSize: SizeConfig.textMultiplier * 1.8,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
@ -103,13 +109,17 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred
), ),
StreamBuilder( StreamBuilder(
stream: videoCallDurationStream, stream: videoCallDurationStream,
builder: (BuildContext context, AsyncSnapshot<String> snapshot) { builder:
(BuildContext context, AsyncSnapshot<String> snapshot) {
if (snapshot.hasData && snapshot.data != null) if (snapshot.hasData && snapshot.data != null)
return InkWell( return InkWell(
onTap: () {}, onTap: () {},
child: Container( child: Container(
decoration: BoxDecoration(color: Colors.red, borderRadius: BorderRadius.circular(20)), decoration: BoxDecoration(
padding: EdgeInsets.symmetric(vertical: 2, horizontal: 10), color: Colors.red,
borderRadius: BorderRadius.circular(20)),
padding:
EdgeInsets.symmetric(vertical: 2, horizontal: 10),
child: Text( child: Text(
snapshot.data, snapshot.data,
style: TextStyle(color: Colors.white), style: TextStyle(color: Colors.white),
@ -129,7 +139,9 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred
width: 60, width: 60,
height: 60, height: 60,
child: Image.asset( child: Image.asset(
gender == 1 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png', gender == 1
? 'assets/images/male_avatar.png'
: 'assets/images/female_avatar.png',
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
@ -141,7 +153,8 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SERVICES_PATIANT2[int.parse(patientType)] == "patientArrivalList" SERVICES_PATIANT2[int.parse(patientType)] ==
"patientArrivalList"
? Container( ? Container(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -163,14 +176,18 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred
), ),
arrivalType == '1' || patient.arrivedOn == null arrivalType == '1' || patient.arrivedOn == null
? AppText( ? AppText(
patient.startTime != null ? patient.startTime : '', patient.startTime != null
? patient.startTime
: '',
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
) )
: AppText( : AppText(
patient.arrivedOn != null patient.arrivedOn != null
? AppDateUtils.convertStringToDateFormat( ? AppDateUtils
patient.arrivedOn, 'MM-dd-yyyy HH:mm') .convertStringToDateFormat(
patient.arrivedOn,
'MM-dd-yyyy HH:mm')
: '', : '',
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -178,13 +195,16 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred
], ],
)) ))
: SizedBox(), : SizedBox(),
if (SERVICES_PATIANT2[int.parse(patientType)] == "List_MyOutPatient" && !isFromLiveCare) if (SERVICES_PATIANT2[int.parse(patientType)] ==
"List_MyOutPatient" &&
!isFromLiveCare)
Container( Container(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
AppText( AppText(
TranslationBase.of(context).appointmentDate + " : ", TranslationBase.of(context).appointmentDate +
" : ",
fontSize: 14, fontSize: 14,
), ),
patient.startTime != null patient.startTime != null
@ -209,7 +229,8 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred
), ),
Container( Container(
child: AppText( child: AppText(
convertDateFormat2(patient.appointmentDate ?? ''), convertDateFormat2(
patient.appointmentDate ?? ''),
fontSize: 1.5 * SizeConfig.textMultiplier, fontSize: 1.5 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@ -226,23 +247,17 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
RichText( HeaderRow(
text: TextSpan( label: TranslationBase.of(context).fileNumber,
style: TextStyle(fontSize: 1.6 * SizeConfig.textMultiplier, color: Colors.black), value: patient.patientId.toString(),
children: <TextSpan>[
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( Row(
children: [ children: [
AppText( AppText(
patient.nationalityName ?? patient.nationality ?? patient.nationalityId ?? '', patient.nationalityName ??
patient.nationality ??
patient.nationalityId ??
'',
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 12, fontSize: 12,
), ),
@ -253,7 +268,9 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred
patient.nationalityFlagURL, patient.nationalityFlagURL,
height: 25, height: 25,
width: 30, width: 30,
errorBuilder: (BuildContext context, Object exception, StackTrace stackTrace) { errorBuilder: (BuildContext context,
Object exception,
StackTrace stackTrace) {
return Text('No Image'); return Text('No Image');
}, },
)) ))
@ -262,67 +279,31 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred
) )
], ],
), ),
Container( HeaderRow(
child: RichText( label: TranslationBase.of(context).age + " : ",
text: new TextSpan( value:
style: new TextStyle(
fontSize: 1.6 * SizeConfig.textMultiplier,
color: Colors.black,
fontFamily: 'Poppins',
),
children: <TextSpan>[
new TextSpan(text: TranslationBase.of(context).age + " : ", style: TextStyle(fontSize: 14)),
new TextSpan(
text:
"${AppDateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth ?? "" : patient.dateofBirth ?? "", context, isServerFormat: !isFromLiveCare)}", "${AppDateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth ?? "" : patient.dateofBirth ?? "", context, isServerFormat: !isFromLiveCare)}",
style: TextStyle(fontWeight: FontWeight.w700, fontSize: 14)),
],
),
),
), ),
if (isInpatient) if (isInpatient)
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( HeaderRow(
child: RichText( label: patient.admissionDate == null
text: new TextSpan(
style: new TextStyle(
fontSize: 2.0 * SizeConfig.textMultiplier,
color: Colors.black,
fontFamily: 'Poppins',
),
children: <TextSpan>[
new TextSpan(
text: patient.admissionDate == null
? "" ? ""
: TranslationBase.of(context).admissionDate + " : ", : TranslationBase.of(context).admissionDate +
style: TextStyle(fontSize: 14)), " : ",
new TextSpan( value: patient.admissionDate == null
text: patient.admissionDate == null
? "" ? ""
: "${AppDateUtils.convertDateFromServerFormat(patient.admissionDate.toString(), 'yyyy-MM-dd')}", : "${AppDateUtils.convertDateFromServerFormat(patient.admissionDate.toString(), 'yyyy-MM-dd')}"),
style: TextStyle(fontWeight: FontWeight.w700, fontSize: 15)),
]))),
if (patient.admissionDate != null) if (patient.admissionDate != null)
Row( HeaderRow(
children: [ label: "${TranslationBase.of(context).numOfDays}: ",
AppText( value: isDischargedPatient &&
"${TranslationBase.of(context).numOfDays}: ", patient.dischargeDate != null
fontSize: 15, ? "${AppDateUtils.getDateTimeFromServerFormat(patient.dischargeDate).difference(AppDateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}"
), : "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}",
if (isDischargedPatient && patient.dischargeDate != null) )
AppText(
"${AppDateUtils.getDateTimeFromServerFormat(patient.dischargeDate).difference(AppDateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}",
fontSize: 15,
fontWeight: FontWeight.w700)
else
AppText(
"${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}",
fontSize: 15,
fontWeight: FontWeight.w700),
],
),
], ],
) )
], ],
@ -344,7 +325,8 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred
final startIndex = str.indexOf(start); final startIndex = str.indexOf(start);
final endIndex = str.indexOf(end, startIndex + start.length); final endIndex = str.indexOf(end, startIndex + start.length);
var date = new DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex))); var date = new DateTime.fromMillisecondsSinceEpoch(
int.parse(str.substring(startIndex + start.length, endIndex)));
newDate = date.year.toString() + newDate = date.year.toString() +
"/" + "/" +
date.month.toString().padLeft(2, '0') + date.month.toString().padLeft(2, '0') +
@ -357,7 +339,8 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred
isToday(date) { isToday(date) {
DateTime tempDate = new DateFormat("yyyy-MM-dd").parse(date); DateTime tempDate = new DateFormat("yyyy-MM-dd").parse(date);
return DateFormat("yyyy-MM-dd").format(tempDate) == DateFormat("yyyy-MM-dd").format(DateTime.now()); return DateFormat("yyyy-MM-dd").format(tempDate) ==
DateFormat("yyyy-MM-dd").format(DateTime.now());
} }
myBoxDecoration() { myBoxDecoration() {

Loading…
Cancel
Save