|
|
|
@ -80,8 +80,13 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
|
|
|
|
String _countdownText = "";
|
|
|
|
String _countdownText = "";
|
|
|
|
Function(void Function())? _modalSetState; // Callback for modal state updates
|
|
|
|
Function(void Function())? _modalSetState; // Callback for modal state updates
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// GlobalKey for BellAnimatedSwitch to control it programmatically
|
|
|
|
|
|
|
|
final GlobalKey<BellAnimatedSwitchState> _bellSwitchKey = GlobalKey<BellAnimatedSwitchState>();
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
|
|
|
|
scheduleMicrotask(() async {
|
|
|
|
scheduleMicrotask(() async {
|
|
|
|
if (AppointmentType.isArrived(widget.patientAppointmentHistoryResponseModel)) {
|
|
|
|
if (AppointmentType.isArrived(widget.patientAppointmentHistoryResponseModel)) {
|
|
|
|
myAppointmentsViewModel.getDoctorsRatingCheck(
|
|
|
|
myAppointmentsViewModel.getDoctorsRatingCheck(
|
|
|
|
@ -102,12 +107,12 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Initialize countdown timer for payment
|
|
|
|
// Initialize countdown timer for payment after first frame to ensure context is available
|
|
|
|
if (widget.patientAppointmentHistoryResponseModel.nextAction == 15 || widget.patientAppointmentHistoryResponseModel.nextAction == 20) {
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
|
|
|
if (mounted) {
|
|
|
|
_startCountdownTimer();
|
|
|
|
_startCountdownTimer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Checks if a reminder exists in the calendar for this appointment
|
|
|
|
/// Checks if a reminder exists in the calendar for this appointment
|
|
|
|
@ -364,18 +369,13 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
|
|
|
|
onRescheduleTap: () async {
|
|
|
|
onRescheduleTap: () async {
|
|
|
|
openDoctorScheduleCalendar();
|
|
|
|
openDoctorScheduleCalendar();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
timerWidget: Column(
|
|
|
|
timerWidget: (_timeRemaining == null || _timeRemaining == Duration.zero)
|
|
|
|
|
|
|
|
? null
|
|
|
|
|
|
|
|
: Column(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(height: 16.w),
|
|
|
|
height: 16.w,
|
|
|
|
Divider(height: 1, color: AppColors.dividerColor),
|
|
|
|
),
|
|
|
|
SizedBox(height: 16.w),
|
|
|
|
Divider(
|
|
|
|
|
|
|
|
height: 1,
|
|
|
|
|
|
|
|
color: AppColors.dividerColor,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 16.w,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Directionality(
|
|
|
|
Directionality(
|
|
|
|
textDirection: ui.TextDirection.ltr,
|
|
|
|
textDirection: ui.TextDirection.ltr,
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
@ -384,28 +384,28 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: _buildTimeUnit(
|
|
|
|
child: _buildTimeUnit(
|
|
|
|
_timeRemaining != null ? _timeRemaining!.inDays.toString().padLeft(2, '0') : '00',
|
|
|
|
_timeRemaining!.inDays.toString().padLeft(2, '0'),
|
|
|
|
LocaleKeys.days.tr(context: context),
|
|
|
|
LocaleKeys.days.tr(context: context),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
_buildTimeSeparator(),
|
|
|
|
_buildTimeSeparator(),
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: _buildTimeUnit(
|
|
|
|
child: _buildTimeUnit(
|
|
|
|
_timeRemaining != null ? _timeRemaining!.inHours.remainder(24).toString().padLeft(2, '0') : '00',
|
|
|
|
_timeRemaining!.inHours.remainder(24).toString().padLeft(2, '0'),
|
|
|
|
LocaleKeys.hours.tr(context: context),
|
|
|
|
LocaleKeys.hours.tr(context: context),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
_buildTimeSeparator(),
|
|
|
|
_buildTimeSeparator(),
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: _buildTimeUnit(
|
|
|
|
child: _buildTimeUnit(
|
|
|
|
_timeRemaining != null ? _timeRemaining!.inMinutes.remainder(60).toString().padLeft(2, '0') : '00',
|
|
|
|
_timeRemaining!.inMinutes.remainder(60).toString().padLeft(2, '0'),
|
|
|
|
LocaleKeys.minutes.tr(context: context),
|
|
|
|
LocaleKeys.minutes.tr(context: context),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
_buildTimeSeparator(),
|
|
|
|
_buildTimeSeparator(),
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: _buildTimeUnit(
|
|
|
|
child: _buildTimeUnit(
|
|
|
|
_timeRemaining != null ? _timeRemaining!.inSeconds.remainder(60).toString().padLeft(2, '0') : '00',
|
|
|
|
_timeRemaining!.inSeconds.remainder(60).toString().padLeft(2, '0'),
|
|
|
|
LocaleKeys.seconds.tr(context: context),
|
|
|
|
LocaleKeys.seconds.tr(context: context),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -603,6 +603,7 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const Spacer(),
|
|
|
|
const Spacer(),
|
|
|
|
BellAnimatedSwitch(
|
|
|
|
BellAnimatedSwitch(
|
|
|
|
|
|
|
|
key: _bellSwitchKey,
|
|
|
|
initialValue: widget.patientAppointmentHistoryResponseModel.hasReminder ?? false,
|
|
|
|
initialValue: widget.patientAppointmentHistoryResponseModel.hasReminder ?? false,
|
|
|
|
activeColor: AppColors.successColor.withOpacity(0.2),
|
|
|
|
activeColor: AppColors.successColor.withOpacity(0.2),
|
|
|
|
inactiveColor: AppColors.lightGrayBGColor,
|
|
|
|
inactiveColor: AppColors.lightGrayBGColor,
|
|
|
|
@ -618,7 +619,9 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
|
|
|
|
if (newValue == true) {
|
|
|
|
if (newValue == true) {
|
|
|
|
DateTime startDate = DateTime.now();
|
|
|
|
DateTime startDate = DateTime.now();
|
|
|
|
DateTime endDate = DateUtil.convertStringToDate(widget.patientAppointmentHistoryResponseModel.appointmentDate);
|
|
|
|
DateTime endDate = DateUtil.convertStringToDate(widget.patientAppointmentHistoryResponseModel.appointmentDate);
|
|
|
|
BottomSheetUtils().showReminderBottomSheet(
|
|
|
|
|
|
|
|
|
|
|
|
// Show reminder bottom sheet and check if permission was granted
|
|
|
|
|
|
|
|
bool permissionGranted = await BottomSheetUtils().showReminderBottomSheet(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
endDate,
|
|
|
|
endDate,
|
|
|
|
widget.patientAppointmentHistoryResponseModel.doctorNameObj ?? "",
|
|
|
|
widget.patientAppointmentHistoryResponseModel.doctorNameObj ?? "",
|
|
|
|
@ -649,6 +652,11 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If permission was not granted, revert the switch back to OFF
|
|
|
|
|
|
|
|
if (!permissionGranted) {
|
|
|
|
|
|
|
|
_bellSwitchKey.currentState?.setSwitchValue(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
isEventAddedOrRemoved = await calender.checkAndRemove(
|
|
|
|
isEventAddedOrRemoved = await calender.checkAndRemove(
|
|
|
|
id: "${widget.patientAppointmentHistoryResponseModel.appointmentNo}",
|
|
|
|
id: "${widget.patientAppointmentHistoryResponseModel.appointmentNo}",
|
|
|
|
@ -1210,8 +1218,7 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
|
|
|
|
handleAppointmentNextAction(widget.patientAppointmentHistoryResponseModel.nextAction);
|
|
|
|
handleAppointmentNextAction(widget.patientAppointmentHistoryResponseModel.nextAction);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
backgroundColor: AppointmentType.getNextActionButtonColor(widget.patientAppointmentHistoryResponseModel.nextAction),
|
|
|
|
backgroundColor: AppointmentType.getNextActionButtonColor(widget.patientAppointmentHistoryResponseModel.nextAction),
|
|
|
|
borderColor:
|
|
|
|
borderColor: AppointmentType.getNextActionButtonColor(widget.patientAppointmentHistoryResponseModel.nextAction).withValues(alpha: 0.01),
|
|
|
|
AppointmentType.getNextActionButtonColor(widget.patientAppointmentHistoryResponseModel.nextAction).withValues(alpha: 0.01),
|
|
|
|
|
|
|
|
textColor: widget.patientAppointmentHistoryResponseModel.nextAction == 15 ? AppColors.textColor : Colors.white,
|
|
|
|
textColor: widget.patientAppointmentHistoryResponseModel.nextAction == 15 ? AppColors.textColor : Colors.white,
|
|
|
|
fontSize: 16.f,
|
|
|
|
fontSize: 16.f,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
@ -1392,9 +1399,10 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
|
|
|
|
return Column(
|
|
|
|
return Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Lottie.asset(AppAnimations.warningAnimation,
|
|
|
|
Lottie.asset(AppAnimations.warningAnimation, repeat: false, reverse: false, frameRate: FrameRate(60), width: 100.h, height: 100.h, fit: BoxFit.fill),
|
|
|
|
repeat: false, reverse: false, frameRate: FrameRate(60), width: 100.h, height: 100.h, fit: BoxFit.fill),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(height: 12,),
|
|
|
|
height: 12,
|
|
|
|
|
|
|
|
),
|
|
|
|
LocaleKeys.upcomingPaymentPending.tr(context: context).toText14(color: AppColors.textColor, isCenter: true),
|
|
|
|
LocaleKeys.upcomingPaymentPending.tr(context: context).toText14(color: AppColors.textColor, isCenter: true),
|
|
|
|
SizedBox(height: 24.h),
|
|
|
|
SizedBox(height: 24.h),
|
|
|
|
// // Countdown Timer - DD : HH : MM : SS format with labels - Always LTR
|
|
|
|
// // Countdown Timer - DD : HH : MM : SS format with labels - Always LTR
|
|
|
|
|