From 93936c3c55a118368d790092a45f1ace9439d20a Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 23 Jun 2020 10:02:03 +0300 Subject: [PATCH] video call screen added --- lib/config/config.dart | 4 +- lib/routes.dart | 15 +- lib/screens/dashboard_screen.dart | 18 ++- lib/screens/video_call/video_call.dart | 208 +++++++++++++++++++++++++ 4 files changed, 229 insertions(+), 16 deletions(-) create mode 100644 lib/screens/video_call/video_call.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index d3f1e95d..af7633f3 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -2,8 +2,8 @@ const MAX_SMALL_SCREEN = 660; const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; -const BASE_URL = 'https://hmgwebservices.com/Services/'; -//const BASE_URL = 'https://uat.hmgwebservices.com/Services/'; +//const BASE_URL = 'https://hmgwebservices.com/Services/'; +const BASE_URL = 'https://uat.hmgwebservices.com/Services/'; const PHARMACY_ITEMS_URL = "Lists.svc/REST/GetPharmcyItems_Region"; const PHARMACY_LIST_URL = "Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = diff --git a/lib/routes.dart b/lib/routes.dart index cd5b3187..89efd710 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,4 +1,3 @@ - import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/root_page.dart'; import 'package:doctor_app_flutter/screens/patients/profile/insurance_approvals_screen.dart'; @@ -6,8 +5,8 @@ import 'package:doctor_app_flutter/screens/patients/profile/patient_orders_scree import 'package:doctor_app_flutter/screens/patients/profile/progress_note_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/refer_patient_screen.dart'; - import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart'; +import 'package:doctor_app_flutter/screens/video_call/video_call.dart'; import './screens/QR_reader_screen.dart'; import './screens/auth/change_password_screen.dart'; @@ -67,11 +66,12 @@ const String RADIOLOGY = 'patients/radiology'; const String PROGRESS_NOTE = 'patients/progress-note'; const String REFER_PATIENT = 'patients/refer-patient'; const String PATIENT_ORDERS = 'patients/patient_orders'; -const String PATIENT_INSURANCE_APPROVALS = 'patients/patient_insurance_approvals'; +const String PATIENT_INSURANCE_APPROVALS = + 'patients/patient_insurance_approvals'; const String VITAL_SIGN_DETAILS = 'patients/vital-sign-details'; const String BODY_MEASUREMENTS = 'patients/body-measurements'; const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; - +const String VIDEO_CALL = 'video-call'; var routes = { ROOT: (_) => RootPage(), HOME: (_) => LandingPage(), @@ -79,7 +79,7 @@ var routes = { PROFILE: (_) => ProfileScreen(), MY_SCHEDULE: (_) => MyScheduleScreen(), PATIENT_SEARCH: (_) => PatientSearchScreen(), - PATIENTS_REFERRED:(_)=>PatientReferredScreen(), + PATIENTS_REFERRED: (_) => PatientReferredScreen(), PATIENTS: (_) => PatientsScreen(), QR_READER: (_) => QrReaderScreen(), BLOOD_BANK: (_) => BloodBankScreen(), @@ -100,10 +100,11 @@ var routes = { PRESCRIPTIONS: (_) => PrescriptionScreen(), RADIOLOGY: (_) => RadiologyScreen(), PROGRESS_NOTE: (_) => ProgressNoteScreen(), - REFER_PATIENT: (_)=> ReferPatientScreen(), + REFER_PATIENT: (_) => ReferPatientScreen(), PATIENT_ORDERS: (_) => PatientsOrdersScreen(), PATIENT_INSURANCE_APPROVALS: (_) => InsuranceApprovalsScreen(), VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), BODY_MEASUREMENTS: (_) => VitalSignItemDetailsScreen(), - IN_PATIENT_PRESCRIPTIONS_DETAILS:(_)=> InpatientPrescriptionDetailsScreen() + IN_PATIENT_PRESCRIPTIONS_DETAILS: (_) => InpatientPrescriptionDetailsScreen(), + VIDEO_CALL: (_) => VideoCallPage() }; diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index b4448d23..dffaa777 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -225,13 +225,17 @@ class _DashboardScreenState extends State { crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Expanded( - flex: 2, - child: new DashboardItemIconText( - DoctorApp.in_patient_white, "23", "In-Patient", - showBorder: true, - backgroundColor: Colors.red[900], - iconColor: Colors.white), - ), + flex: 2, + child: InkWell( + onTap: () { + Navigator.of(context).pushNamed(VIDEO_CALL); + }, + child: new DashboardItemIconText( + DoctorApp.in_patient_white, "23", "In-Patient", + showBorder: true, + backgroundColor: Colors.red[900], + iconColor: Colors.white), + )), Expanded( flex: 2, child: new DashboardItemIconText( diff --git a/lib/screens/video_call/video_call.dart b/lib/screens/video_call/video_call.dart new file mode 100644 index 00000000..e36f3f36 --- /dev/null +++ b/lib/screens/video_call/video_call.dart @@ -0,0 +1,208 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; + +class VideoCallPage extends StatefulWidget { + @override + _VideoCallPageState createState() => _VideoCallPageState(); +} + +class _VideoCallPageState extends State { + Timer _timmerInstance; + int _start = 0; + String _timmer = ''; + + void startTimmer() { + var oneSec = Duration(seconds: 1); + _timmerInstance = Timer.periodic( + oneSec, + (Timer timer) => setState(() { + if (_start < 0) { + _timmerInstance.cancel(); + } else { + _start = _start + 1; + _timmer = getTimerTime(_start); + } + })); + } + + String getTimerTime(int start) { + int minutes = (start ~/ 60); + String sMinute = ''; + if (minutes.toString().length == 1) { + sMinute = '0' + minutes.toString(); + } else + 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; + } + + @override + void initState() { + super.initState(); + startTimmer(); + } + + @override + void dispose() { + _timmerInstance.cancel(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea( + child: Container( + height: MediaQuery.of(context).size.height * 1.09, + // width: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + color: Colors.white, + ), + padding: EdgeInsets.all(50.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 10.0, + ), + Text( + 'Calling', + style: TextStyle( + color: Colors.deepPurpleAccent, + fontWeight: FontWeight.w300, + fontSize: 15), + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.02, + ), + Text( + 'A B Shaikh', + style: TextStyle( + color: Colors.deepPurpleAccent, + fontWeight: FontWeight.w900, + fontSize: 20), + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.02, + ), + Text( + _timmer, + 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( + 'https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png', + height: 200.0, + width: 200.0, + ), + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.02, + ), + 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, + ), + FloatingActionButton( + onPressed: () {}, + elevation: 20.0, + shape: CircleBorder(side: BorderSide(color: Colors.red)), + mini: false, + child: Icon( + Icons.call_end, + color: Colors.red, + ), + backgroundColor: Colors.red[100], + ) + ], + ), + ), + ), + ); + } +} + +class FunctionalButton extends StatefulWidget { + final title; + final icon; + final Function() onPressed; + + const FunctionalButton({Key key, this.title, this.icon, this.onPressed}) + : super(key: key); + + @override + _FunctionalButtonState createState() => _FunctionalButtonState(); +} + +class _FunctionalButtonState extends State { + @override + Widget build(BuildContext context) { + return Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + RawMaterialButton( + onPressed: widget.onPressed, + splashColor: Colors.deepPurpleAccent, + fillColor: Colors.white, + elevation: 10.0, + shape: CircleBorder(), + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Icon( + widget.icon, + size: 30.0, + color: Colors.deepPurpleAccent, + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(vertical: 10.0, horizontal: 2.0), + child: Text( + widget.title, + style: TextStyle(fontSize: 15.0, color: Colors.deepPurpleAccent), + ), + ) + ], + ); + } +}