@ -1,4 +1,5 @@
import ' dart:async ' ;
import ' dart:developer ' ;
import ' package:easy_localization/easy_localization.dart ' ;
import ' package:flutter/material.dart ' ;
@ -13,6 +14,7 @@ import 'package:hmg_patient_app_new/core/utils/date_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/int_extensions.dart ' ;
import ' package:hmg_patient_app_new/extensions/route_extensions.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/authentication/authentication_view_model.dart ' ;
@ -25,6 +27,7 @@ import 'package:hmg_patient_app_new/features/my_appointments/appointment_rating_
import ' package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart ' ;
import ' package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart ' ;
import ' package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart ' ;
import ' package:hmg_patient_app_new/features/todo_section/todo_section_view_model.dart ' ;
import ' package:hmg_patient_app_new/generated/locale_keys.g.dart ' ;
import ' package:hmg_patient_app_new/presentation/appointments/appointment_queue_page.dart ' ;
import ' package:hmg_patient_app_new/presentation/appointments/my_appointments_page.dart ' ;
@ -43,6 +46,9 @@ import 'package:hmg_patient_app_new/presentation/home/widgets/welcome_widget.dar
import ' package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart ' ;
import ' package:hmg_patient_app_new/presentation/profile_settings/profile_settings.dart ' ;
import ' package:hmg_patient_app_new/presentation/rate_appointment/rate_appointment_doctor.dart ' ;
import ' package:hmg_patient_app_new/presentation/todo_section/ancillary_procedures_details_page.dart ' ;
import ' package:hmg_patient_app_new/presentation/todo_section/widgets/ancillary_orders_list.dart ' ;
import ' package:hmg_patient_app_new/routes/app_routes.dart ' ;
import ' package:hmg_patient_app_new/services/cache_service.dart ' ;
import ' package:hmg_patient_app_new/theme/colors.dart ' ;
import ' package:hmg_patient_app_new/widgets/buttons/custom_button.dart ' ;
@ -67,13 +73,13 @@ class _LandingPageState extends State<LandingPage> {
late AppState appState ;
late MyAppointmentsViewModel myAppointmentsViewModel ;
late PrescriptionsViewModel prescriptionsViewModel ;
final CacheService cacheService = GetIt . instance < CacheService > ( ) ;
late AppointmentRatingViewModel appointmentRatingViewModel ;
late InsuranceViewModel insuranceViewModel ;
late ImmediateLiveCareViewModel immediateLiveCareViewModel ;
late BookAppointmentsViewModel bookAppointmentsViewModel ;
late EmergencyServicesViewModel emergencyServicesViewModel ;
late TodoSectionViewModel todoSectionViewModel ;
final SwiperController _controller = SwiperController ( ) ;
@ -82,10 +88,6 @@ class _LandingPageState extends State<LandingPage> {
authVM = context . read < AuthenticationViewModel > ( ) ;
habibWalletVM = context . read < HabibWalletViewModel > ( ) ;
appointmentRatingViewModel = context . read < AppointmentRatingViewModel > ( ) ;
/ / myAppointmentsViewModel = context . read < MyAppointmentsViewModel > ( ) ;
/ / prescriptionsViewModel = context . read < PrescriptionsViewModel > ( ) ;
/ / insuranceViewModel = context . read < InsuranceViewModel > ( ) ;
/ / immediateLiveCareViewModel = context . read < ImmediateLiveCareViewModel > ( ) ;
authVM . savePushTokenToAppState ( ) ;
if ( mounted ) {
@ -97,13 +99,11 @@ class _LandingPageState extends State<LandingPage> {
if ( appState . isAuthenticated ) {
habibWalletVM . initHabibWalletProvider ( ) ;
habibWalletVM . getPatientBalanceAmount ( ) ;
todoSectionViewModel . initializeTodoSectionViewModel ( ) ;
immediateLiveCareViewModel . initImmediateLiveCare ( ) ;
immediateLiveCareViewModel . getPatientLiveCareHistory ( ) ;
myAppointmentsViewModel . initAppointmentsViewModel ( ) ;
myAppointmentsViewModel . getPatientAppointments ( true , false ) ;
myAppointmentsViewModel . getPatientMyDoctors ( ) ;
prescriptionsViewModel . initPrescriptionsViewModel ( ) ;
insuranceViewModel . initInsuranceProvider ( ) ;
emergencyServicesViewModel . checkPatientERAdvanceBalance ( ) ;
myAppointmentsViewModel . getPatientAppointmentQueueDetails ( ) ;
if ( ! appState . isRatedVisible ) {
@ -111,17 +111,16 @@ class _LandingPageState extends State<LandingPage> {
if ( appointmentRatingViewModel . appointmentRatedList . isNotEmpty ) {
appointmentRatingViewModel . getAppointmentDetails ( appointmentRatingViewModel . appointmentRatedList . last . appointmentNo ! , appointmentRatingViewModel . appointmentRatedList . last . projectID ! ,
onSuccess: ( ( response ) {
appointmentRatingViewModel . setClinicOrDoctor ( false ) ;
appointmentRatingViewModel . setTitle ( " Rate Doctor " . needTranslation ) ;
appointmentRatingViewModel . setSubTitle ( " How was your last visit with doctor? " . needTranslation ) ;
openLastRating ( ) ;
appState . setRatedVisible ( true ) ;
} ) ) ;
} ) ,
) ;
}
} ) ;
} ,
) ;
}
}
} ) ;
@ -132,10 +131,10 @@ class _LandingPageState extends State<LandingPage> {
Widget build ( BuildContext context ) {
bookAppointmentsViewModel = Provider . of < BookAppointmentsViewModel > ( context , listen: false ) ;
myAppointmentsViewModel = Provider . of < MyAppointmentsViewModel > ( context , listen: false ) ;
prescriptionsViewModel = Provider . of < PrescriptionsViewModel > ( context , listen: false ) ;
insuranceViewModel = Provider . of < InsuranceViewModel > ( context , listen: false ) ;
immediateLiveCareViewModel = Provider . of < ImmediateLiveCareViewModel > ( context , listen: false ) ;
emergencyServicesViewModel = Provider . of < EmergencyServicesViewModel > ( context , listen: false ) ;
todoSectionViewModel = Provider . of < TodoSectionViewModel > ( context , listen: false ) ;
appState = getIt . get < AppState > ( ) ;
return PopScope (
canPop: false ,
@ -214,6 +213,50 @@ class _LandingPageState extends State<LandingPage> {
) ,
] ,
) . paddingSymmetrical ( 24. h , 0. h ) ,
! appState . isAuthenticated
? Container (
decoration: RoundedRectangleBorder ( ) . toSmoothCornerDecoration (
color: AppColors . whiteColor ,
borderRadius: 24. r ,
hasShadow: false ,
) ,
child: Padding (
padding: EdgeInsets . all ( 16. h ) ,
child: Row (
children: [
Utils . buildSvgWithAssets (
width: 50. w ,
height: 60. h ,
icon: AppAssets . symptomCheckerIcon ,
fit: BoxFit . contain ,
) ,
SizedBox ( width: 12. w ) ,
Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
" How are you feeling today? " . needTranslation . toText14 ( isBold: true ) ,
" Check your symptoms with this scale " . needTranslation . toText12 ( fontWeight: FontWeight . w500 ) ,
SizedBox ( height: 14. h ) ,
CustomButton (
text: " Check your symptoms " . needTranslation ,
onPressed: ( ) async {
context . navigateWithName ( AppRoutes . userInfoSelection ) ;
} ,
backgroundColor: Color ( 0xFF2B353E ) ,
borderColor: Color ( 0xFF2B353E ) ,
textColor: AppColors . whiteColor ,
fontSize: 14 ,
fontWeight: FontWeight . w600 ,
borderRadius: 12 ,
height: 40. h ,
) ,
] ,
)
] ,
) ,
) ,
) . paddingSymmetrical ( 24. w , 0. h )
: SizedBox . shrink ( ) ,
appState . isAuthenticated
? Column (
children: [
@ -234,8 +277,8 @@ class _LandingPageState extends State<LandingPage> {
Navigator . of ( context ) . push ( CustomPageRoute ( page: MyAppointmentsPage ( ) ) ) ;
} ) ,
SizedBox ( height: 16. h ) ,
Consumer 2 < MyAppointmentsViewModel , ImmediateLiveCare ViewModel> (
builder: ( context , myAppointmentsVM , immediateLiveCareVM , child) {
Consumer 3 < MyAppointmentsViewModel , ImmediateLiveCare ViewModel, TodoSection ViewModel> (
builder: ( context , myAppointmentsVM , immediateLiveCareVM , todoSectionVM, child) {
return myAppointmentsVM . isMyAppointmentsLoading
? Container (
decoration: RoundedRectangleBorder ( ) . toSmoothCornerDecoration (
@ -452,6 +495,27 @@ class _LandingPageState extends State<LandingPage> {
SizedBox ( height: 12. h ) ,
] ,
)
: ( todoSectionVM . patientAncillaryOrdersList . isNotEmpty & & index = = 1 )
? AncillaryOrderCard (
order: todoSectionVM . patientAncillaryOrdersList . first ,
isLoading: false ,
isOrdersList: false ,
onCheckIn: ( ) {
log ( " Check-in for order: ${ todoSectionVM . patientAncillaryOrdersList . first . orderNo } " ) ;
} ,
onViewDetails: ( ) {
Navigator . of ( context ) . push (
CustomPageRoute (
page: AncillaryOrderDetailsList (
appointmentNoVida: todoSectionVM . patientAncillaryOrdersList . first . appointmentNo ? ? 0 ,
orderNo: todoSectionVM . patientAncillaryOrdersList . first . orderNo ? ? 0 ,
projectID: todoSectionVM . patientAncillaryOrdersList . first . projectID ? ? 0 ,
projectName: todoSectionVM . patientAncillaryOrdersList . first . projectName ? ? " " ,
) ,
) ,
) ;
} ,
)
: Container (
decoration: RoundedRectangleBorder ( ) . toSmoothCornerDecoration (
color: AppColors . whiteColor ,