import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.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/doctor/list_gt_my_patients_question_model.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/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; class DoctorReplyWidget extends StatefulWidget { final ListGtMyPatientsQuestions reply; bool isShowMore = false; DoctorReplyWidget({Key key, this.reply}); @override _DoctorReplyWidgetState createState() => _DoctorReplyWidgetState(); } class _DoctorReplyWidgetState extends State { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return Container( child: CardWithBgWidget( bgColor: widget.reply.status == 2 ? Colors.green[600] : Color(0xFFD02127), hasBorder: false, widget: Container( child: InkWell( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ RichText( text: new TextSpan( style: new TextStyle( fontSize: 2.0 * SizeConfig.textMultiplier, 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, style: TextStyle( color: widget.reply.status == 2 ? Colors.green[600] : Color(0xFFD02127), fontWeight: FontWeight.w700, fontFamily: 'Poppins', fontSize: 2.0 * SizeConfig.textMultiplier)), ], ), ), Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ AppText( AppDateUtils.getDateTimeFromServerFormat( widget.reply.createdOn) .day .toString() + " " + AppDateUtils.getMonth( AppDateUtils.getDateTimeFromServerFormat( widget.reply.createdOn) .month) .toString() .substring(0, 3) + ' ' + AppDateUtils.getDateTimeFromServerFormat( widget.reply.createdOn) .year .toString(), fontFamily: 'Poppins', fontWeight: FontWeight.w600, ), AppText( AppDateUtils.getDateTimeFromServerFormat( widget.reply.createdOn) .hour .toString() + ":" + AppDateUtils.getDateTimeFromServerFormat( widget.reply.createdOn) .minute .toString(), fontFamily: 'Poppins', fontWeight: FontWeight.w600, ) ], ), ], ), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: AppText( Helpers.capitalize(widget.reply.patientName), fontSize: SizeConfig.textMultiplier * 2.5, fontWeight: FontWeight.bold, fontFamily: 'Poppins', ), ), Container( margin: EdgeInsets.symmetric(horizontal: 4), child: InkWell( onTap: () { launch("tel://" + widget.reply.mobileNumber); }, child: Icon( Icons.phone, color: Colors.black87, ), ), ), SizedBox( width: 4, ), widget.reply.gender == 1 ? Icon( DoctorApp.male_2, color: Colors.blue, ) : Icon( DoctorApp.female_1, color: Colors.pink, ), ], ), SizedBox( height: 20, ), Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ Column( mainAxisAlignment: MainAxisAlignment.start, children: [ Container( margin: EdgeInsets.only(top: 5), width: 60, height: 60, child: Image.asset( widget.reply.gender == 1 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png', fit: BoxFit.cover, ), ), ], ), SizedBox( width: 20, ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // SizedBox(height: 10,), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ CustomRow( 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, ), ], ), ], ), Container( width: MediaQuery.of(context).size.width * 0.5, child: RichText( maxLines: 3, overflow: TextOverflow.ellipsis, text: new TextSpan( style: new TextStyle( fontSize: 1.3 * SizeConfig.textMultiplier, color: Color(0xFF575757)), children: [ new TextSpan( text: TranslationBase.of(context) .requestType + ": ", style: TextStyle( fontSize: SizeConfig .getTextMultiplierBasedOnWidth() * 2.8, color: Color(0xFF575757), //TranslationBase.of(context).doctorResponse + " : ", )), new TextSpan( text: "${widget.reply.requestTypeDescription}", style: TextStyle( fontFamily: 'Poppins', fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, color: Color(0xFF2E303A), fontWeight: FontWeight.w700, )), ], ), ), ), ], ) ], ), // Container( // alignment: projectViewModel.isArabic?Alignment.centerLeft:Alignment.centerRight, // child: Icon(FontAwesomeIcons.arrowRight, // size: 20, color: Colors.black),) ], ), // onTap: onTap, )), ), ); } }