From 64697b82a623bb5b877a4fdc269aa6f2db847a67 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 9 Aug 2021 15:57:23 +0300 Subject: [PATCH] fix issue --- lib/core/viewModel/doctor_replay_view_model.dart | 1 + lib/screens/doctor/doctor_repaly_chat.dart | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/core/viewModel/doctor_replay_view_model.dart b/lib/core/viewModel/doctor_replay_view_model.dart index 876cfdb9..c6eab29c 100644 --- a/lib/core/viewModel/doctor_replay_view_model.dart +++ b/lib/core/viewModel/doctor_replay_view_model.dart @@ -14,6 +14,7 @@ class DoctorReplayViewModel extends BaseViewModel { Future getDoctorReply() async { setState(ViewState.Busy); + await getDoctorProfile(); await _doctorReplyService.getDoctorReply(); if (_doctorReplyService.hasError) { error = _doctorReplyService.error; diff --git a/lib/screens/doctor/doctor_repaly_chat.dart b/lib/screens/doctor/doctor_repaly_chat.dart index 9c1c5104..afe8e750 100644 --- a/lib/screens/doctor/doctor_repaly_chat.dart +++ b/lib/screens/doctor/doctor_repaly_chat.dart @@ -33,7 +33,6 @@ class DoctorReplayChat extends StatelessWidget { } return BaseView( onModelReady: (model) async { - model.getDoctorProfile(); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, @@ -256,7 +255,7 @@ class DoctorReplayChat extends StatelessWidget { width: 50, height: 50, child: Image.asset( - model.doctorProfile.gender == 0 + previousModel.doctorProfile.gender == 0 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png', fit: BoxFit.cover, @@ -267,7 +266,7 @@ class DoctorReplayChat extends StatelessWidget { Container( width: MediaQuery.of(context).size.width * 0.35, child: AppText( - model.doctorProfile.doctorName, + previousModel.doctorProfile.doctorName, fontSize: 14, fontFamily: 'Poppins', color: Color(0xFF2B353E), @@ -360,9 +359,9 @@ class DoctorReplayChat extends StatelessWidget { suffixIconColor: Colors.green, onSuffixTap: ()async { GifLoaderDialogUtils.showMyDialog(context); - await model.createDoctorResponse(msgController.text, reply); - if(model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); + await previousModel.createDoctorResponse(msgController.text, reply); + if(previousModel.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(previousModel.error); } else { DrAppToastMsg.showSuccesToast("Thank you for your replay "); await previousModel.getDoctorReply();