|
|
|
|
@ -10,6 +10,7 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/TextFields.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/buttons/app_buttons_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
@ -17,19 +18,31 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
|
|
|
|
|
|
class DoctorReplayChat extends StatelessWidget {
|
|
|
|
|
class DoctorReplayChat extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
final ListGtMyPatientsQuestions reply;
|
|
|
|
|
TextEditingController msgController = TextEditingController();
|
|
|
|
|
final DoctorReplayViewModel previousModel;
|
|
|
|
|
bool showMsgBox = false;
|
|
|
|
|
DoctorReplayChat(
|
|
|
|
|
{Key key, this.reply, this.previousModel,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_DoctorReplayChatState createState() => _DoctorReplayChatState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _DoctorReplayChatState extends State<DoctorReplayChat> {
|
|
|
|
|
TextEditingController msgController = TextEditingController();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
if(reply.doctorResponse.isNotEmpty){
|
|
|
|
|
msgController.text = reply.doctorResponse;
|
|
|
|
|
if(widget.reply.doctorResponse.isNotEmpty){
|
|
|
|
|
msgController.text = widget.reply.doctorResponse;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
widget.showMsgBox = true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return BaseView<DoctorReplayViewModel>(
|
|
|
|
|
onModelReady: (model) async {
|
|
|
|
|
@ -72,7 +85,7 @@ class DoctorReplayChat extends StatelessWidget {
|
|
|
|
|
color: Colors.black),
|
|
|
|
|
children: <TextSpan>[
|
|
|
|
|
new TextSpan(
|
|
|
|
|
text: reply.patientName
|
|
|
|
|
text: widget.reply.patientName
|
|
|
|
|
.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Color(0xFF2B353E),
|
|
|
|
|
@ -135,7 +148,7 @@ class DoctorReplayChat extends StatelessWidget {
|
|
|
|
|
width: 50,
|
|
|
|
|
height: 50,
|
|
|
|
|
child: Image.asset(
|
|
|
|
|
reply.gender == 1
|
|
|
|
|
widget.reply.gender == 1
|
|
|
|
|
? 'assets/images/male_avatar.png'
|
|
|
|
|
: 'assets/images/female_avatar.png',
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
@ -146,7 +159,7 @@ class DoctorReplayChat extends StatelessWidget {
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.31,
|
|
|
|
|
child: AppText(
|
|
|
|
|
reply.patientName
|
|
|
|
|
widget.reply.patientName
|
|
|
|
|
.toString(),
|
|
|
|
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3,
|
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
|
@ -159,7 +172,7 @@ class DoctorReplayChat extends StatelessWidget {
|
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 0),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
launch("tel://" +reply.mobileNumber);
|
|
|
|
|
launch("tel://" +widget.reply.mobileNumber);
|
|
|
|
|
},
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.phone,
|
|
|
|
|
@ -174,14 +187,14 @@ class DoctorReplayChat extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
reply.createdOn !=null?AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(reply.createdOn)):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()),
|
|
|
|
|
widget.reply.createdOn !=null?AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(widget.reply.createdOn)):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()),
|
|
|
|
|
fontWeight: FontWeight
|
|
|
|
|
.w500,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *2.8,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
reply.createdOn !=null?AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(reply.createdOn)):AppDateUtils.getHour(DateTime.now()),
|
|
|
|
|
widget.reply.createdOn !=null?AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(widget.reply.createdOn)):AppDateUtils.getHour(DateTime.now()),
|
|
|
|
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *2.8,
|
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
@ -205,7 +218,7 @@ class DoctorReplayChat extends StatelessWidget {
|
|
|
|
|
child: Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.7,
|
|
|
|
|
child: AppText(
|
|
|
|
|
reply.remarks,
|
|
|
|
|
widget.reply.remarks,
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
@ -223,7 +236,7 @@ class DoctorReplayChat extends StatelessWidget {
|
|
|
|
|
SizedBox(height: 30,),
|
|
|
|
|
|
|
|
|
|
SizedBox(height: 30,),
|
|
|
|
|
if(reply.doctorResponse != null && reply.doctorResponse.isNotEmpty)
|
|
|
|
|
if(widget.reply.doctorResponse != null && widget.reply.doctorResponse.isNotEmpty)
|
|
|
|
|
Align(
|
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
|
child: Container(
|
|
|
|
|
@ -256,7 +269,7 @@ class DoctorReplayChat extends StatelessWidget {
|
|
|
|
|
width: 50,
|
|
|
|
|
height: 50,
|
|
|
|
|
child: Image.asset(
|
|
|
|
|
previousModel.doctorProfile.gender == 0
|
|
|
|
|
widget.previousModel.doctorProfile.gender == 0
|
|
|
|
|
? 'assets/images/male_avatar.png'
|
|
|
|
|
: 'assets/images/female_avatar.png',
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
@ -267,7 +280,7 @@ class DoctorReplayChat extends StatelessWidget {
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.35,
|
|
|
|
|
child: AppText(
|
|
|
|
|
previousModel.doctorProfile.doctorName,
|
|
|
|
|
widget.previousModel.doctorProfile.doctorName,
|
|
|
|
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3,
|
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
|
color: Color(0xFF2B353E),
|
|
|
|
|
@ -282,14 +295,14 @@ class DoctorReplayChat extends StatelessWidget {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
reply.createdOn !=null?AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(reply.createdOn)):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()),
|
|
|
|
|
widget.reply.createdOn !=null?AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(widget.reply.createdOn)):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()),
|
|
|
|
|
fontWeight: FontWeight
|
|
|
|
|
.w500,
|
|
|
|
|
color: Color(0xFF2B353E),
|
|
|
|
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *2.8,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
reply.createdOn !=null?AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(reply.createdOn)):AppDateUtils.getHour(DateTime.now()),
|
|
|
|
|
widget.reply.createdOn !=null?AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(widget.reply.createdOn)):AppDateUtils.getHour(DateTime.now()),
|
|
|
|
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *2.8,
|
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
|
color: Color(0xFF2B353E),
|
|
|
|
|
@ -313,7 +326,7 @@ class DoctorReplayChat extends StatelessWidget {
|
|
|
|
|
child: Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.7,
|
|
|
|
|
child: AppText(
|
|
|
|
|
reply.doctorResponse,
|
|
|
|
|
widget.reply.doctorResponse,
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
|
color: Color(0xFF2B353E),
|
|
|
|
|
@ -338,9 +351,39 @@ class DoctorReplayChat extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Positioned(
|
|
|
|
|
bottom: 0,
|
|
|
|
|
child: Container(
|
|
|
|
|
bottom: !widget.showMsgBox?80:0,
|
|
|
|
|
left: !widget.showMsgBox?20:0,
|
|
|
|
|
child: !widget.showMsgBox? Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
AppText("You already replied to this question."),
|
|
|
|
|
SizedBox(height: 10,),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(width: 20,),
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.8,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: AppButton(
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
color: Colors.green[600],
|
|
|
|
|
title: "Update Your Answer", //TranslationBase.of(context).close,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.showMsgBox = true;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
):Container(
|
|
|
|
|
width:MediaQuery.of(context).size.width * 1,
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.12,
|
|
|
|
|
child: Column(
|
|
|
|
|
@ -365,21 +408,16 @@ class DoctorReplayChat extends StatelessWidget {
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await previousModel.createDoctorResponse(msgController.text, reply);
|
|
|
|
|
if(previousModel.state == ViewState.ErrorLocal) {
|
|
|
|
|
Helpers.showErrorToast(previousModel.error);
|
|
|
|
|
await widget.previousModel.createDoctorResponse(msgController.text, widget.reply);
|
|
|
|
|
if(widget.previousModel.state == ViewState.ErrorLocal) {
|
|
|
|
|
Helpers.showErrorToast(widget.previousModel.error);
|
|
|
|
|
} else {
|
|
|
|
|
DrAppToastMsg.showSuccesToast("Thank you for your replay ");
|
|
|
|
|
await previousModel.getDoctorReply(isLocalBusy: false);
|
|
|
|
|
await widget.previousModel.getDoctorReply(isLocalBusy: false);
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
}
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
// hintColor: Colors.black,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
|