pull down to refresh in appointment queue implemented

pull/213/head
haroon amjad 1 day ago
parent 991f9c7a9b
commit 185f505ed9

@ -930,6 +930,7 @@ class MyAppointmentsViewModel extends ChangeNotifier {
isPatientHasQueueAppointment = false; isPatientHasQueueAppointment = false;
isAppointmentQueueDetailsLoading = true; isAppointmentQueueDetailsLoading = true;
notifyListeners(); notifyListeners();
final result = await myAppointmentsRepo.getPatientAppointmentQueueDetails( final result = await myAppointmentsRepo.getPatientAppointmentQueueDetails(
appointmentNo: patientArrivedAppointmentsHistoryList.first.appointmentNo, patientID: patientArrivedAppointmentsHistoryList.first.patientID); appointmentNo: patientArrivedAppointmentsHistoryList.first.appointmentNo, patientID: patientArrivedAppointmentsHistoryList.first.patientID);

@ -33,178 +33,162 @@ class AppointmentQueuePage extends StatelessWidget {
Expanded( Expanded(
child: CollapsingListView( child: CollapsingListView(
title: LocaleKeys.queueing.tr(context: context), title: LocaleKeys.queueing.tr(context: context),
child: SingleChildScrollView( child: RefreshIndicator(
child: Padding( color: AppColors.primaryRedColor,
padding: EdgeInsets.all(24.0), onRefresh: () async {
child: Column( await myAppointmentsVM.getPatientAppointmentQueueDetails();
crossAxisAlignment: CrossAxisAlignment.start, },
children: [ child: SingleChildScrollView(
Container( child: Padding(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( padding: EdgeInsets.all(24.0),
color: AppColors.whiteColor, child: Column(
borderRadius: 20.h, crossAxisAlignment: CrossAxisAlignment.start,
hasShadow: false, children: [
side: BorderSide( Container(
color: myAppointmentsVM.isAppointmentQueueDetailsLoading decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
? AppColors.whiteColor color: AppColors.whiteColor,
: Utils.getCardBorderColor(myAppointmentsVM.currentQueueStatus), borderRadius: 20.h,
width: 2.w), hasShadow: false,
), side: BorderSide(
child: Padding( color: myAppointmentsVM.isAppointmentQueueDetailsLoading ? AppColors.whiteColor : Utils.getCardBorderColor(myAppointmentsVM.currentQueueStatus), width: 2.w),
padding: EdgeInsets.all(16.h), ),
child: Column( child: Padding(
crossAxisAlignment: CrossAxisAlignment.start, padding: EdgeInsets.all(16.h),
children: [ child: Column(
Row( crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
AppCustomChipWidget( Row(
labelText: myAppointmentsVM.currentQueueStatus == 0 ? LocaleKeys.inQueue.tr(context: context) : LocaleKeys.yourTurn.tr(context: context), mainAxisAlignment: MainAxisAlignment.spaceBetween,
backgroundColor: Utils.getCardBorderColor(myAppointmentsVM.currentQueueStatus).withValues(alpha: 0.20), children: [
textColor: Utils.getCardBorderColor(myAppointmentsVM.currentQueueStatus), AppCustomChipWidget(
), labelText: myAppointmentsVM.currentQueueStatus == 0 ? LocaleKeys.inQueue.tr(context: context) : LocaleKeys.yourTurn.tr(context: context),
Utils.buildSvgWithAssets(icon: AppAssets.waiting_icon, width: 24.h, height: 24.h), backgroundColor: Utils.getCardBorderColor(myAppointmentsVM.currentQueueStatus).withValues(alpha: 0.20),
textColor: Utils.getCardBorderColor(myAppointmentsVM.currentQueueStatus),
),
Utils.buildSvgWithAssets(icon: AppAssets.waiting_icon, width: 24.h, height: 24.h),
],
).toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading),
SizedBox(height: 10.h),
"Hala ${appState!.getAuthenticatedUser()!.firstName}!!!".toText16(isBold: true).toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading),
SizedBox(height: 8.h),
LocaleKeys.thankYouForPatience
.tr(context: context)
.toText12(isBold: true, color: AppColors.textColorLight)
.toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading),
SizedBox(height: 8.h),
myAppointmentsVM.currentPatientQueueDetails.queueNo!.toText32(isBold: true).toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading),
SizedBox(height: 8.h),
CustomButton(
text: Utils.getCardButtonText(myAppointmentsVM.currentQueueStatus, myAppointmentsVM.currentPatientQueueDetails.roomNo ?? ""),
onPressed: () {},
backgroundColor: Utils.getCardButtonColor(myAppointmentsVM.currentQueueStatus),
borderColor: Utils.getCardButtonColor(myAppointmentsVM.currentQueueStatus).withValues(alpha: 0.01),
textColor: Utils.getCardButtonTextColor(myAppointmentsVM.currentQueueStatus),
fontSize: 12.f,
fontWeight: FontWeight.w600,
borderRadius: 12.r,
padding: EdgeInsets.symmetric(horizontal: 10.w),
height: 40.h,
iconColor: AppColors.whiteColor,
iconSize: 18.h,
).toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading),
], ],
).toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading),
SizedBox(height: 10.h),
"Hala ${appState!.getAuthenticatedUser()!.firstName}!!!"
.toText16(isBold: true)
.toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading),
SizedBox(height: 8.h),
LocaleKeys.thankYouForPatience.tr(context: context)
.toText12(isBold: true, color: AppColors.textColorLight)
.toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading),
SizedBox(height: 8.h),
myAppointmentsVM.currentPatientQueueDetails.queueNo!
.toText32(isBold: true)
.toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading),
SizedBox(height: 8.h),
CustomButton(
text: Utils.getCardButtonText(
myAppointmentsVM.currentQueueStatus, myAppointmentsVM.currentPatientQueueDetails.roomNo ?? ""),
onPressed: () {},
backgroundColor: Utils.getCardButtonColor(myAppointmentsVM.currentQueueStatus),
borderColor: Utils.getCardButtonColor(myAppointmentsVM.currentQueueStatus).withValues(alpha: 0.01),
textColor: Utils.getCardButtonTextColor(myAppointmentsVM.currentQueueStatus),
fontSize: 12.f,
fontWeight: FontWeight.w600,
borderRadius: 12.r,
padding: EdgeInsets.symmetric(horizontal: 10.w),
height: 40.h,
iconColor: AppColors.whiteColor,
iconSize: 18.h,
).toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading),
],
),
),
),
SizedBox(height: 16.h),
myAppointmentsVM.patientQueueDetailsList.isNotEmpty
? Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 20.h,
hasShadow: true,
), ),
child: Padding( ),
padding: EdgeInsets.all(16.h), ),
child: Column( SizedBox(height: 16.h),
crossAxisAlignment: CrossAxisAlignment.start, myAppointmentsVM.patientQueueDetailsList.isNotEmpty
children: [ ? Container(
LocaleKeys.servingNow.tr(context: context) decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
.toText16(isBold: true) color: AppColors.whiteColor,
.toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading), borderRadius: 20.h,
SizedBox(height: 18.h), hasShadow: true,
ListView.separated( ),
padding: EdgeInsets.zero, child: Padding(
shrinkWrap: true, padding: EdgeInsets.all(16.h),
itemCount: myAppointmentsVM.patientQueueDetailsList.length, child: Column(
physics: NeverScrollableScrollPhysics(), crossAxisAlignment: CrossAxisAlignment.start,
itemBuilder: (BuildContext context, int index) { children: [
return Row( LocaleKeys.servingNow.tr(context: context).toText16(isBold: true).toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading),
mainAxisAlignment: MainAxisAlignment.spaceBetween, SizedBox(height: 18.h),
crossAxisAlignment: CrossAxisAlignment.start, ListView.separated(
children: [ padding: EdgeInsets.zero,
myAppointmentsVM.patientQueueDetailsList[index].queueNo!.toText17(isBold: true), shrinkWrap: true,
Row( itemCount: myAppointmentsVM.patientQueueDetailsList.length,
crossAxisAlignment: CrossAxisAlignment.center, physics: NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
"Room: ${myAppointmentsVM.patientQueueDetailsList[index].roomNo}" myAppointmentsVM.patientQueueDetailsList[index].queueNo!.toText17(isBold: true),
.toText12(isBold: true), Row(
SizedBox(width: 8.w), crossAxisAlignment: CrossAxisAlignment.center,
AppCustomChipWidget( children: [
deleteIcon: myAppointmentsVM.patientQueueDetailsList[index].callType == 1 "Room: ${myAppointmentsVM.patientQueueDetailsList[index].roomNo}".toText12(isBold: true),
? AppAssets.call_for_vitals SizedBox(width: 8.w),
: AppAssets.call_for_doctor, AppCustomChipWidget(
labelText: myAppointmentsVM.patientQueueDetailsList[index].callType == 1 deleteIcon: myAppointmentsVM.patientQueueDetailsList[index].callType == 1 ? AppAssets.call_for_vitals : AppAssets.call_for_doctor,
? LocaleKeys.callForVitalSigns.tr(context: context) labelText: myAppointmentsVM.patientQueueDetailsList[index].callType == 1
: LocaleKeys.callForDoctor.tr(context: context), ? LocaleKeys.callForVitalSigns.tr(context: context)
iconColor: myAppointmentsVM.patientQueueDetailsList[index].callType == 1 : LocaleKeys.callForDoctor.tr(context: context),
? AppColors.primaryRedColor iconColor: myAppointmentsVM.patientQueueDetailsList[index].callType == 1 ? AppColors.primaryRedColor : AppColors.successColor,
: AppColors.successColor, textColor: myAppointmentsVM.patientQueueDetailsList[index].callType == 1 ? AppColors.primaryRedColor : AppColors.successColor,
textColor: myAppointmentsVM.patientQueueDetailsList[index].callType == 1 iconSize: 14.w,
? AppColors.primaryRedColor backgroundColor: myAppointmentsVM.patientQueueDetailsList[index].callType == 1
: AppColors.successColor, ? AppColors.primaryRedColor.withValues(alpha: 0.1)
iconSize: 14.w, : AppColors.successColor.withValues(alpha: 0.1),
backgroundColor: myAppointmentsVM.patientQueueDetailsList[index].callType == 1 labelPadding: EdgeInsetsDirectional.only(start: 8.h, end: -2.h),
? AppColors.primaryRedColor.withValues(alpha: 0.1) ),
: AppColors.successColor.withValues(alpha: 0.1), ],
labelPadding: EdgeInsetsDirectional.only(start: 8.h, end: -2.h),
), ),
], ],
), );
], },
); separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 8.h),
}, ).toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading),
separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 8.h), ],
).toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading), ),
], ),
), )
), : SizedBox.shrink(),
) SizedBox(height: 16.h),
: SizedBox.shrink(), Container(
SizedBox(height: 16.h), decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
Container( color: AppColors.whiteColor,
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( borderRadius: 24.4,
color: AppColors.whiteColor, hasShadow: true,
borderRadius: 24.4, ),
hasShadow: true, child: Padding(
), padding: EdgeInsets.all(16.h),
child: Padding( child: Column(
padding: EdgeInsets.all(16.h), crossAxisAlignment: CrossAxisAlignment.start,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [ children: [
Utils.buildSvgWithAssets(icon: AppAssets.bulb_icon, width: 24.w, height: 24.h), Row(
SizedBox(width: 8.w), children: [
LocaleKeys.thingsToAskDoctor.tr(context: context).toText16(isBold: true), Utils.buildSvgWithAssets(icon: AppAssets.bulb_icon, width: 24.w, height: 24.h),
SizedBox(width: 8.w),
LocaleKeys.thingsToAskDoctor.tr(context: context).toText16(isBold: true),
],
),
SizedBox(height: 8.h),
"${LocaleKeys.improveOverallHealth.tr(context: context)}".toText12(isBold: true, color: AppColors.textColorLight),
SizedBox(height: 4.h),
"${LocaleKeys.routineScreenings.tr(context: context)}".toText12(isBold: true, color: AppColors.textColorLight),
SizedBox(height: 4.h),
"${LocaleKeys.whatIsThisMedicationFor.tr(context: context)}".toText12(isBold: true, color: AppColors.textColorLight),
SizedBox(height: 4.h),
"${LocaleKeys.sideEffectsToKnow.tr(context: context)}".toText12(isBold: true, color: AppColors.textColorLight),
SizedBox(height: 4.h),
"${LocaleKeys.whenFollowUp.tr(context: context)}".toText12(isBold: true, color: AppColors.textColorLight),
SizedBox(height: 16.h),
], ],
), ).toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading),
SizedBox(height: 8.h), ),
"${LocaleKeys.improveOverallHealth.tr(context: context)}" ),
.toText12(isBold: true, color: AppColors.textColorLight), ],
SizedBox(height: 4.h),
"${LocaleKeys.routineScreenings.tr(context: context)}"
.toText12(isBold: true, color: AppColors.textColorLight),
SizedBox(height: 4.h),
"${LocaleKeys.whatIsThisMedicationFor.tr(context: context)}"
.toText12(isBold: true, color: AppColors.textColorLight),
SizedBox(height: 4.h),
"${LocaleKeys.sideEffectsToKnow.tr(context: context)}"
.toText12(isBold: true, color: AppColors.textColorLight),
SizedBox(height: 4.h),
"${LocaleKeys.whenFollowUp.tr(context: context)}"
.toText12(isBold: true, color: AppColors.textColorLight),
SizedBox(height: 16.h),
],
).toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading),
),
), ),
], ),
),
), ),
), ),
), ),

@ -239,12 +239,10 @@ class _SelectDoctorPageState extends State<SelectDoctorPage> {
value: bookAppointmentsVM.isNearestAppointmentSelected, value: bookAppointmentsVM.isNearestAppointmentSelected,
onChanged: (newValue) async { onChanged: (newValue) async {
bookAppointmentsVM.setIsNearestAppointmentSelected(newValue); bookAppointmentsVM.setIsNearestAppointmentSelected(newValue);
if(newValue) { bookAppointmentsVM.refreshDoctorsList();
bookAppointmentsVM.refreshDoctorsList(); },
} ),
}, ],
),
],
) )
: SizedBox.shrink(), : SizedBox.shrink(),
ListView.separated( ListView.separated(

Loading…
Cancel
Save