|
|
|
|
@ -3,6 +3,7 @@ import 'dart:ui';
|
|
|
|
|
import 'package:camera/camera.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/conference/widgets/platform_exception_alert_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/conference/zoom/call_screen.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/videocall-webrtc-rnd/webrtc/start_video_call.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/webRTC/OpenTok/OpenTok.dart';
|
|
|
|
|
@ -16,11 +17,10 @@ import 'package:just_audio/just_audio.dart';
|
|
|
|
|
|
|
|
|
|
import '../../config/config.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class IncomingCall extends StatefulWidget {
|
|
|
|
|
IncomingCallData? incomingCallData;
|
|
|
|
|
|
|
|
|
|
IncomingCall({ this.incomingCallData});
|
|
|
|
|
IncomingCall({this.incomingCallData});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_IncomingCallState createState() => _IncomingCallState();
|
|
|
|
|
@ -34,6 +34,7 @@ class _IncomingCallState extends State<IncomingCall> with SingleTickerProviderSt
|
|
|
|
|
late CameraController _controller;
|
|
|
|
|
late Future<void> _initializeControllerFuture;
|
|
|
|
|
bool isCameraReady = false;
|
|
|
|
|
|
|
|
|
|
// Signaling signaling = Signaling()..init();
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -59,140 +60,138 @@ class _IncomingCallState extends State<IncomingCall> with SingleTickerProviderSt
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
isShowAppBar: false,
|
|
|
|
|
isShowDecPage: false,
|
|
|
|
|
body: Stack(
|
|
|
|
|
alignment: FractionalOffset.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
// new Positioned.fill(
|
|
|
|
|
// child: new AspectRatio(aspectRatio: _controller.value.aspectRatio, child: new CameraPreview(_controller)),
|
|
|
|
|
// ),
|
|
|
|
|
new Positioned.fill(
|
|
|
|
|
child: new ClipRect(
|
|
|
|
|
// child: new BackdropFilter(
|
|
|
|
|
// filter: new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
|
|
|
|
|
child: new Container(
|
|
|
|
|
decoration: new BoxDecoration(color: Colors.grey[800]!.withOpacity(0.8)),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
margin: const EdgeInsets.all(21.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Image.asset(
|
|
|
|
|
"assets/images/new/logo.png",
|
|
|
|
|
height: 70,
|
|
|
|
|
width: 70,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: const EdgeInsets.only(left: 10.0, right: 10.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
widget.incomingCallData!.doctorname!,
|
|
|
|
|
style: TextStyle(fontSize: 21, fontWeight: FontWeight.bold, color: Colors.white, letterSpacing: -1.26, height: 23 / 12),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).videoAppo,
|
|
|
|
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xffC6C6C6), letterSpacing: -0.48, height: 23 / 24),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 2),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
body: Stack(alignment: FractionalOffset.center, children: <Widget>[
|
|
|
|
|
// new Positioned.fill(
|
|
|
|
|
// child: new AspectRatio(aspectRatio: _controller.value.aspectRatio, child: new CameraPreview(_controller)),
|
|
|
|
|
// ),
|
|
|
|
|
new Positioned.fill(
|
|
|
|
|
child: new ClipRect(
|
|
|
|
|
// child: new BackdropFilter(
|
|
|
|
|
// filter: new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
|
|
|
|
|
child: new Container(
|
|
|
|
|
decoration: new BoxDecoration(color: Colors.grey[800]!.withOpacity(0.8)),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
margin: const EdgeInsets.all(21.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Image.asset(
|
|
|
|
|
"assets/images/new/logo.png",
|
|
|
|
|
height: 70,
|
|
|
|
|
width: 70,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: const EdgeInsets.only(left: 10.0, right: 10.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
widget.incomingCallData!.doctorname!,
|
|
|
|
|
style: TextStyle(fontSize: 21, fontWeight: FontWeight.bold, color: Colors.white, letterSpacing: -1.26, height: 23 / 12),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: const EdgeInsets.all(21.0),
|
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
|
decoration: cardRadius(15.0, color: Colors.black),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
padding: const EdgeInsets.fromLTRB(16.0, 16.0, 16.0, 6.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).appoInfo,
|
|
|
|
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.64, height: 23 / 12),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
widget.incomingCallData!.appointmentdate! + ", " + widget.incomingCallData!.appointmenttime!,
|
|
|
|
|
style: TextStyle(fontSize: 12.0, letterSpacing: -0.48, color: Color(0xff8E8E8E), fontWeight: FontWeight.w600),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
padding: const EdgeInsets.only(left: 16.0, right: 16.0, bottom: 21.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
widget.incomingCallData!.clinicname!,
|
|
|
|
|
style: TextStyle(fontSize: 12.0, letterSpacing: -0.48, color: Color(0xff8E8E8E), fontWeight: FontWeight.w600),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).videoAppo,
|
|
|
|
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xffC6C6C6), letterSpacing: -0.48, height: 23 / 24),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Spacer(),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(bottom: 70.0, left: 49, right: 49),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
RotationTransition(
|
|
|
|
|
turns: Tween(begin: 0.0, end: -.1).chain(CurveTween(curve: Curves.elasticIn)).animate(_animationController),
|
|
|
|
|
child: Container(
|
|
|
|
|
child: RawMaterialButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
_submit();
|
|
|
|
|
},
|
|
|
|
|
elevation: 2.0,
|
|
|
|
|
fillColor: Colors.green,
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.call,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
size: 35.0,
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.all(15.0),
|
|
|
|
|
shape: CircleBorder(),
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
Container(
|
|
|
|
|
child: RawMaterialButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
backToHome();
|
|
|
|
|
},
|
|
|
|
|
elevation: 2.0,
|
|
|
|
|
fillColor: Colors.red,
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.call_end,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
size: 35.0,
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.all(15.0),
|
|
|
|
|
shape: CircleBorder(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
SizedBox(height: 2),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: const EdgeInsets.all(21.0),
|
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
|
decoration: cardRadius(15.0, color: Colors.black),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
padding: const EdgeInsets.fromLTRB(16.0, 16.0, 16.0, 6.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).appoInfo,
|
|
|
|
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.64, height: 23 / 12),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
widget.incomingCallData!.appointmentdate! + ", " + widget.incomingCallData!.appointmenttime!,
|
|
|
|
|
style: TextStyle(fontSize: 12.0, letterSpacing: -0.48, color: Color(0xff8E8E8E), fontWeight: FontWeight.w600),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
padding: const EdgeInsets.only(left: 16.0, right: 16.0, bottom: 21.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
widget.incomingCallData!.clinicname!,
|
|
|
|
|
style: TextStyle(fontSize: 12.0, letterSpacing: -0.48, color: Color(0xff8E8E8E), fontWeight: FontWeight.w600),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Spacer(),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(bottom: 70.0, left: 49, right: 49),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
RotationTransition(
|
|
|
|
|
turns: Tween(begin: 0.0, end: -.1).chain(CurveTween(curve: Curves.elasticIn)).animate(_animationController),
|
|
|
|
|
child: Container(
|
|
|
|
|
child: RawMaterialButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
_submit();
|
|
|
|
|
},
|
|
|
|
|
elevation: 2.0,
|
|
|
|
|
fillColor: Colors.green,
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.call,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
size: 35.0,
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.all(15.0),
|
|
|
|
|
shape: CircleBorder(),
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
Container(
|
|
|
|
|
child: RawMaterialButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
backToHome();
|
|
|
|
|
},
|
|
|
|
|
elevation: 2.0,
|
|
|
|
|
fillColor: Colors.red,
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.call_end,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
size: 35.0,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
padding: EdgeInsets.all(15.0),
|
|
|
|
|
shape: CircleBorder(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// ),
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// ),
|
|
|
|
|
]
|
|
|
|
|
// } else {
|
|
|
|
|
// return const Center(child: CircularProgressIndicator());
|
|
|
|
|
// }
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -213,31 +212,43 @@ class _IncomingCallState extends State<IncomingCall> with SingleTickerProviderSt
|
|
|
|
|
// backToHome();
|
|
|
|
|
// final roomModel = RoomModel(name: widget.incomingCallData.name, token: widget.incomingCallData.sessionId, identity: widget.incomingCallData.identity);
|
|
|
|
|
// await _controller.dispose();
|
|
|
|
|
changeCallStatusAPI(4);
|
|
|
|
|
await Navigator.of(context).pushReplacement(
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
// fullscreenDialog: true,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
// final caller = widget.incomingCallData.callerID;
|
|
|
|
|
// final receiver = widget.incomingCallData.receiverID;
|
|
|
|
|
// final host = widget.incomingCallData.server;
|
|
|
|
|
// if(widget.incomingCallData.isWebRTC == "true"){
|
|
|
|
|
// return StartVideoCall(caller: caller, receiver: receiver, iAmCaller: false, host: host);
|
|
|
|
|
// }else{
|
|
|
|
|
return OpenTokConnectCallPage(
|
|
|
|
|
apiKey: OPENTOK_API_KEY,
|
|
|
|
|
sessionId: widget.incomingCallData!.sessionId!,
|
|
|
|
|
token: widget.incomingCallData!.token!
|
|
|
|
|
);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// return VideoCallWebPage(receiverId: widget.incomingCallData.receiverID, callerId: widget.incomingCallData.callerID); // Web WebRTC VideoCall
|
|
|
|
|
LandingPage.isOpenCallPage = false;
|
|
|
|
|
player.stop();
|
|
|
|
|
changeCallStatusAPI(4);
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
|
|
|
|
|
// return CallHomePage(receiverId: widget.incomingCallData.receiverID, callerId: widget.incomingCallData.callerID); // App WebRTC VideoCall
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
Navigator.pushNamed(
|
|
|
|
|
context,
|
|
|
|
|
"zoom_call_page",
|
|
|
|
|
arguments: CallArguments(widget.incomingCallData!.sessionId!, "123", "Patient", "40", "1", false),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// await Navigator.of(context).pushReplacement(
|
|
|
|
|
// MaterialPageRoute(
|
|
|
|
|
// // fullscreenDialog: true,
|
|
|
|
|
// builder: (BuildContext context) {
|
|
|
|
|
// // final caller = widget.incomingCallData.callerID;
|
|
|
|
|
// // final receiver = widget.incomingCallData.receiverID;
|
|
|
|
|
// // final host = widget.incomingCallData.server;
|
|
|
|
|
// // if(widget.incomingCallData.isWebRTC == "true"){
|
|
|
|
|
// // return StartVideoCall(caller: caller, receiver: receiver, iAmCaller: false, host: host);
|
|
|
|
|
// // }else{
|
|
|
|
|
// return OpenTokConnectCallPage(
|
|
|
|
|
// apiKey: OPENTOK_API_KEY,
|
|
|
|
|
// sessionId: widget.incomingCallData!.sessionId!,
|
|
|
|
|
// token: widget.incomingCallData!.token!
|
|
|
|
|
// );
|
|
|
|
|
// // }
|
|
|
|
|
//
|
|
|
|
|
// // return VideoCallWebPage(receiverId: widget.incomingCallData.receiverID, callerId: widget.incomingCallData.callerID); // Web WebRTC VideoCall
|
|
|
|
|
//
|
|
|
|
|
// // return CallHomePage(receiverId: widget.incomingCallData.receiverID, callerId: widget.incomingCallData.callerID); // App WebRTC VideoCall
|
|
|
|
|
//
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
} catch (err) {
|
|
|
|
|
print(err);
|
|
|
|
|
await PlatformExceptionAlertDialog(
|
|
|
|
|
@ -248,8 +259,7 @@ class _IncomingCallState extends State<IncomingCall> with SingleTickerProviderSt
|
|
|
|
|
|
|
|
|
|
void changeCallStatusAPI(int sessionStatus) {
|
|
|
|
|
LiveCareService service = new LiveCareService();
|
|
|
|
|
service.endCallAPI(widget.incomingCallData!.sessionId!, sessionStatus, context).then((res) {
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
service.endCallAPI(widget.incomingCallData!.sessionId!, sessionStatus, context).then((res) {}).catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|