|
|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import 'package:doctor_app_flutter/config/config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
|
|
|
|
@ -51,41 +52,48 @@ class _EndCallScreenState extends State<EndCallScreen> {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await liveCareModel
|
|
|
|
|
.startCall(isReCall: false, vCID: widget.patient.vcId)
|
|
|
|
|
.then((value) async{
|
|
|
|
|
.then((value) async {
|
|
|
|
|
await liveCareModel.getDoctorProfile();
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (liveCareModel.state == ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(liveCareModel.error);
|
|
|
|
|
}else
|
|
|
|
|
await VideoChannel.openVideoCallScreen(
|
|
|
|
|
kToken: liveCareModel.startCallRes.openTokenID,
|
|
|
|
|
kSessionId: liveCareModel.startCallRes.openSessionID,
|
|
|
|
|
kApiKey: '46209962',
|
|
|
|
|
vcId: widget.patient.vcId,
|
|
|
|
|
tokenID: await liveCareModel.getToken(),
|
|
|
|
|
generalId: GENERAL_ID,
|
|
|
|
|
doctorId: liveCareModel.doctorProfile.doctorID,
|
|
|
|
|
onFailure: (String error) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(error);
|
|
|
|
|
},
|
|
|
|
|
onCallEnd: () async{
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await liveCareModel.endCall(widget.patient.vcId, false,);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (liveCareModel.state == ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(liveCareModel.error);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onCallNotRespond: (SessionStatusModel sessionStatusModel) async{
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await liveCareModel.endCall(widget.patient.vcId, sessionStatusModel.sessionStatus == 3,);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (liveCareModel.state == ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(liveCareModel.error);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else
|
|
|
|
|
await VideoChannel.openVideoCallScreen(
|
|
|
|
|
kToken: liveCareModel.startCallRes.openTokenID,
|
|
|
|
|
kSessionId: liveCareModel.startCallRes.openSessionID,
|
|
|
|
|
kApiKey: '46209962',
|
|
|
|
|
vcId: widget.patient.vcId,
|
|
|
|
|
tokenID: await liveCareModel.getToken(),
|
|
|
|
|
generalId: GENERAL_ID,
|
|
|
|
|
doctorId: liveCareModel.doctorProfile.doctorID,
|
|
|
|
|
onFailure: (String error) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(error);
|
|
|
|
|
},
|
|
|
|
|
onCallEnd: () async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await liveCareModel.endCall(
|
|
|
|
|
widget.patient.vcId,
|
|
|
|
|
false,
|
|
|
|
|
);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (liveCareModel.state == ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(liveCareModel.error);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onCallNotRespond:
|
|
|
|
|
(SessionStatusModel sessionStatusModel) async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await liveCareModel.endCall(
|
|
|
|
|
widget.patient.vcId,
|
|
|
|
|
sessionStatusModel.sessionStatus == 3,
|
|
|
|
|
);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (liveCareModel.state == ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(liveCareModel.error);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (liveCareModel.state == ViewState.ErrorLocal) {
|
|
|
|
|
@ -103,13 +111,23 @@ class _EndCallScreenState extends State<EndCallScreen> {
|
|
|
|
|
() async {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await liveCareModel.endCallWithCharge(widget.patient.vcId);
|
|
|
|
|
await liveCareModel.getAlternativeServices(widget.patient.vcId);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (liveCareModel.state == ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(liveCareModel.error);
|
|
|
|
|
} else {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
showAlternativesDialog(context, liveCareModel, (bool isConfirmed) async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await liveCareModel.endCallWithCharge(widget.patient.vcId, isConfirmed);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (liveCareModel.state == ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(liveCareModel.error);
|
|
|
|
|
} else {
|
|
|
|
|
DrAppToastMsg.showSuccesToast("You successfully completed call with charge");
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}, isDartIcon: true, dartIcon: DoctorApp.end_consultaion),
|
|
|
|
|
@ -246,7 +264,7 @@ class _EndCallScreenState extends State<EndCallScreen> {
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
color: Colors.red[600],
|
|
|
|
|
title: "Close", //TranslationBase.of(context).close,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
@ -262,4 +280,96 @@ class _EndCallScreenState extends State<EndCallScreen> {
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showAlternativesDialog(BuildContext context, LiveCarePatientViewModel model,
|
|
|
|
|
Function(bool) okFunction) {
|
|
|
|
|
return showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
barrierDismissible: false, // user must tap button!
|
|
|
|
|
builder: (_) {
|
|
|
|
|
return Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
AlertDialog(
|
|
|
|
|
title: null,
|
|
|
|
|
content: Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height / 2,
|
|
|
|
|
child: CheckBoxListWidget(
|
|
|
|
|
model: model,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
actions: [
|
|
|
|
|
AppButton(
|
|
|
|
|
onPressed: (){
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
okFunction(true);
|
|
|
|
|
},
|
|
|
|
|
title: TranslationBase.of(context).noteConfirm,
|
|
|
|
|
fontColor: Colors.white,
|
|
|
|
|
color: Colors.green[600],
|
|
|
|
|
),
|
|
|
|
|
AppButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
okFunction(false);
|
|
|
|
|
},
|
|
|
|
|
title: TranslationBase.of(context).cancel,
|
|
|
|
|
fontColor: Colors.white,
|
|
|
|
|
color: Colors.red[600],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class CheckBoxListWidget extends StatefulWidget {
|
|
|
|
|
final LiveCarePatientViewModel model;
|
|
|
|
|
|
|
|
|
|
const CheckBoxListWidget({
|
|
|
|
|
Key key,
|
|
|
|
|
this.model,
|
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_CheckBoxListState createState() => _CheckBoxListState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _CheckBoxListState extends State<CheckBoxListWidget> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
...widget.model.alternativeServicesList
|
|
|
|
|
.map(
|
|
|
|
|
(element) => Container(
|
|
|
|
|
child: CheckboxListTile(
|
|
|
|
|
title: AppText(
|
|
|
|
|
element.serviceName,
|
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 2.2,
|
|
|
|
|
),
|
|
|
|
|
value: element.isSelected,
|
|
|
|
|
onChanged: (newValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.model
|
|
|
|
|
.setSelectedCheckboxValues(element, newValue);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
activeColor: Color(0xFFD02127),
|
|
|
|
|
controlAffinity: ListTileControlAffinity.leading,
|
|
|
|
|
contentPadding: EdgeInsets.all(0),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
.toList()
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|