From 6a687f4ff63303211646d30a3f8401fd79607b13 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 9 Apr 2026 12:37:45 +0300 Subject: [PATCH] Updates & fixes --- .../patient_queue_details_response_model.dart | 7 +++- .../my_appointments/my_appointments_repo.dart | 3 +- .../my_appointments_view_model.dart | 31 +++++++++++++- lib/presentation/home/landing_page.dart | 41 +++++++++++++++++-- 4 files changed, 74 insertions(+), 8 deletions(-) diff --git a/lib/features/my_appointments/models/resp_models/patient_queue_details_response_model.dart b/lib/features/my_appointments/models/resp_models/patient_queue_details_response_model.dart index c36b9ec5..8ad174ff 100644 --- a/lib/features/my_appointments/models/resp_models/patient_queue_details_response_model.dart +++ b/lib/features/my_appointments/models/resp_models/patient_queue_details_response_model.dart @@ -6,6 +6,7 @@ class PatientQueueDetails { String? roomNo; String? calledOn; bool? servingNow; + int? isClinicConfigured; PatientQueueDetails( {this.patientID, @@ -14,7 +15,7 @@ class PatientQueueDetails { this.callType, this.roomNo, this.calledOn, - this.servingNow}); + this.servingNow, this.isClinicConfigured}); PatientQueueDetails.fromJson(Map json) { patientID = json['patientID']; @@ -24,10 +25,11 @@ class PatientQueueDetails { roomNo = json['roomNo']; calledOn = json['calledOn']; servingNow = json['servingNow']; + isClinicConfigured = json['isClinicConfigured']; } Map toJson() { - final Map data = new Map(); + final Map data = Map(); data['patientID'] = this.patientID; data['patientName'] = this.patientName; data['queueNo'] = this.queueNo; @@ -35,6 +37,7 @@ class PatientQueueDetails { data['roomNo'] = this.roomNo; data['calledOn'] = this.calledOn; data['servingNow'] = this.servingNow; + data['isClinicConfigured'] = this.isClinicConfigured; return data; } } diff --git a/lib/features/my_appointments/my_appointments_repo.dart b/lib/features/my_appointments/my_appointments_repo.dart index 2c9391a4..7344bc22 100644 --- a/lib/features/my_appointments/my_appointments_repo.dart +++ b/lib/features/my_appointments/my_appointments_repo.dart @@ -834,7 +834,7 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo { @override Future>>> getPatientAppointmentQueueDetails({required int appointmentNo, required int patientID, required int clinicID}) async { - Map mapDevice = {"appointmentNo": appointmentNo, "patientID": patientID, "ClinicID": clinicID, "apiKey": "EE17D21C7943485D9780223CCE55DCE5"}; + Map mapDevice = {"appointmentNo": appointmentNo, "patientID": patientID, "clinicID": clinicID, "apiKey": "EE17D21C7943485D9780223CCE55DCE5"}; try { GenericApiModel>? apiResponse; Failure? failure; @@ -842,6 +842,7 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo { failure = failureType; }, onSuccess: (response, statusCode, {messageStatus, errorMessage}) { try { + // final list = response['data']; final list = response['data']; final queueList = list.map((item) => PatientQueueDetails.fromJson(item as Map)).toList().cast(); diff --git a/lib/features/my_appointments/my_appointments_view_model.dart b/lib/features/my_appointments/my_appointments_view_model.dart index 5db21aee..a6f306ba 100644 --- a/lib/features/my_appointments/my_appointments_view_model.dart +++ b/lib/features/my_appointments/my_appointments_view_model.dart @@ -929,6 +929,7 @@ class MyAppointmentsViewModel extends ChangeNotifier { //TODO: Discuss With Haroon, Is the User Has no data it return No Element Bad State; isPatientHasQueueAppointment = false; isAppointmentQueueDetailsLoading = true; + patientQueueDetailsList.clear(); notifyListeners(); final result = await myAppointmentsRepo.getPatientAppointmentQueueDetails( @@ -949,8 +950,32 @@ class MyAppointmentsViewModel extends ChangeNotifier { onError!(apiResponse.errorMessage!); } else if (apiResponse.messageStatus == 1) { if (apiResponse.data != null && apiResponse.data!.isNotEmpty) { - isPatientHasQueueAppointment = true; patientQueueDetailsList = apiResponse.data!; + + if (patientQueueDetailsList.first.isClinicConfigured == 1) { + isPatientHasQueueAppointment = true; + for (var element in patientQueueDetailsList) { + if (element.patientID == patientArrivedAppointmentsHistoryList.first.patientID) { + currentPatientQueueDetails = element; + currentQueueStatus = element.callType!; + // currentQueueStatus = 2; + break; + } + } + // patientQueueDetailsList.first.callType = 1; + patientQueueDetailsList.removeWhere((element) => element.patientID == patientArrivedAppointmentsHistoryList.first.patientID); + } else { + isPatientHasQueueAppointment = false; + } + } else { + isPatientHasQueueAppointment = false; + } + + if (apiResponse.data != null && apiResponse.data!.isNotEmpty) { + patientQueueDetailsList = apiResponse.data!; + + // if (patientQueueDetailsList.first.isClinicConfigured == 1) { + isPatientHasQueueAppointment = true; for (var element in patientQueueDetailsList) { if (element.patientID == patientArrivedAppointmentsHistoryList.first.patientID) { currentPatientQueueDetails = element; @@ -960,8 +985,10 @@ class MyAppointmentsViewModel extends ChangeNotifier { } } // patientQueueDetailsList.first.callType = 1; - patientQueueDetailsList.removeWhere((element) => element.patientID == patientArrivedAppointmentsHistoryList.first.patientID); + // } else { + // isPatientHasQueueAppointment = false; + // } } else { isPatientHasQueueAppointment = false; } diff --git a/lib/presentation/home/landing_page.dart b/lib/presentation/home/landing_page.dart index 1d7e3777..3f2dcaf6 100644 --- a/lib/presentation/home/landing_page.dart +++ b/lib/presentation/home/landing_page.dart @@ -104,9 +104,13 @@ class _LandingPageState extends State { final ScrollController _horizontalScrollController = ScrollController(); + final ScrollController _scrollController = ScrollController(); + double _scrollOpacity = 0.0; + @override void dispose() { _horizontalScrollController.dispose(); + _scrollController.dispose(); super.dispose(); } @@ -122,6 +126,17 @@ class _LandingPageState extends State { showQuickLogin(context); }); } + + _scrollController.addListener(() { + final scrollOffset = _scrollController.offset; + final newOpacity = (scrollOffset / 50).clamp(0.0, 1.0); + if (_scrollOpacity != newOpacity) { + setState(() { + _scrollOpacity = newOpacity; + }); + } + }); + scheduleMicrotask(() async { if (!appState.isAuthenticated) { // LoaderBottomSheet.showLoader(); @@ -203,6 +218,7 @@ class _LandingPageState extends State { } }, child: SingleChildScrollView( + controller: _scrollController, physics: const AlwaysScrollableScrollPhysics(), padding: EdgeInsets.only( top: (appState.isAuthenticated && !insuranceVM.isInsuranceLoading && insuranceVM.isInsuranceExpired && insuranceVM.isInsuranceExpiryBannerShown) @@ -701,8 +717,8 @@ class _LandingPageState extends State { itemBuilder: (context, index) { return AnimationConfiguration.staggeredList( position: index, - duration: const Duration(milliseconds: 1000), - child: SlideAnimation( + duration: const Duration(milliseconds: 500), + child: SlideAnimation( horizontalOffset: 100.0, child: FadeInAnimation( child: SmallServiceCard( @@ -833,6 +849,25 @@ class _LandingPageState extends State { ), ), ), + AnimatedOpacity( + opacity: _scrollOpacity, + duration: Duration(milliseconds: 200), + child: Container( + height: MediaQuery.paddingOf(context).top + 10.h, + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + AppColors.scaffoldBgColor, + AppColors.scaffoldBgColor.withValues(alpha: 0.9), + AppColors.scaffoldBgColor.withValues(alpha: 0.0), + ], + stops: [0.0, 0.7, 1.0], + ), + ), + ), + ), (appState.isAuthenticated && !insuranceVM.isInsuranceLoading && insuranceVM.isInsuranceExpired && insuranceVM.isInsuranceExpiryBannerShown) ? Container( height: MediaQuery.paddingOf(context).top + 50.h, @@ -1042,7 +1077,7 @@ class _LandingPageState extends State { // Queue Card: Currently serving section Widget _buildServingNowSection() { if (myAppointmentsViewModel.patientQueueDetailsList.isEmpty) { - return SizedBox(height: 12.h); + return SizedBox(height: 24.h); } final servingQueue = myAppointmentsViewModel.patientQueueDetailsList.first;