WebRTC Implementing

merge-requests/400/head
haroon amjad 4 years ago
parent d9d4720ded
commit 322a32be21

@ -0,0 +1,67 @@
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_webrtc/flutter_webrtc.dart';
class CallPage extends StatefulWidget {
@override
_CallPageState createState() => _CallPageState();
}
class _CallPageState extends State<CallPage> {
final _localRenderer = new RTCVideoRenderer();
@override
void initState() {
initializeRenderers();
_getUserMedia();
super.initState();
}
@override
void dispose() {
_localRenderer.dispose();
super.dispose();
}
void _getUserMedia() async {
final Map<String, dynamic> constraints = {
'audio': 'false',
'video': {'facingMode': 'user'},
};
MediaStream stream = await navigator.mediaDevices.getUserMedia(constraints);
setState(() {
_localRenderer.srcObject = stream;
});
}
void initializeRenderers() async {
_localRenderer.initialize();
}
@override
Widget build(BuildContext context) {
return AppScaffold(
isShowAppBar: true,
showNewAppBar: true,
showNewAppBarTitle: true,
isShowDecPage: false,
appBarTitle: "WebRTC Calling",
body: Container(
child: Stack(
children: [
Positioned(
top: 0.0,
left: 0.0,
right: 0.0,
bottom: 0.0,
child: Container(
child: new RTCVideoView(_localRenderer),
),
)
],
),
),
);
}
}

@ -16,6 +16,7 @@ import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStat
import 'package:diplomaticquarterapp/pages/DrawerPages/notifications/notifications_page.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart';
import 'package:diplomaticquarterapp/pages/webRTC/call_page.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart';
@ -173,17 +174,14 @@ class _AppDrawerState extends State<AppDrawer> {
children: <Widget>[
(user.isFamily == null || user.isFamily == false)
? InkWell(
child: DrawerItem(
TranslationBase.of(context).family,
SvgPicture.asset("assets/images/new/family_files.svg"),
isImageIcon: true,
bottomLine: false,
textColor: Theme.of(context).textTheme.bodyText1.color,
iconColor: Theme.of(context).textTheme.bodyText1.color,
sideArrow: true,
letterSpacing: -0.84,
projectProvider: projectProvider
),
child: DrawerItem(TranslationBase.of(context).family, SvgPicture.asset("assets/images/new/family_files.svg"),
isImageIcon: true,
bottomLine: false,
textColor: Theme.of(context).textTheme.bodyText1.color,
iconColor: Theme.of(context).textTheme.bodyText1.color,
sideArrow: true,
letterSpacing: -0.84,
projectProvider: projectProvider),
onTap: () {
Navigator.of(context).pop();
Navigator.of(context).pushNamed(
@ -306,16 +304,9 @@ class _AppDrawerState extends State<AppDrawer> {
),
mHeight(20),
InkWell(
child: DrawerItem(
TranslationBase.of(context).arabicChange,
Padding(child: Image.asset('assets/images/lang.png'), padding: EdgeInsets.only(left: 3, right: 3, top: 3, bottom: projectProvider.isArabic ? 3 : 0)),
isImageIcon: true,
bottomLine: false,
letterSpacing: -0.84,
fontSize: 14,
fontHeight: projectProvider.isArabic ? 1 : 0.8,
projectProvider: projectProvider
),
child: DrawerItem(TranslationBase.of(context).arabicChange,
Padding(child: Image.asset('assets/images/lang.png'), padding: EdgeInsets.only(left: 3, right: 3, top: 3, bottom: projectProvider.isArabic ? 3 : 0)),
isImageIcon: true, bottomLine: false, letterSpacing: -0.84, fontSize: 14, fontHeight: projectProvider.isArabic ? 1 : 0.8, projectProvider: projectProvider),
onTap: () {
sharedPref.remove(APPOINTMENT_HISTORY_MEDICAL);
sharedPref.setBool(IS_ROBOT_INIT, null);
@ -371,15 +362,8 @@ class _AppDrawerState extends State<AppDrawer> {
),
if (projectProvider.havePrivilege(3))
InkWell(
child: DrawerItem(
TranslationBase.of(context).appsetting,
SvgPicture.asset("assets/images/new/app_setting.svg"),
isImageIcon: true,
bottomLine: false,
letterSpacing: -0.84,
fontSize: 14,
projectProvider: projectProvider
),
child: DrawerItem(TranslationBase.of(context).appsetting, SvgPicture.asset("assets/images/new/app_setting.svg"),
isImageIcon: true, bottomLine: false, letterSpacing: -0.84, fontSize: 14, projectProvider: projectProvider),
onTap: () {
Navigator.of(context).pushNamed(
SETTINGS,
@ -387,14 +371,7 @@ class _AppDrawerState extends State<AppDrawer> {
},
),
InkWell(
child: DrawerItem(
TranslationBase.of(context).rateApp,
Icons.star,
bottomLine: false,
letterSpacing: -0.84,
fontSize: 14,
projectProvider: projectProvider
),
child: DrawerItem(TranslationBase.of(context).rateApp, Icons.star, bottomLine: false, letterSpacing: -0.84, fontSize: 14, projectProvider: projectProvider),
onTap: () {
if (Platform.isIOS) {
launch("https://apps.apple.com/sa/app/dr-suliaman-alhabib/id733503978");
@ -404,15 +381,8 @@ class _AppDrawerState extends State<AppDrawer> {
},
),
InkWell(
child: DrawerItem(
TranslationBase.of(context).logout,
SvgPicture.asset("assets/images/new/logout.svg"),
isImageIcon: true,
bottomLine: false,
letterSpacing: -0.84,
fontSize: 14,
projectProvider: projectProvider
),
child: DrawerItem(TranslationBase.of(context).logout, SvgPicture.asset("assets/images/new/logout.svg"),
isImageIcon: true, bottomLine: false, letterSpacing: -0.84, fontSize: 14, projectProvider: projectProvider),
onTap: () {
logout();
},
@ -420,15 +390,8 @@ class _AppDrawerState extends State<AppDrawer> {
],
)
: InkWell(
child: DrawerItem(
TranslationBase.of(context).loginregister,
SvgPicture.asset("assets/images/new/logout.svg"),
isImageIcon: true,
letterSpacing: -0.84,
fontSize: 14,
bottomLine: false,
projectProvider: projectProvider
),
child: DrawerItem(TranslationBase.of(context).loginregister, SvgPicture.asset("assets/images/new/logout.svg"),
isImageIcon: true, letterSpacing: -0.84, fontSize: 14, bottomLine: false, projectProvider: projectProvider),
onTap: () {
login();
},
@ -449,32 +412,37 @@ class _AppDrawerState extends State<AppDrawer> {
),
),
mHeight(12),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
TranslationBase.of(context).poweredBy,
style: TextStyle(
color: Color(0xFF989898),
fontSize: 13,
letterSpacing: -0.54,
fontWeight: FontWeight.w600,
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: CallPage()));
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
TranslationBase.of(context).poweredBy,
style: TextStyle(
color: Color(0xFF989898),
fontSize: 13,
letterSpacing: -0.54,
fontWeight: FontWeight.w600,
),
),
),
mWidth(2),
Text(
"Cloud Solutions",
style: TextStyle(
color: Color(0xff2E303A),
fontSize: 13,
letterSpacing: -0.54,
fontWeight: FontWeight.w600,
mWidth(2),
Text(
"Cloud Solutions",
style: TextStyle(
color: Color(0xff2E303A),
fontSize: 13,
letterSpacing: -0.54,
fontWeight: FontWeight.w600,
),
),
),
mWidth(16),
SvgPicture.asset("assets/images/new/cloud_logo.svg"),
],
mWidth(16),
SvgPicture.asset("assets/images/new/cloud_logo.svg"),
],
),
),
mHeight(12),
],

Loading…
Cancel
Save