@ -1,4 +1,5 @@
import ' dart:developer ' ;
import ' dart:io ' ;
import ' dart:ui ' ;
import ' package:auto_size_text/auto_size_text.dart ' show AutoSizeText ;
@ -31,6 +32,7 @@ import 'package:hmg_patient_app/widgets/in_app_browser/InAppBrowser.dart';
import ' package:hmg_patient_app/widgets/others/app_scaffold_widget.dart ' ;
import ' package:hmg_patient_app/widgets/transitions/fade_page.dart ' ;
import ' package:provider/provider.dart ' ;
import ' package:url_launcher/url_launcher.dart ' ;
import ' ../../../widgets/dialogs/confirm_dialog.dart ' ;
import ' ../../ToDoList/payment_method_select.dart ' ;
@ -173,11 +175,13 @@ class _OfferDetailsPageState extends State<OfferDetailsPage> {
const SizedBox ( height: 24 ) ,
/ / / Hospital Dropdown ( mock UI )
Padding (
padding: const EdgeInsets . symmetric ( horizontal: 16 ) ,
child: Container (
padding: const EdgeInsets . symmetric ( horizontal: 16 , vertical: 12 ) ,
decoration: BoxDecoration (
projectViewModel . havePrivilege ( 113 )
? Container ( )
: Padding (
padding: const EdgeInsets . symmetric ( horizontal: 16 ) ,
child: Container (
padding: const EdgeInsets . symmetric ( horizontal: 16 , vertical: 12 ) ,
decoration: BoxDecoration (
color: Colors . grey . shade300 ,
borderRadius: BorderRadius . circular ( 12 ) ,
) ,
@ -237,10 +241,20 @@ class _OfferDetailsPageState extends State<OfferDetailsPage> {
SizedBox (
width: MediaQuery . of ( context ) . size . width - 24 ,
height: 50 ,
child: DefaultButton ( " Pay Now ادفع الآن " , ( ) {
if ( projectViewModel . isLogin ) {
if ( selectedHospital ! = null ) {
startPaymentProcess ( context ) ;
child: projectViewModel . havePrivilege ( 113 )
? DefaultButton ( TranslationBase . of ( context ) . downloadNewApp , ( ) {
if ( Platform . isAndroid ) {
_launchURL ( " https://play.google.com/store/apps/details?id=com.cloudsolutions.HMGPatientApp " ) ;
}
if ( Platform . isIOS ) {
_launchURL ( " https://itunes.apple.com/app/id6758851027 " ) ;
/ / _launchURL ( " https://apps.apple.com/us/app/dr-sulaiman-alhabib-beta/id6758851027 " ) ;
}
} )
: DefaultButton ( " Pay Now ادفع الآن " , ( ) {
if ( projectViewModel . isLogin ) {
if ( selectedHospital ! = null ) {
startPaymentProcess ( context ) ;
} else {
AppToast . showErrorToast ( message: TranslationBase . of ( context ) . selectHospital ) ;
}
@ -267,6 +281,14 @@ class _OfferDetailsPageState extends State<OfferDetailsPage> {
) ;
}
_launchURL ( String url ) async {
if ( await canLaunch ( url ) ) {
await launch ( url ) ;
} else {
throw ' Could not launch $ url ' ;
}
}
startPaymentProcess ( BuildContext context ) {
Navigator . push (
context ,