live care chages

pull/159/head
Sultan Khan 6 years ago
parent 2a5b0c6683
commit 3f7ef48fd5

@ -74,6 +74,9 @@ const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE =
const MEMBER_CHECK_ACTIVATION_CODE_NEW = const MEMBER_CHECK_ACTIVATION_CODE_NEW =
'Services/Sentry.svc/REST/MemberCheckActivationCode_New'; 'Services/Sentry.svc/REST/MemberCheckActivationCode_New';
const GET_DOC_PROFILES = 'Services/Doctors.svc/REST/GetDocProfiles'; const GET_DOC_PROFILES = 'Services/Doctors.svc/REST/GetDocProfiles';
const TRANSFERT_TO_ADMIN = 'LiveCareApi/DoctorApp/TransferToAdmin';
const END_CALL = 'LiveCareApi/DoctorApp/EndCall';
const END_CALL_WITH_CHARGE = 'LiveCareApi/DoctorApp/CompleteCallWithCharge';
var selectedPatientType = 1; var selectedPatientType = 1;

@ -216,4 +216,8 @@ const Map<String, Map<String, String>> localizedValues = {
'beingGreat': {'en': 'being great', 'ar': 'رائع'}, 'beingGreat': {'en': 'being great', 'ar': 'رائع'},
'cancel': {'en': 'CANCEL', 'ar': 'الغاء'}, 'cancel': {'en': 'CANCEL', 'ar': 'الغاء'},
'done': {'en': 'DONE', 'ar': 'تأكيد'}, 'done': {'en': 'DONE', 'ar': 'تأكيد'},
'resumecall': {'en': 'Resume call', 'ar': 'استئناف المكالمة'},
'endcallwithcharge': {'en': 'End with charge', 'ar': 'ينتهي مع الشحن'},
'endcall': {'en': 'End Call', 'ar': 'إنهاء المكالمة'},
'transfertoadmin': {'en': 'Transfer to admin', 'ar': 'نقل إلى المسؤول'},
}; };

@ -0,0 +1,28 @@
class EndCallReq {
int vCID;
String tokenID;
String generalid;
int doctorId;
bool isDestroy;
EndCallReq(
{this.vCID, this.tokenID, this.generalid, this.doctorId, this.isDestroy});
EndCallReq.fromJson(Map<String, dynamic> json) {
vCID = json['VC_ID'];
tokenID = json['TokenID'];
generalid = json['generalid'];
doctorId = json['DoctorId'];
isDestroy = json['IsDestroy'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['VC_ID'] = this.vCID;
data['TokenID'] = this.tokenID;
data['generalid'] = this.generalid;
data['DoctorId'] = this.doctorId;
data['IsDestroy'] = this.isDestroy;
return data;
}
}

@ -0,0 +1,32 @@
class StartCallRes {
String result;
String openSessionID;
String openTokenID;
bool isAuthenticated;
int messageStatus;
StartCallRes(
{this.result,
this.openSessionID,
this.openTokenID,
this.isAuthenticated,
this.messageStatus});
StartCallRes.fromJson(Map<String, dynamic> json) {
result = json['Result'];
openSessionID = json['OpenSessionID'];
openTokenID = json['OpenTokenID'];
isAuthenticated = json['IsAuthenticated'];
messageStatus = json['MessageStatus'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Result'] = this.result;
data['OpenSessionID'] = this.openSessionID;
data['OpenTokenID'] = this.openTokenID;
data['IsAuthenticated'] = this.isAuthenticated;
data['MessageStatus'] = this.messageStatus;
return data;
}
}

@ -0,0 +1,36 @@
class TransferToAdminReq {
int vCID;
String tokenID;
String generalid;
int doctorId;
bool isOutKsa;
String notes;
TransferToAdminReq(
{this.vCID,
this.tokenID,
this.generalid,
this.doctorId,
this.isOutKsa,
this.notes});
TransferToAdminReq.fromJson(Map<String, dynamic> json) {
vCID = json['VC_ID'];
tokenID = json['TokenID'];
generalid = json['generalid'];
doctorId = json['DoctorId'];
isOutKsa = json['IsOutKsa'];
notes = json['Notes'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['VC_ID'] = this.vCID;
data['TokenID'] = this.tokenID;
data['generalid'] = this.generalid;
data['DoctorId'] = this.doctorId;
data['IsOutKsa'] = this.isOutKsa;
data['Notes'] = this.notes;
return data;
}
}

@ -2,9 +2,12 @@ import 'dart:convert';
import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/models/livecare/end_call_req.dart';
import 'package:doctor_app_flutter/models/livecare/get_panding_req_list.dart'; import 'package:doctor_app_flutter/models/livecare/get_panding_req_list.dart';
import 'package:doctor_app_flutter/models/livecare/get_pending_res_list.dart'; import 'package:doctor_app_flutter/models/livecare/get_pending_res_list.dart';
import 'package:doctor_app_flutter/models/livecare/start_call_req.dart'; import 'package:doctor_app_flutter/models/livecare/start_call_req.dart';
import 'package:doctor_app_flutter/models/livecare/start_call_res.dart';
import 'package:doctor_app_flutter/models/livecare/transfer_to_admin.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -14,7 +17,9 @@ class LiveCareProvider with ChangeNotifier {
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
List<LiveCarePendingListResponse> liveCarePendingList = []; List<LiveCarePendingListResponse> liveCarePendingList = [];
var inCallResponse = {}; StartCallRes inCallResponse;
var transferToAdmin = {};
var endCallResponse = {};
bool isFinished = true; bool isFinished = true;
bool hasError = false; bool hasError = false;
String errorMsg = ''; String errorMsg = '';
@ -45,27 +50,76 @@ class LiveCareProvider with ChangeNotifier {
return Future.value(liveCarePendingList); return Future.value(liveCarePendingList);
} }
Future<Map> startCall(request, bool isReCall) async { Future<StartCallRes> startCall(request, bool isReCall) async {
var profile = await sharedPref.getObj(DOCTOR_PROFILE); var profile = await sharedPref.getObj(DOCTOR_PROFILE);
resetDefaultValues(); resetDefaultValues();
/* the request model is not same hence added manually */ /* the request model is not same hence added manually */
var newRequest = new StartCallReq(); var newRequest = new StartCallReq();
newRequest.clinicId = profile["ClinicID"]; newRequest.clinicId = profile["ClinicID"];
newRequest.vCID = request["VC_ID"]; newRequest.vCID = request.vCID; //["VC_ID"];
newRequest.isrecall = isReCall; newRequest.isrecall = isReCall;
newRequest.doctorId = profile["DoctorID"]; newRequest.doctorId = profile["DoctorID"];
newRequest.isOutKsa = request["IsOutKSA"]; newRequest.isOutKsa = request.isOutKSA; //["IsOutKSA"];
newRequest.projectName = profile["ProjectName"]; newRequest.projectName = profile["ProjectName"];
newRequest.docotrName = profile["DoctorName"]; newRequest.docotrName = profile["DoctorName"];
newRequest.clincName = profile["ClinicDescription"]; newRequest.clincName = profile["ClinicDescription"];
newRequest.clincName = profile["ClinicDescription"];
newRequest.docSpec = profile["DoctorTitleForProfile"]; newRequest.docSpec = profile["DoctorTitleForProfile"];
newRequest.generalid = 'Cs2020@2016\$2958'; newRequest.generalid = 'Cs2020@2016\$2958';
isFinished = false; isFinished = false;
await BaseAppClient.post(START_LIVECARE_CALL, await BaseAppClient.post(START_LIVECARE_CALL,
onSuccess: (response, statusCode) async { onSuccess: (response, statusCode) async {
isFinished = true; isFinished = true;
inCallResponse = response; inCallResponse = StartCallRes.fromJson(response);
}, onFailure: (String error, int statusCode) {
isFinished = true;
throw error;
}, body: newRequest.toJson());
return Future.value(inCallResponse);
}
transfterToAdmin(request, notes) async {
var profile = await sharedPref.getObj(DOCTOR_PROFILE);
var newRequest = new TransferToAdminReq();
newRequest.doctorId = profile["DoctorID"];
newRequest.isOutKsa = request.isOutKSA;
newRequest.generalid = 'Cs2020@2016\$2958';
newRequest.vCID = request.vCID; //["VC_ID"];
newRequest.notes = await BaseAppClient.post(TRANSFERT_TO_ADMIN,
onSuccess: (response, statusCode) async {
isFinished = true;
transferToAdmin = response;
}, onFailure: (String error, int statusCode) {
isFinished = true;
throw error;
}, body: newRequest.toJson());
return Future.value(inCallResponse);
}
endCall(request, isPaitent, doctorID) async {
var newRequest = new EndCallReq();
newRequest.doctorId = doctorID; //profile["DoctorID"];
newRequest.generalid = 'Cs2020@2016\$2958';
newRequest.vCID = request.vCID; //["VC_ID"];
newRequest.isDestroy = isPaitent;
await BaseAppClient.post(END_CALL, onSuccess: (response, statusCode) async {
isFinished = true;
endCallResponse = response;
}, onFailure: (String error, int statusCode) {
isFinished = true;
throw error;
}, body: newRequest.toJson());
return Future.value(inCallResponse);
}
endCallWithCharge(vcID, doctorID) async {
var newRequest = new EndCallReq();
newRequest.vCID = vcID;
newRequest.doctorId = doctorID;
newRequest.generalid = 'Cs2020@2016\$2958';
await BaseAppClient.post(END_CALL_WITH_CHARGE,
onSuccess: (response, statusCode) async {
isFinished = true;
endCallResponse = response;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
isFinished = true; isFinished = true;
throw error; throw error;

@ -72,8 +72,9 @@ const String PATIENT_INSURANCE_APPROVALS =
const String VITAL_SIGN_DETAILS = 'patients/vital-sign-details'; const String VITAL_SIGN_DETAILS = 'patients/vital-sign-details';
const String BODY_MEASUREMENTS = 'patients/body-measurements'; const String BODY_MEASUREMENTS = 'patients/body-measurements';
const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details';
const String VIDEO_CALL = 'video-call'; // const String VIDEO_CALL = 'video-call';
const String LIVECARE_PENDING_LIST = 'livecare-pendinglist'; const String LIVECARE_PENDING_LIST = 'livecare-pendinglist';
// const String LIVECARE_END_DIALOG = 'video-call/EndCallDialogBox';
var routes = { var routes = {
ROOT: (_) => RootPage(), ROOT: (_) => RootPage(),
HOME: (_) => LandingPage(), HOME: (_) => LandingPage(),
@ -108,6 +109,7 @@ var routes = {
VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(),
BODY_MEASUREMENTS: (_) => VitalSignItemDetailsScreen(), BODY_MEASUREMENTS: (_) => VitalSignItemDetailsScreen(),
IN_PATIENT_PRESCRIPTIONS_DETAILS: (_) => InpatientPrescriptionDetailsScreen(), IN_PATIENT_PRESCRIPTIONS_DETAILS: (_) => InpatientPrescriptionDetailsScreen(),
VIDEO_CALL: (_) => VideoCallPage(), // VIDEO_CALL: (_) => VideoCallPage(patientData: null),
LIVECARE_PENDING_LIST: (_) => LiveCarePandingListScreen() LIVECARE_PENDING_LIST: (_) => LiveCarePandingListScreen(),
// LIVECARE_END_DIALOG: (_) => EndCallDialogBox()
}; };

@ -1,5 +1,6 @@
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/providers/livecare_provider.dart'; import 'package:doctor_app_flutter/providers/livecare_provider.dart';
import 'package:doctor_app_flutter/screens/live_care/video_call.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
@ -204,12 +205,20 @@ class _LiveCarePandingListState extends State<LiveCarePandingListScreen> {
.green, //Colors.black, .green, //Colors.black,
onPressed: () => { onPressed: () => {
_isInit = true, _isInit = true,
sharedPref.setObj( // sharedPref.setObj(
LIVE_CARE_PATIENT, // LIVE_CARE_PATIENT,
item), // item),
Navigator.of(context) // Navigator.of(context)
.pushNamed( // .pushNamed(
VIDEO_CALL) // VIDEO_CALL,
// item)
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
VideoCallPage(
item,
context)))
}, },
), ),
) )
@ -250,3 +259,13 @@ class _LiveCarePandingListState extends State<LiveCarePandingListScreen> {
); );
} }
} }
MyGlobals myGlobals = new MyGlobals();
class MyGlobals {
GlobalKey _scaffoldKey;
MyGlobals() {
_scaffoldKey = GlobalKey();
}
GlobalKey get scaffoldKey => _scaffoldKey;
}

@ -1,16 +1,25 @@
import 'dart:async'; import 'dart:async';
import 'package:doctor_app_flutter/models/livecare/get_pending_res_list.dart';
import 'package:doctor_app_flutter/models/livecare/session_status_model.dart'; import 'package:doctor_app_flutter/models/livecare/session_status_model.dart';
import 'package:doctor_app_flutter/models/livecare/start_call_res.dart';
import 'package:doctor_app_flutter/providers/livecare_provider.dart'; import 'package:doctor_app_flutter/providers/livecare_provider.dart';
import 'package:doctor_app_flutter/screens/live_care/panding_list.dart';
import 'package:doctor_app_flutter/util/VideoChannel.dart'; import 'package:doctor_app_flutter/util/VideoChannel.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import '../../routes.dart';
class VideoCallPage extends StatefulWidget { class VideoCallPage extends StatefulWidget {
final LiveCarePendingListResponse patientData;
final listContext;
VideoCallPage(this.patientData, this.listContext);
@override @override
_VideoCallPageState createState() => _VideoCallPageState(); _VideoCallPageState createState() => _VideoCallPageState();
} }
@ -24,65 +33,67 @@ class _VideoCallPageState extends State<VideoCallPage> {
LiveCareProvider _liveCareProvider; LiveCareProvider _liveCareProvider;
bool _isInit = true; bool _isInit = true;
var _tokenData; var _tokenData;
var patientData = {}; bool isTransfer = false;
String image_url = 'https://hmgwebservices.com/Images/MobileImages/DUBAI/'; String image_url = 'https://hmgwebservices.com/Images/MobileImages/DUBAI/';
//bool _isOutOfStuck = false; //bool _isOutOfStuck = false;
Helpers helpers = new Helpers(); Helpers helpers = new Helpers();
var doctorprofile = {};
var notes;
@override @override
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();
if (_isInit) { if (_isInit) {
_liveCareProvider = Provider.of<LiveCareProvider>(context); _liveCareProvider = Provider.of<LiveCareProvider>(context);
startCall(); startCall(false);
} }
_isInit = false; _isInit = false;
} }
void connectOpenTok(tokenData) async { void connectOpenTok(StartCallRes tokenData) async {
_tokenData = tokenData; _tokenData = tokenData;
//var profile = await sharedPref.getObj(DOCTOR_PROFILE);
var token = await sharedPref.getString(TOKEN);
doctorprofile = await sharedPref.getObj(DOCTOR_PROFILE);
/* opentok functionalites need to be written */ /* opentok functionalites need to be written */
await VideoChannel.openVideoCallScreen( await VideoChannel.openVideoCallScreen(
kToken: kToken: tokenData.openTokenID,
'T1==cGFydG5lcl9pZD00NjgwMzIyNCZzaWc9NWRhNmExMzU4ZDViZGU3OTA5NDY4ODRhNzI4ZGUxZTRmMjZmNzcwMjpzZXNzaW9uX2lkPTFfTVg0ME5qZ3dNekl5Tkg1LU1UVTVNelk0TXpZek9EWXdNMzV1Y0V4V1lWUlZTbTVIY3k5dVdHWm1NMWxPYTNjelpIVi1mZyZjcmVhdGVfdGltZT0xNTkzNjgzNjYyJm5vbmNlPTAuODAxMzMzMzUxMDQwNzE5NSZyb2xlPXB1Ymxpc2hlciZleHBpcmVfdGltZT0xNTk2Mjc1NjYyJmluaXRpYWxfbGF5b3V0X2NsYXNzX2xpc3Q9',
kSessionId: //'T1==cGFydG5lcl9pZD00NjgwMzIyNCZzaWc9NWRhNmExMzU4ZDViZGU3OTA5NDY4ODRhNzI4ZGUxZTRmMjZmNzcwMjpzZXNzaW9uX2lkPTFfTVg0ME5qZ3dNekl5Tkg1LU1UVTVNelk0TXpZek9EWXdNMzV1Y0V4V1lWUlZTbTVIY3k5dVdHWm1NMWxPYTNjelpIVi1mZyZjcmVhdGVfdGltZT0xNTkzNjgzNjYyJm5vbmNlPTAuODAxMzMzMzUxMDQwNzE5NSZyb2xlPXB1Ymxpc2hlciZleHBpcmVfdGltZT0xNTk2Mjc1NjYyJmluaXRpYWxfbGF5b3V0X2NsYXNzX2xpc3Q9',
'1_MX40NjgwMzIyNH5-MTU5MzY4MzYzODYwM35ucExWYVRVSm5Hcy9uWGZmM1lOa3czZHV-fg', kSessionId: tokenData.openSessionID,
kApiKey: '46803224', //'1_MX40NjgwMzIyNH5-MTU5MzY4MzYzODYwM35ucExWYVRVSm5Hcy9uWGZmM1lOa3czZHV-fg',
vcId: 3245, kApiKey: '46209962',
tokenID: "hfkjshdf347r8743", vcId: widget.patientData.vCID,
tokenID: token, //"hfkjshdf347r8743",
generalId: "Cs2020@2016\$2958", generalId: "Cs2020@2016\$2958",
doctorId: 1485, doctorId: doctorprofile['DoctorID'],
onFailure: (String error) { onFailure: (String error) {
//TODO handling Failure //TODO handling Failure
//changeRoute(context);
}, },
onCallEnd: () { onCallEnd: () {
//TODO handling onCallEnd //TODO handling onCallEnd
WidgetsBinding.instance.addPostFrameCallback((_) {
changeRoute(context);
});
}, },
onCallNotRespond: (SessionStatusModel sessionStatusModel) { onCallNotRespond: (SessionStatusModel sessionStatusModel) {
//TODO handling onCalcallNotRespondlEnd //TODO handling onCalcallNotRespondlEnd
WidgetsBinding.instance.addPostFrameCallback((_) {
changeRoute(context);
});
}); });
} }
String getTimerTime(int start) { startCall(bool isRecall) async {
int minutes = (start ~/ 60); //patientData = await sharedPref.getObj(LIVE_CARE_PATIENT);
String sMinute = ''; _liveCareProvider.startCall(widget.patientData, isRecall).then((result) {
if (minutes.toString().length == 1) { // //startTimmer();
sMinute = '0' + minutes.toString(); setState(() {
} else _start = 1;
sMinute = minutes.toString(); });
int seconds = (start % 60);
String sSeconds = '';
if (seconds.toString().length == 1) {
sSeconds = '0' + seconds.toString();
} else
sSeconds = seconds.toString();
return sMinute + ':' + sSeconds;
}
startCall() async {
patientData = await sharedPref.getObj(LIVE_CARE_PATIENT);
_liveCareProvider.startCall(patientData, false).then((result) {
connectOpenTok(result); connectOpenTok(result);
}).catchError((error) => }).catchError((error) =>
{helpers.showErrorToast(error), Navigator.of(context).pop()}); {helpers.showErrorToast(error), Navigator.of(context).pop()});
@ -96,134 +107,231 @@ class _VideoCallPageState extends State<VideoCallPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: SafeArea( body: Container(
child: Container( height: MediaQuery.of(context).size.height,
height: MediaQuery.of(context).size.height, width: MediaQuery.of(context).size.width,
width: MediaQuery.of(context).size.width, decoration: BoxDecoration(
decoration: BoxDecoration( color: Colors.white,
color: Colors.white, ),
padding: EdgeInsets.all(50.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 10.0,
), ),
padding: EdgeInsets.all(50.0), Text(
child: Column( _start == 0 ? 'Dailing' : 'Connected',
mainAxisAlignment: MainAxisAlignment.start, style: TextStyle(
mainAxisSize: MainAxisSize.max, color: Colors.deepPurpleAccent,
crossAxisAlignment: CrossAxisAlignment.center, fontWeight: FontWeight.w300,
children: <Widget>[ fontSize: 15),
SizedBox( ),
height: 10.0, SizedBox(
), height: MediaQuery.of(context).size.height * 0.02,
Text( ),
'Dailing...', Text(
style: TextStyle( widget.patientData.patientName,
color: Colors.deepPurpleAccent, style: TextStyle(
fontWeight: FontWeight.w300, color: Colors.deepPurpleAccent,
fontSize: 15), fontWeight: FontWeight.w900,
), fontSize: 20),
SizedBox(
height: MediaQuery.of(context).size.height * 0.02,
),
Text(
patientData["PatientName"],
style: TextStyle(
color: Colors.deepPurpleAccent,
fontWeight: FontWeight.w900,
fontSize: 20),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.02,
),
Container(
child: Text(
_timmer == '' ? 'Connecting' : 'Connected',
style: TextStyle(
color: Colors.deepPurpleAccent,
fontWeight: FontWeight.w300,
fontSize: 15),
)),
SizedBox(
height: MediaQuery.of(context).size.height * 0.02,
),
ClipRRect(
borderRadius: BorderRadius.circular(200.0),
child: Image.network(
patientData["Gender"] == "1"
? image_url + 'unkown.png'
: image_url + 'unkowwn_female.png',
height: 200.0,
width: 200.0,
),
),
SizedBox(
height: MediaQuery.of(context).size.height * .2,
),
Container(
width: 70.0,
height: 70.0,
child: FloatingActionButton(
onPressed: () {
Navigator.of(context).pop();
},
elevation: 30.0,
shape: CircleBorder(side: BorderSide(color: Colors.red)),
mini: false,
child: Icon(
Icons.call_end,
color: Colors.red,
size: 35,
),
backgroundColor: Colors.red[100],
))
],
), ),
), SizedBox(
height: MediaQuery.of(context).size.height * 0.02,
),
Container(
child: Text(
_start == 0 ? 'Connecting...' : _timmer.toString(),
style: TextStyle(
color: Colors.deepPurpleAccent,
fontWeight: FontWeight.w300,
fontSize: 15),
)),
SizedBox(
height: MediaQuery.of(context).size.height * 0.02,
),
ClipRRect(
borderRadius: BorderRadius.circular(200.0),
child: Image.network(
image_url + 'unkown.png',
height: 200.0,
width: 200.0,
),
),
SizedBox(
height: MediaQuery.of(context).size.height * .2,
),
Container(
width: 70.0,
height: 70.0,
child: FloatingActionButton(
onPressed: () {
Navigator.of(context).pop();
},
elevation: 30.0,
shape: CircleBorder(side: BorderSide(color: Colors.red)),
mini: false,
child: Icon(
Icons.call_end,
color: Colors.red,
size: 35,
),
backgroundColor: Colors.red[100],
))
],
), ),
); ));
}
changeRoute(con) async {
// await Future.delayed(Duration(seconds: 1), () {
_showAlert(con);
//});
} }
}
class FunctionalButton extends StatefulWidget { _showAlert(BuildContext context) async {
final title; await showDialog(
final icon; context: context,
final Function() onPressed; 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,
child: Stack(
fit: StackFit.loose,
overflow: Overflow.visible,
children: <Widget>[
Positioned(
right: -40.0,
top: -40.0,
child: InkResponse(
onTap: () {
Navigator.of(context, rootNavigator: true)
.pop('dialog');
Navigator.of(context).pop();
},
child: CircleAvatar(
child: Icon(Icons.close),
backgroundColor: Colors.red,
),
),
),
Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(
padding: EdgeInsets.all(8.0),
child: RaisedButton(
onPressed: () => {endCall()},
child:
Text(TranslationBase.of(context).endcall),
color: Colors.red,
textColor: Colors.white,
)),
Padding(
padding: EdgeInsets.all(8.0),
child: RaisedButton(
onPressed: () => {resumeCall()},
child:
Text(TranslationBase.of(context).resumecall),
color: Colors.green[900],
textColor: Colors.white,
),
),
Padding(
padding: EdgeInsets.all(8.0),
child: RaisedButton(
onPressed: () => {endCallWithCharge()},
child: Text(TranslationBase.of(context)
.endcallwithcharge),
textColor: Colors.white,
),
),
Padding(
padding: EdgeInsets.all(8.0),
child: RaisedButton(
onPressed: () => {
setState(() => {isTransfer = true})
},
child: Text(
TranslationBase.of(context).transfertoadmin),
color: Colors.yellow[900],
),
),
isTransfer == true
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('Notes'),
Padding(
padding: EdgeInsets.all(5.0),
child: TextField(
maxLines: 3,
controller: notes,
decoration: InputDecoration.collapsed(
hintText:
"Enter your notes here"),
)),
Center(
child: RaisedButton(
onPressed: () =>
{this.transferToAdmin(notes)},
child: Text('Transfer'),
color: Colors.yellow[900],
))
],
)
: SizedBox()
],
))
],
));
})));
Navigator.pop(context);
}
const FunctionalButton({Key key, this.title, this.icon, this.onPressed}) resumeCall() {
: super(key: key); closeRoute();
startCall(true);
}
@override transferToAdmin(notes) {
_FunctionalButtonState createState() => _FunctionalButtonState(); closeRoute();
} _liveCareProvider
.transfterToAdmin(widget.patientData, notes)
.then((result) {
connectOpenTok(result);
}).catchError((error) =>
{helpers.showErrorToast(error), Navigator.of(context).pop()});
}
class _FunctionalButtonState extends State<FunctionalButton> { endCall() {
@override closeRoute();
Widget build(BuildContext context) { _liveCareProvider
return Column( .endCall(widget.patientData, false, doctorprofile['DoctorID'])
mainAxisAlignment: MainAxisAlignment.start, .then((result) {
crossAxisAlignment: CrossAxisAlignment.center, print(result);
mainAxisSize: MainAxisSize.min, }).catchError((error) =>
children: <Widget>[ {helpers.showErrorToast(error), Navigator.of(context).pop()});
RawMaterialButton( }
onPressed: widget.onPressed,
splashColor: Colors.deepPurpleAccent, endCallWithCharge() {
fillColor: Colors.white, _liveCareProvider
elevation: 10.0, .endCallWithCharge(widget.patientData.vCID, doctorprofile['DoctorID'])
shape: CircleBorder(), .then((result) {
child: Padding( closeRoute();
padding: const EdgeInsets.all(15.0), print('end callwith charge');
child: Icon( print(result);
widget.icon, }).catchError((error) =>
size: 30.0, {helpers.showErrorToast(error), Navigator.of(context).pop()});
color: Colors.deepPurpleAccent, }
),
), closeRoute() {
), Navigator.of(context).pop();
Container(
margin: EdgeInsets.symmetric(vertical: 10.0, horizontal: 2.0),
child: Text(
widget.title,
style: TextStyle(fontSize: 15.0, color: Colors.deepPurpleAccent),
),
)
],
);
} }
} }

@ -235,6 +235,12 @@ class TranslationBase {
String get beingGreat => localizedValues['beingGreat'][locale.languageCode]; String get beingGreat => localizedValues['beingGreat'][locale.languageCode];
String get cancel => localizedValues['cancel'][locale.languageCode]; String get cancel => localizedValues['cancel'][locale.languageCode];
String get done => localizedValues['done'][locale.languageCode]; String get done => localizedValues['done'][locale.languageCode];
String get resumecall => localizedValues['resumecall'][locale.languageCode];
String get endcallwithcharge =>
localizedValues['endcallwithcharge'][locale.languageCode];
String get endcall => localizedValues['endcall'][locale.languageCode];
String get transfertoadmin =>
localizedValues['transfertoadmin'][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save