@ -1,13 +1,18 @@
import ' dart:io ' ;
import ' package:diplomaticquarterapp/core/viewModels/project_view_model.dart ' ;
import ' package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart ' ;
import ' package:diplomaticquarterapp/theme/colors.dart ' ;
import ' package:diplomaticquarterapp/uitl/PlatformBridge.dart ' ;
import ' package:diplomaticquarterapp/uitl/app_toast.dart ' ;
import ' package:diplomaticquarterapp/uitl/translations_delegate_base.dart ' ;
import ' package:diplomaticquarterapp/uitl/utils_new.dart ' ;
import ' package:diplomaticquarterapp/widgets/buttons/defaultButton.dart ' ;
import ' package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart ' ;
import ' package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart ' ;
import ' package:flutter/material.dart ' ;
import ' package:flutter_svg/flutter_svg.dart ' ;
import ' package:permission_handler/permission_handler.dart ' ;
import ' package:provider/provider.dart ' ;
import ' package:url_launcher/url_launcher.dart ' ;
@ -41,7 +46,6 @@ class _LiveCarePatmentPageState extends State<LiveCarePatmentPage> {
description: TranslationBase . of ( context ) . erConsultation ,
body: Container (
width: double . infinity ,
height: double . infinity ,
child: Column (
children: [
@ -257,8 +261,6 @@ class _LiveCarePatmentPageState extends State<LiveCarePatmentPage> {
margin: EdgeInsets . fromLTRB ( 10.0 , 5.0 , 10.0 , 5.0 ) ,
child: getPaymentMethods ( ) ,
) ,
] ,
) ,
) ,
@ -272,7 +274,7 @@ class _LiveCarePatmentPageState extends State<LiveCarePatmentPage> {
Expanded (
child: DefaultButton (
TranslationBase . of ( context ) . cancel ,
( ) {
( ) {
Navigator . pop ( context , false ) ;
} ,
) ,
@ -281,12 +283,18 @@ class _LiveCarePatmentPageState extends State<LiveCarePatmentPage> {
Expanded (
child: DefaultButton (
TranslationBase . of ( context ) . next ,
( ) {
( ) {
if ( _selected = = 0 ) {
AppToast . showErrorToast ( message: TranslationBase . of ( context ) . pleaseAcceptTerms ) ;
} else {
projectViewModel . analytics . liveCare . livecare_immediate_consultation_TnC ( clinic: widget . clinicName ) ;
Navigator . pop ( context , true ) ;
askVideoCallPermission ( ) . then ( ( value ) {
if ( value ) {
projectViewModel . analytics . liveCare . livecare_immediate_consultation_TnC ( clinic: widget . clinicName ) ;
Navigator . pop ( context , true ) ;
} else {
openPermissionsDialog ( ) ;
}
} ) ;
}
} ,
color: CustomColors . green ,
@ -301,6 +309,46 @@ class _LiveCarePatmentPageState extends State<LiveCarePatmentPage> {
) ;
}
Future < bool > askVideoCallPermission ( ) async {
if ( ! ( await Permission . camera . request ( ) . isGranted ) | | ! ( await Permission . microphone . request ( ) . isGranted ) ) {
return false ;
}
if ( Platform . isAndroid & & ! ( await PlatformBridge . shared ( ) . isDrawOverAppsPermissionAllowed ( ) ) ) {
await drawOverAppsMessageDialog ( context ) . then ( ( value ) {
return false ;
} ) ;
}
return true ;
}
openPermissionsDialog ( ) {
ConfirmDialog dialog = new ConfirmDialog (
context: context ,
confirmMessage: TranslationBase . of ( context ) . liveCarePermissions ,
okText: TranslationBase . of ( context ) . settings ,
cancelText: TranslationBase . of ( context ) . cancel_nocaps ,
okFunction: ( ) async {
openAppSettings ( ) ;
Navigator . pop ( context ) ;
} ,
cancelFunction: ( ) = > { } ) ;
dialog . showAlertDialog ( context ) ;
}
Future drawOverAppsMessageDialog ( BuildContext context ) async {
ConfirmDialog dialog = new ConfirmDialog (
context: context ,
confirmMessage: TranslationBase . of ( context ) . drawOverAppsPermission ,
okText: TranslationBase . of ( context ) . confirm ,
cancelText: TranslationBase . of ( context ) . cancel_nocaps ,
okFunction: ( ) async {
await PlatformBridge . shared ( ) . askDrawOverAppsPermission ( ) ;
Navigator . pop ( context ) ;
} ,
cancelFunction: ( ) = > { } ) ;
dialog . showAlertDialog ( context ) ;
}
void onRadioChanged ( int value ) {
setState ( ( ) {
_selected = value ;