|
|
|
|
@ -18,7 +18,8 @@ class VideoCallPage extends StatefulWidget {
|
|
|
|
|
final PatiantInformtion patientData;
|
|
|
|
|
final listContext;
|
|
|
|
|
final LiveCarePatientViewModel model;
|
|
|
|
|
VideoCallPage({required this.patientData, this.listContext, required this.model});
|
|
|
|
|
VideoCallPage(
|
|
|
|
|
{required this.patientData, this.listContext, required this.model});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_VideoCallPageState createState() => _VideoCallPageState();
|
|
|
|
|
@ -66,8 +67,12 @@ class _VideoCallPageState extends State<VideoCallPage> {
|
|
|
|
|
//'1_MX40NjgwMzIyNH5-MTU5MzY4MzYzODYwM35ucExWYVRVSm5Hcy9uWGZmM1lOa3czZHV-fg',
|
|
|
|
|
kApiKey: '46209962',
|
|
|
|
|
vcId: widget.patientData.vcId,
|
|
|
|
|
isRecording: tokenData != null ? tokenData.isRecording: false,
|
|
|
|
|
patientName: widget.patientData.fullName != null ? widget.patientData.fullName! : widget.patientData.firstName != null ? "${widget.patientData.firstName} ${widget.patientData.lastName}" : "-",
|
|
|
|
|
isRecording: tokenData != null ? tokenData.isRecording! : false,
|
|
|
|
|
patientName: widget.patientData.fullName != null
|
|
|
|
|
? widget.patientData.fullName!
|
|
|
|
|
: widget.patientData.firstName != null
|
|
|
|
|
? "${widget.patientData.firstName} ${widget.patientData.lastName}"
|
|
|
|
|
: "-",
|
|
|
|
|
tokenID: token, //"hfkjshdf347r8743",
|
|
|
|
|
generalId: "Cs2020@2016\$2958",
|
|
|
|
|
doctorId: doctorprofile['DoctorID'],
|
|
|
|
|
@ -98,7 +103,8 @@ class _VideoCallPageState extends State<VideoCallPage> {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
connectOpenTok(result);
|
|
|
|
|
}).catchError((error) => {Helpers.showErrorToast(error), Navigator.of(context).pop()});
|
|
|
|
|
}).catchError((error) =>
|
|
|
|
|
{Helpers.showErrorToast(error), Navigator.of(context).pop()});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -126,14 +132,20 @@ class _VideoCallPageState extends State<VideoCallPage> {
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
_start == 0 ? 'Dailing' : 'Connected',
|
|
|
|
|
style: TextStyle(color: Colors.deepPurpleAccent, fontWeight: FontWeight.w300, fontSize: 15),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.deepPurpleAccent,
|
|
|
|
|
fontWeight: FontWeight.w300,
|
|
|
|
|
fontSize: 15),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.02,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
widget.patientData.fullName!,
|
|
|
|
|
style: TextStyle(color: Colors.deepPurpleAccent, fontWeight: FontWeight.w900, fontSize: 20),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.deepPurpleAccent,
|
|
|
|
|
fontWeight: FontWeight.w900,
|
|
|
|
|
fontSize: 20),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.02,
|
|
|
|
|
@ -141,7 +153,10 @@ class _VideoCallPageState extends State<VideoCallPage> {
|
|
|
|
|
Container(
|
|
|
|
|
child: Text(
|
|
|
|
|
_start == 0 ? 'Connecting...' : _timmer.toString(),
|
|
|
|
|
style: TextStyle(color: Colors.deepPurpleAccent, fontWeight: FontWeight.w300, fontSize: 15),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.deepPurpleAccent,
|
|
|
|
|
fontWeight: FontWeight.w300,
|
|
|
|
|
fontSize: 15),
|
|
|
|
|
)),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.02,
|
|
|
|
|
@ -188,8 +203,8 @@ class _VideoCallPageState extends State<VideoCallPage> {
|
|
|
|
|
_showAlert(BuildContext context) async {
|
|
|
|
|
await showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (dialogContex) =>
|
|
|
|
|
AlertDialog(content: StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
|
|
|
|
|
builder: (dialogContex) => AlertDialog(content: StatefulBuilder(
|
|
|
|
|
builder: (BuildContext context, StateSetter setState) {
|
|
|
|
|
return Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.7,
|
|
|
|
|
width: MediaQuery.of(context).size.width * .9,
|
|
|
|
|
@ -202,7 +217,8 @@ class _VideoCallPageState extends State<VideoCallPage> {
|
|
|
|
|
top: -40.0,
|
|
|
|
|
child: InkResponse(
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.of(context, rootNavigator: true).pop('dialog');
|
|
|
|
|
Navigator.of(context, rootNavigator: true)
|
|
|
|
|
.pop('dialog');
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
child: CircleAvatar(
|
|
|
|
|
@ -220,7 +236,8 @@ class _VideoCallPageState extends State<VideoCallPage> {
|
|
|
|
|
padding: EdgeInsets.all(8.0),
|
|
|
|
|
child: RaisedButton(
|
|
|
|
|
onPressed: () => {endCall()},
|
|
|
|
|
child: Text(TranslationBase.of(context).endcall!),
|
|
|
|
|
child:
|
|
|
|
|
Text(TranslationBase.of(context).endcall!),
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
)),
|
|
|
|
|
@ -228,7 +245,8 @@ class _VideoCallPageState extends State<VideoCallPage> {
|
|
|
|
|
padding: EdgeInsets.all(8.0),
|
|
|
|
|
child: RaisedButton(
|
|
|
|
|
onPressed: () => {resumeCall()},
|
|
|
|
|
child: Text(TranslationBase.of(context).resumecall!),
|
|
|
|
|
child:
|
|
|
|
|
Text(TranslationBase.of(context).resumecall!),
|
|
|
|
|
color: Colors.green[900],
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
@ -237,7 +255,8 @@ class _VideoCallPageState extends State<VideoCallPage> {
|
|
|
|
|
padding: EdgeInsets.all(8.0),
|
|
|
|
|
child: RaisedButton(
|
|
|
|
|
onPressed: () => {endCallWithCharge()},
|
|
|
|
|
child: Text(TranslationBase.of(context).endcallwithcharge!),
|
|
|
|
|
child: Text(TranslationBase.of(context)
|
|
|
|
|
.endcallwithcharge!),
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -247,7 +266,8 @@ class _VideoCallPageState extends State<VideoCallPage> {
|
|
|
|
|
onPressed: () => {
|
|
|
|
|
setState(() => {isTransfer = true})
|
|
|
|
|
},
|
|
|
|
|
child: Text(TranslationBase.of(context).transfertoadmin!),
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).transfertoadmin!),
|
|
|
|
|
color: Colors.yellow[900],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -261,11 +281,14 @@ class _VideoCallPageState extends State<VideoCallPage> {
|
|
|
|
|
child: TextField(
|
|
|
|
|
maxLines: 3,
|
|
|
|
|
controller: notes,
|
|
|
|
|
decoration: InputDecoration.collapsed(hintText: "Enter your notes here"),
|
|
|
|
|
decoration: InputDecoration.collapsed(
|
|
|
|
|
hintText:
|
|
|
|
|
"Enter your notes here"),
|
|
|
|
|
)),
|
|
|
|
|
Center(
|
|
|
|
|
child: RaisedButton(
|
|
|
|
|
onPressed: () => {this.transferToAdmin(notes)},
|
|
|
|
|
onPressed: () =>
|
|
|
|
|
{this.transferToAdmin(notes)},
|
|
|
|
|
child: Text('Transfer'),
|
|
|
|
|
color: Colors.yellow[900],
|
|
|
|
|
))
|
|
|
|
|
@ -287,24 +310,33 @@ class _VideoCallPageState extends State<VideoCallPage> {
|
|
|
|
|
|
|
|
|
|
transferToAdmin(notes) {
|
|
|
|
|
closeRoute();
|
|
|
|
|
_liveCareProvider.transfterToAdmin(widget.patientData, notes).then((result) {
|
|
|
|
|
_liveCareProvider
|
|
|
|
|
.transfterToAdmin(widget.patientData, notes)
|
|
|
|
|
.then((result) {
|
|
|
|
|
connectOpenTok(result);
|
|
|
|
|
}).catchError((error) => {Helpers.showErrorToast(error), Navigator.of(context).pop()});
|
|
|
|
|
}).catchError((error) =>
|
|
|
|
|
{Helpers.showErrorToast(error), Navigator.of(context).pop()});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
endCall() {
|
|
|
|
|
closeRoute();
|
|
|
|
|
_liveCareProvider.endCall(widget.patientData, false, doctorprofile['DoctorID']).then((result) {
|
|
|
|
|
_liveCareProvider
|
|
|
|
|
.endCall(widget.patientData, false, doctorprofile['DoctorID'])
|
|
|
|
|
.then((result) {
|
|
|
|
|
print(result);
|
|
|
|
|
}).catchError((error) => {Helpers.showErrorToast(error), Navigator.of(context).pop()});
|
|
|
|
|
}).catchError((error) =>
|
|
|
|
|
{Helpers.showErrorToast(error), Navigator.of(context).pop()});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
endCallWithCharge() {
|
|
|
|
|
_liveCareProvider.endCallWithCharge(widget.patientData.vcId, doctorprofile['DoctorID']).then((result) {
|
|
|
|
|
_liveCareProvider
|
|
|
|
|
.endCallWithCharge(widget.patientData.vcId, doctorprofile['DoctorID'])
|
|
|
|
|
.then((result) {
|
|
|
|
|
closeRoute();
|
|
|
|
|
print('end callwith charge');
|
|
|
|
|
print(result);
|
|
|
|
|
}).catchError((error) => {Helpers.showErrorToast(error), Navigator.of(context).pop()});
|
|
|
|
|
}).catchError((error) =>
|
|
|
|
|
{Helpers.showErrorToast(error), Navigator.of(context).pop()});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
closeRoute() {
|
|
|
|
|
|