From 3b0aff2efab5b93103e9e47660d2de0a40465a99 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sun, 28 Jun 2020 16:29:03 +0300 Subject: [PATCH 1/3] overflow issue and model mapped --- lib/models/livecare/get_pending_res_list.dart | 24 +- lib/providers/livecare_provider.dart | 8 +- lib/screens/live_care/panding_list.dart | 289 ++++++++---------- 3 files changed, 143 insertions(+), 178 deletions(-) diff --git a/lib/models/livecare/get_pending_res_list.dart b/lib/models/livecare/get_pending_res_list.dart index 22839f91..b45c53b9 100644 --- a/lib/models/livecare/get_pending_res_list.dart +++ b/lib/models/livecare/get_pending_res_list.dart @@ -1,24 +1,24 @@ class LiveCarePendingListResponse { - Null acceptedBy; - Null acceptedOn; + dynamic acceptedBy; + dynamic acceptedOn; int age; - Null appointmentNo; + dynamic appointmentNo; String arrivalTime; String arrivalTimeD; int callStatus; String clientRequestID; String clinicName; - Null consoltationEnd; - Null consultationNotes; - Null createdOn; + dynamic consoltationEnd; + dynamic consultationNotes; + dynamic createdOn; String dateOfBirth; String deviceToken; String deviceType; - Null doctorName; + dynamic doctorName; String editOn; String gender; bool isFollowUP; - Null isFromVida; + dynamic isFromVida; int isLoginB; bool isOutKSA; int isRejected; @@ -26,16 +26,16 @@ class LiveCarePendingListResponse { double latitude; double longitude; String mobileNumber; - Null openSession; - Null openTokenID; + dynamic openSession; + dynamic openTokenID; String patientID; String patientName; int patientStatus; String preferredLanguage; int projectID; - int scoring; + double scoring; int serviceID; - Null tokenID; + dynamic tokenID; int vCID; String voipToken; diff --git a/lib/providers/livecare_provider.dart b/lib/providers/livecare_provider.dart index 31c012f8..dcce7e0e 100644 --- a/lib/providers/livecare_provider.dart +++ b/lib/providers/livecare_provider.dart @@ -3,6 +3,7 @@ import 'dart:convert'; import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.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/start_call_req.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -12,7 +13,7 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; class LiveCareProvider with ChangeNotifier { DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); - var liveCarePendingList = []; + List liveCarePendingList = []; var inCallResponse = {}; bool isFinished = true; bool hasError = false; @@ -33,7 +34,10 @@ class LiveCareProvider with ChangeNotifier { await BaseAppClient.post(GET_LIVECARE_PENDINGLIST, onSuccess: (response, statusCode) async { isFinished = true; - liveCarePendingList = response["List_PendingPatientList"]; + liveCarePendingList = []; + response['List_PendingPatientList'].forEach((v) { + liveCarePendingList.add(new LiveCarePendingListResponse.fromJson(v)); + }); }, onFailure: (String error, int statusCode) { isFinished = true; throw error; diff --git a/lib/screens/live_care/panding_list.dart b/lib/screens/live_care/panding_list.dart index 202fc774..18b787cd 100644 --- a/lib/screens/live_care/panding_list.dart +++ b/lib/screens/live_care/panding_list.dart @@ -29,14 +29,18 @@ class LiveCarePandingListScreen extends StatefulWidget { } class _LiveCarePandingListState extends State { - var _data = []; + List _data = []; Helpers helpers = new Helpers(); + bool _isInit = true; LiveCareProvider _liveCareProvider; @override void didChangeDependencies() { super.didChangeDependencies(); - _liveCareProvider = Provider.of(context); - if (_data.isEmpty) pendingList(); + if (_isInit) { + _liveCareProvider = Provider.of(context); + pendingList(); + } + _isInit = false; } @override @@ -63,7 +67,8 @@ class _LiveCarePandingListState extends State { ), ) : Column( - children: _data.map((item) { + children: _liveCareProvider.liveCarePendingList + .map((item) { return Container( decoration: myBoxDecoration(), child: InkWell( @@ -75,124 +80,125 @@ class _LiveCarePandingListState extends State { // decoration: myBoxDecoration(), child: Row( children: [ - Column( - children: [ - Container( - decoration: - BoxDecoration( - gradient: - LinearGradient( - begin: - Alignment( - -1, - -1), - end: - Alignment( - 1, - 1), - colors: [ - Colors.grey[ - 100], - Colors.grey[ - 200], - ]), - boxShadow: [ - BoxShadow( - color: Color - .fromRGBO( - 0, - 0, - 0, - 0.08), - offset: - Offset( - 0.0, - 5.0), - blurRadius: - 16.0) - ], - borderRadius: - BorderRadius.all( - Radius.circular( - 50.0)), - ), - width: 80, - height: 80, - child: Icon( - item["Gender"] == - "1" - ? DoctorApp.male - : DoctorApp - .femaleicon, - size: 80, - )), - ], - ), - SizedBox( - width: 20, - ), - Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - AppText( - item["PatientName"], - fontSize: 2.0 * - SizeConfig - .textMultiplier, - fontWeight: - FontWeight.bold, - backGroundcolor: - Colors.white, - ), - SizedBox( - height: 8, - ), - AppText( - TranslationBase.of( - context) - .fileNo + - item["PatientID"] - .toString(), - fontSize: 2.0 * - SizeConfig - .textMultiplier, - fontWeight: - FontWeight.bold, - backGroundcolor: - Colors.white, - ), + Expanded( + flex: 4, + child: Row( + children: [ + Column( + children: [ + Container( + decoration: + BoxDecoration( + gradient: LinearGradient( + begin: Alignment( + -1, + -1), + end: Alignment( + 1, 1), + colors: [ + Colors.grey[ + 100], + Colors.grey[ + 200], + ]), + boxShadow: [ + BoxShadow( + color: Color.fromRGBO( + 0, + 0, + 0, + 0.08), + offset: Offset( + 0.0, + 5.0), + blurRadius: + 16.0) + ], + borderRadius: + BorderRadius.all( + Radius.circular( + 50.0)), + ), + width: 80, + height: 80, + child: Icon( + item.gender == + "1" + ? DoctorApp + .male + : DoctorApp + .femaleicon, + size: 80, + )), + ], + ), + SizedBox( + width: 20, + ), + Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + AppText( + item.patientName, + fontSize: 2.0 * + SizeConfig + .textMultiplier, + fontWeight: + FontWeight + .bold, + backGroundcolor: + Colors.white, + ), + SizedBox( + height: 8, + ), + AppText( + TranslationBase.of( + context) + .fileNo + + item.patientID + .toString(), + fontSize: 2.0 * + SizeConfig + .textMultiplier, + fontWeight: + FontWeight + .bold, + backGroundcolor: + Colors.white, + ), - // SizedBox( - // height: 8, - // ), - AppText( - TranslationBase.of( - context) - .age + - ' ' + - item["Age"] - .toString(), - fontSize: 2.0 * - SizeConfig - .textMultiplier, - fontWeight: - FontWeight.bold, - backGroundcolor: - Colors.white, - ), - SizedBox( - height: 8, - ), - ], - ), - SizedBox( - width: 80, + // SizedBox( + // height: 8, + // ), + AppText( + TranslationBase.of( + context) + .age + + ' ' + + item.age + .toString(), + fontSize: 2.0 * + SizeConfig + .textMultiplier, + fontWeight: + FontWeight + .bold, + backGroundcolor: + Colors.white, + ), + SizedBox( + height: 8, + ), + ], + ), + ], + ), ), - // Divider(color: Colors.grey Expanded( - flex: 3, + flex: 1, child: IconButton( icon: Icon( Icons.video_call, @@ -230,51 +236,6 @@ class _LiveCarePandingListState extends State { _liveCareProvider.getpendingList().then((result) { this.setState(() { _data = _liveCareProvider.liveCarePendingList; - // _data = [ - // { - // "AcceptedBy": null, - // "AcceptedOn": null, - // "Age": 33, - // "AppointmentNo": null, - // "ArrivalTime": "2020-06-14 09:34", - // "ArrivalTimeD": "/Date(1592116471237+0300)/", - // "CallStatus": 1, - // "ClientRequestID": "2344670985-1231755-1584378710", - // "ClinicName": "ER Clinic", - // "ConsoltationEnd": null, - // "ConsultationNotes": null, - // "CreatedOn": null, - // "DateOfBirth": "1987-01-04", - // "DeviceToken": - // "fbxt2XpseU_DpO8Msqa1V6:APA91bHUxsfKpAewTt0DzGg_mSTN0T7KIQM92VpubUTobgTm0-DGcJMgcc3DmERbEiWbyTup3zGttU3_9RBaRBxZUKj9ju5wnTGSrIelEE-qxOK30YnIaDhbhs8fJixACbyzgr72HU8Y", - // "DeviceType": "iOS", - // "DoctorName": null, - // "EditOn": "/Date(1592116471237+0300)/", - // "Gender": "1", - // "IsFollowUP": false, - // "IsFromVida": null, - // "IsLoginB": 0, - // "IsOutKSA": false, - // "IsRejected": 0, - // "Language": "AR", - // "Latitude": 24.708879, - // "Longitude": 46.665827, - // "MobileNumber": "0537503378", - // "OpenSession": null, - // "OpenTokenID": null, - // "PatientID": "1231755", - // "PatientName": "TAMER FANASHEH", - // "PatientStatus": 1, - // "PreferredLanguage": "Ar", - // "ProjectID": 0, - // "Scoring": 0.00, - // "ServiceID": 1, - // "TokenID": null, - // "VC_ID": 2240, - // "VoipToken": - // "8dcc17e2365d4f3c4afadc6b5d625a88407398ee517f0e9beda7f663007e88b9" - // } - // ]; }); }); return true; From cad6892c8b3ef896e57e095c1d9c96da181bd312 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 1 Jul 2020 11:12:41 +0300 Subject: [PATCH 2/3] Video call page updated --- lib/providers/livecare_provider.dart | 2 +- lib/screens/live_care/panding_list.dart | 13 +-- lib/screens/live_care/video_call.dart | 107 +++++++++++------------- 3 files changed, 53 insertions(+), 69 deletions(-) diff --git a/lib/providers/livecare_provider.dart b/lib/providers/livecare_provider.dart index dcce7e0e..20ee8db0 100644 --- a/lib/providers/livecare_provider.dart +++ b/lib/providers/livecare_provider.dart @@ -26,7 +26,7 @@ class LiveCareProvider with ChangeNotifier { var profile = await sharedPref.getObj(DOCTOR_PROFILE); _pendingRequestModel.projectID = await sharedPref.getInt(PROJECT_ID); _pendingRequestModel.doctorID = profile['DoctorID']; - _pendingRequestModel.sErServiceID = "1,3"; + _pendingRequestModel.sErServiceID = "1,3,7"; _pendingRequestModel.sourceID = 1; _pendingRequestModel.patientData = PatientData(isOutKSA: false); resetDefaultValues(); diff --git a/lib/screens/live_care/panding_list.dart b/lib/screens/live_care/panding_list.dart index ce139455..18b787cd 100644 --- a/lib/screens/live_care/panding_list.dart +++ b/lib/screens/live_care/panding_list.dart @@ -1,6 +1,5 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/providers/livecare_provider.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/helpers.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -208,8 +207,6 @@ class _LiveCarePandingListState extends State { color: Colors .green, //Colors.black, onPressed: () => { - - sharedPref.setObj( LIVE_CARE_PATIENT, item), @@ -226,15 +223,7 @@ class _LiveCarePandingListState extends State { ], ), ), - onTap: () { - sharedPref.setObj( - LIVE_CARE_PATIENT, - item); - Navigator.of(context) - .pushNamed( - VIDEO_CALL); - - }, + onTap: () {}, ), ); }).toList(), diff --git a/lib/screens/live_care/video_call.dart b/lib/screens/live_care/video_call.dart index 596f5f20..7d960101 100644 --- a/lib/screens/live_care/video_call.dart +++ b/lib/screens/live_care/video_call.dart @@ -22,7 +22,7 @@ class _VideoCallPageState extends State { String _timmer = ''; LiveCareProvider _liveCareProvider; bool _isInit = true; - var _tokenData; + var _tokenData; var patientData = {}; String image_url = 'https://hmgwebservices.com/Images/MobileImages/DUBAI/'; //bool _isOutOfStuck = false; @@ -41,11 +41,11 @@ class _VideoCallPageState extends State { _tokenData = tokenData; /* opentok functionalites need to be written */ - VideoChannel.openVideoCallScreen(kApiKey: '46209962', + VideoChannel.openVideoCallScreen( + kApiKey: '46209962', kSessionId: _tokenData["OpenSessionID"], - kToken: _tokenData["OpenTokenID"], + kToken: _tokenData["OpenTokenID"], ); - } String getTimerTime(int start) { @@ -90,8 +90,8 @@ class _VideoCallPageState extends State { return Scaffold( body: SafeArea( child: Container( - height: MediaQuery.of(context).size.height * 1.09, - // width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height, + width: MediaQuery.of(context).size.width, decoration: BoxDecoration( color: Colors.white, ), @@ -105,7 +105,7 @@ class _VideoCallPageState extends State { height: 10.0, ), Text( - 'Calling', + 'Dailing...', style: TextStyle( color: Colors.deepPurpleAccent, fontWeight: FontWeight.w300, @@ -146,58 +146,53 @@ class _VideoCallPageState extends State { ), ), SizedBox( - height: MediaQuery.of(context).size.height * 0.02, + height: MediaQuery.of(context).size.height * .2, ), - Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - FunctionalButton( - title: 'Speaker', - icon: Icons.phone_in_talk, + // Row( + // mainAxisSize: MainAxisSize.max, + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // FunctionalButton( + // title: 'Speaker', + // icon: Icons.phone_in_talk, + // onPressed: () { + + // }, + // ), + // FunctionalButton( + // title: 'Flip', + // icon: Icons.flip_to_back, + // onPressed: () {}, + // ), + // FunctionalButton( + // title: 'Mute', + // icon: Icons.mic_off, + // onPressed: () {}, + // ), + // ], + // ), + + // SizedBox( + // height: MediaQuery.of(context).size.height * 0.1, + // ), + Container( + width: 70.0, + height: 70.0, + child: FloatingActionButton( onPressed: () { - - - - print(_tokenData["OpenSessionID"]); - print(_tokenData["OpenTokenID"]); - - VideoChannel.openVideoCallScreen(kApiKey: '46209962', - kSessionId: _tokenData["OpenSessionID"], - kToken: _tokenData["OpenTokenID"], - ); - + Navigator.of(context).pop(); }, - ), - FunctionalButton( - title: 'Flip', - icon: Icons.flip_to_back, - onPressed: () {}, - ), - FunctionalButton( - title: 'Mute', - icon: Icons.mic_off, - onPressed: () {}, - ), - ], - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.1, - ), - FloatingActionButton( - onPressed: () { - Navigator.of(context).pop(); - }, - elevation: 20.0, - shape: CircleBorder(side: BorderSide(color: Colors.red)), - mini: false, - child: Icon( - Icons.call_end, - color: Colors.red, - ), - backgroundColor: Colors.red[100], - ) + 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], + )) ], ), ), From 8a9d20990b397cde92397f5f1a3dbb630410a1ce Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 1 Jul 2020 11:26:38 +0300 Subject: [PATCH 3/3] Video call page updated --- lib/screens/live_care/panding_list.dart | 5 +--- lib/screens/live_care/video_call.dart | 34 ------------------------- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/lib/screens/live_care/panding_list.dart b/lib/screens/live_care/panding_list.dart index 18b787cd..7aea2fcd 100644 --- a/lib/screens/live_care/panding_list.dart +++ b/lib/screens/live_care/panding_list.dart @@ -169,10 +169,6 @@ class _LiveCarePandingListState extends State { backGroundcolor: Colors.white, ), - - // SizedBox( - // height: 8, - // ), AppText( TranslationBase.of( context) @@ -207,6 +203,7 @@ class _LiveCarePandingListState extends State { color: Colors .green, //Colors.black, onPressed: () => { + _isInit = true, sharedPref.setObj( LIVE_CARE_PATIENT, item), diff --git a/lib/screens/live_care/video_call.dart b/lib/screens/live_care/video_call.dart index 7d960101..02abdc5b 100644 --- a/lib/screens/live_care/video_call.dart +++ b/lib/screens/live_care/video_call.dart @@ -74,12 +74,6 @@ class _VideoCallPageState extends State { {helpers.showErrorToast(error), Navigator.of(context).pop()}); } - // @override - // void initState() { - // super.initState(); - - // } - @override void dispose() { super.dispose(); @@ -148,34 +142,6 @@ class _VideoCallPageState extends State { SizedBox( height: MediaQuery.of(context).size.height * .2, ), - // Row( - // mainAxisSize: MainAxisSize.max, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // crossAxisAlignment: CrossAxisAlignment.center, - // children: [ - // FunctionalButton( - // title: 'Speaker', - // icon: Icons.phone_in_talk, - // onPressed: () { - - // }, - // ), - // FunctionalButton( - // title: 'Flip', - // icon: Icons.flip_to_back, - // onPressed: () {}, - // ), - // FunctionalButton( - // title: 'Mute', - // icon: Icons.mic_off, - // onPressed: () {}, - // ), - // ], - // ), - - // SizedBox( - // height: MediaQuery.of(context).size.height * 0.1, - // ), Container( width: 70.0, height: 70.0,