From 7ef7c8225c56b64f9ce1666970f1a89b47c7203c Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 7 Sep 2021 15:25:14 +0300 Subject: [PATCH] fix replay status --- lib/screens/doctor/doctor_repaly_chat.dart | 24 +++++- lib/widgets/doctor/doctor_reply_widget.dart | 82 ++++++++++----------- 2 files changed, 60 insertions(+), 46 deletions(-) diff --git a/lib/screens/doctor/doctor_repaly_chat.dart b/lib/screens/doctor/doctor_repaly_chat.dart index 72f13d4e..52331e8e 100644 --- a/lib/screens/doctor/doctor_repaly_chat.dart +++ b/lib/screens/doctor/doctor_repaly_chat.dart @@ -187,7 +187,7 @@ class _DoctorReplayChatState extends State { children: [ AppText( - widget.reply.createdOn !=null?AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(widget.reply.createdOn)):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), + widget.reply.createdOn !=null?getFormattedDate(widget.reply.createdOn):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), fontWeight: FontWeight .w500, color: Colors.white, @@ -295,7 +295,7 @@ class _DoctorReplayChatState extends State { crossAxisAlignment: CrossAxisAlignment.end, children: [ AppText( - widget.reply.responseDate !=null?AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(widget.reply.responseDate)):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), + widget.reply.responseDate !=null?getFormattedDate(widget.reply.responseDate):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), fontWeight: FontWeight .w500, color: Color(0xFF2B353E), @@ -445,4 +445,24 @@ class _DoctorReplayChatState extends State { ), )); } + + + getFormattedDate(date){ + return (AppDateUtils.getDateTimeFromServerFormat( + date) + .day + .toString() + + " " + + AppDateUtils.getMonth( + AppDateUtils.getDateTimeFromServerFormat( + date) + .month) + .toString() + .substring(0, 3) + + ' ' + + AppDateUtils.getDateTimeFromServerFormat( + date) + .year + .toString()); + } } diff --git a/lib/widgets/doctor/doctor_reply_widget.dart b/lib/widgets/doctor/doctor_reply_widget.dart index 599e4e37..32e116af 100644 --- a/lib/widgets/doctor/doctor_reply_widget.dart +++ b/lib/widgets/doctor/doctor_reply_widget.dart @@ -31,14 +31,20 @@ class _DoctorReplyWidgetState extends State { return Container( child: CardWithBgWidget( - bgColor: - widget.reply.status == 2 ? Colors.green[600] : Color(0xFFD02127), + bgColor: widget.reply.infoStatus == 0 + ? Color(0xFF2B353E) + : widget.reply.infoStatus == 4 + ? IN_PROGRESS_COLOR + : widget.reply.infoStatus == 3 + ? Color(0xFFD02127) + : Colors.green[600], hasBorder: false, widget: Container( child: InkWell( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + if(widget.reply.infoStatus != 0) Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -49,18 +55,29 @@ class _DoctorReplyWidgetState extends State { color: Colors.black), children: [ new TextSpan( - text: widget.reply.status == 2 - ? TranslationBase.of(context).active - : widget.reply.status == 1 - ? TranslationBase.of(context).onHold - : TranslationBase.of(context).cancelled, + text: widget.reply.infoStatus == 1 + ? TranslationBase.of(context).replayCallStatus + : widget.reply.infoStatus == 2 + ? TranslationBase.of(context).patientArrived + : widget.reply.infoStatus == 3 + ? TranslationBase.of(context) + .calledAndNoResponse + : widget.reply.infoStatus == 4 + ? TranslationBase.of(context) + .underProcess + : widget.reply.infoStatus == 6 + ? TranslationBase.of(context) + .textResponse + : '', style: TextStyle( - color: widget.reply.status == 2 - ? Colors.green[600] - : Color(0xFFD02127), + color: widget.reply.infoStatus == 4 + ? IN_PROGRESS_COLOR + : widget.reply.infoStatus == 3 + ? Color(0xFFD02127) + : Colors.green[600], fontWeight: FontWeight.w700, fontFamily: 'Poppins', - fontSize: 2.0 * SizeConfig.textMultiplier)), + fontSize: 1.8 * SizeConfig.textMultiplier)), ], ), ), @@ -183,37 +200,13 @@ class _DoctorReplyWidgetState extends State { label: TranslationBase.of(context).fileNumber, value: widget.reply.patientID.toString(), ), - CustomRow( label: TranslationBase.of(context).age + " : ", value: "${AppDateUtils.getAgeByBirthday(widget.reply.dateofBirth, context)}", ), - CustomRow( - width: MediaQuery.of(context).size.width * .3, - label: TranslationBase.of(context).infoStatus + - ":", - value: widget.reply.infoStatus == 1 - ? TranslationBase.of(context) - .replayCallStatus - : widget.reply.infoStatus == 2 - ? TranslationBase.of(context) - .patientArrived - : widget.reply.infoStatus == 3 - ? TranslationBase.of(context) - .calledAndNoResponse - : widget.reply.infoStatus == 4 - ? TranslationBase.of(context) - .underProcess - : widget.reply.infoStatus == 6 - ? TranslationBase.of( - context) - .textResponse - : '', - ), - SizedBox( - height: 10, + height: 8, ), ], ), @@ -227,27 +220,28 @@ class _DoctorReplyWidgetState extends State { overflow: TextOverflow.ellipsis, text: new TextSpan( style: new TextStyle( - fontSize: - 1.3 * SizeConfig.textMultiplier, + fontSize: 1.3 * SizeConfig.textMultiplier, color: Color(0xFF575757)), children: [ new TextSpan( - text: TranslationBase.of(context) - .requestType + - ": ", + text: + TranslationBase.of(context).requestType + + ": ", style: TextStyle( fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * + .getTextMultiplierBasedOnWidth() * 2.8, color: Color(0xFF575757), //TranslationBase.of(context).doctorResponse + " : ", )), new TextSpan( text: - "${widget.reply.requestTypeDescription}", + "${widget.reply.requestTypeDescription}", style: TextStyle( fontFamily: 'Poppins', - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3, color: Color(0xFF2E303A), fontWeight: FontWeight.w700, )),