import ' package:easy_localization/easy_localization.dart ' ;
import ' package:flutter/material.dart ' ;
import ' package:hmg_patient_app_new/core/app_assets.dart ' ;
import ' package:hmg_patient_app_new/core/app_state.dart ' ;
import ' package:hmg_patient_app_new/core/dependencies.dart ' ;
import ' package:hmg_patient_app_new/core/location_util.dart ' ;
import ' package:hmg_patient_app_new/core/utils/size_utils.dart ' ;
import ' package:hmg_patient_app_new/core/utils/utils.dart ' ;
import ' package:hmg_patient_app_new/extensions/string_extensions.dart ' ;
import ' package:hmg_patient_app_new/extensions/widget_extensions.dart ' ;
import ' package:hmg_patient_app_new/features/contact_us/contact_us_view_model.dart ' ;
import ' package:hmg_patient_app_new/features/contact_us/models/feedback_type.dart ' ;
import ' package:hmg_patient_app_new/generated/locale_keys.g.dart ' ;
import ' package:hmg_patient_app_new/presentation/contact_us/feedback_page.dart ' ;
import ' package:hmg_patient_app_new/presentation/contact_us/find_us_page.dart ' ;
import ' package:hmg_patient_app_new/presentation/contact_us/live_chat_page.dart ' ;
import ' package:hmg_patient_app_new/presentation/home/service_info_page.dart ' ;
import ' package:hmg_patient_app_new/services/navigation_service.dart ' ;
import ' package:hmg_patient_app_new/theme/colors.dart ' ;
import ' package:hmg_patient_app_new/widgets/routes/custom_page_route.dart ' ;
import ' package:provider/provider.dart ' ;
import ' package:url_launcher/url_launcher.dart ' ;
class ContactUs extends StatelessWidget {
ContactUs ( { super . key } ) ;
late AppState appState ;
late ContactUsViewModel contactUsViewModel ;
late LocationUtils locationUtils ;
@ override
Widget build ( BuildContext context ) {
appState = getIt . get < AppState > ( ) ;
locationUtils = getIt . get < LocationUtils > ( ) ;
locationUtils . isShowConfirmDialog = true ;
contactUsViewModel = Provider . of < ContactUsViewModel > ( context ) ;
return Column (
children: [
checkInOptionCard (
AppAssets . call_fill ,
LocaleKeys . callNow . tr ( ) ,
// LocaleKeys.viewNearestHMGLocationsviewNearestHMGLocations.tr(),
" Call for immediate assistance " ,
) . onPress ( ( ) {
launchUrl ( Uri . parse ( " tel:// " + " +966 92 006 6666 " ) ) ;
} ) ,
SizedBox ( height: 16. h ) ,
checkInOptionCard (
AppAssets . location ,
LocaleKeys . findUs . tr ( ) ,
LocaleKeys . viewNearestHMGLocations . tr ( ) ,
) . onPress ( ( ) {
locationUtils . getCurrentLocation ( onSuccess: ( value ) {
contactUsViewModel . initContactUsViewModel ( ) ;
Navigator . pop ( context ) ;
Navigator . of ( context ) . push (
CustomPageRoute (
page: FindUsPage ( ) ,
) ,
) ;
} , onFailure: ( ) {
contactUsViewModel . initContactUsViewModel ( ) ;
Navigator . pop ( context ) ;
Navigator . of ( context ) . push (
CustomPageRoute (
page: FindUsPage ( ) ,
) ,
) ;
} , onLocationDeniedForever: ( ) {
contactUsViewModel . initContactUsViewModel ( ) ;
Navigator . pop ( context ) ;
Navigator . of ( context ) . push (
CustomPageRoute (
page: FindUsPage ( ) ,
) ,
) ;
} ) ;
} ) ,
SizedBox ( height: 16. h ) ,
checkInOptionCard (
AppAssets . ask_doctor_icon ,
LocaleKeys . liveChat . tr ( ) ,
LocaleKeys . liveChatWithHMG . tr ( ) ,
) . onPress ( ( ) {
if ( getIt . get < AppState > ( ) . isAuthenticated ) {
Navigator . of ( context ) . push (
CustomPageRoute (
page: LiveChatPage ( ) ,
) ,
) ;
} else {
Navigator . of ( getIt < NavigationService > ( ) . navigatorKey . currentContext ! ) . push (
CustomPageRoute (
page: ServiceInfoPage (
serviceName: LocaleKeys . liveChat . tr ( ) ,
serviceHeader: " HMG Hospital E-Referral: Streamlined patient referrals " . needTranslation ,
serviceDescription: " Facilitate seamless patient transfers to HMG with our secure e-referral system. Ensure continuity of care for every patient. " . needTranslation ,
serviceImage: AppAssets . eReferralService ) ,
) ,
) ;
}
} ) ,
] ,
) ;
}
Widget checkInOptionCard ( String icon , String title , String subTitle ) {
return Container (
decoration: RoundedRectangleBorder ( ) . toSmoothCornerDecoration (
color: AppColors . whiteColor ,
borderRadius: 20. r ,
hasShadow: false ,
) ,
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Utils . buildSvgWithAssets ( icon: icon , width: 24. h , height: 24. h , fit: BoxFit . fill , iconColor: AppColors . textColor ) ,
SizedBox ( height: 16. h ) ,
Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: [
Expanded (
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
title . toText16 ( isBold: true , color: AppColors . textColor ) ,
subTitle . toText12 ( fontWeight: FontWeight . w500 , color: AppColors . greyTextColor ) ,
] ,
) ,
) ,
Transform . flip (
flipX: appState . isArabic ( ) ,
child: Utils . buildSvgWithAssets (
icon: AppAssets . forward_arrow_icon_small ,
iconColor: AppColors . blackColor ,
width: 18. h ,
height: 13. h ,
fit: BoxFit . contain ,
) ,
) ,
] ,
) ,
] ,
) . paddingAll ( 16. h ) ,
) ;
}
}