@ -23,339 +23,313 @@ import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
import ' package:hmg_patient_app_new/widgets/common_bottom_sheet.dart ' ;
import ' package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart ' ;
import ' package:hmg_patient_app_new/widgets/routes/custom_page_route.dart ' ;
import ' package:hmg_patient_app_new/widgets/transitions/fade_page.dart ' ;
import ' package:smooth_corner/smooth_corner.dart ' ;
class AppointmentCard extends StatefulWidget {
AppointmentCard (
{ super . key ,
required this . patientAppointmentHistoryResponseModel ,
required this . myAppointmentsViewModel ,
required this . bookAppointmentsViewModel ,
this . isLoading = false ,
this . isFromHomePage = false ,
this . isFromMedicalReport = false ,
this . medicalFileViewModel } ) ;
class AppointmentCard extends StatelessWidget {
final PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel ;
final MyAppointmentsViewModel myAppointmentsViewModel ;
final bool isLoading ;
final bool isFromHomePage ;
final bool isFromMedicalReport ;
final MedicalFileViewModel ? medicalFileViewModel ;
final BookAppointmentsViewModel bookAppointmentsViewModel ;
PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel ;
MyAppointmentsViewModel myAppointmentsViewModel ;
bool isLoading ;
bool isFromHomePage ;
bool isFromMedicalReport ;
MedicalFileViewModel ? medicalFileViewModel ;
BookAppointmentsViewModel bookAppointmentsViewModel ;
const AppointmentCard ( {
super . key ,
required this . patientAppointmentHistoryResponseModel ,
required this . myAppointmentsViewModel ,
required this . bookAppointmentsViewModel ,
this . isLoading = false ,
this . isFromHomePage = false ,
this . isFromMedicalReport = false ,
this . medicalFileViewModel ,
} ) ;
@ override
State < AppointmentCard > createState ( ) = > _AppointmentCardState ( ) ;
}
class _AppointmentCardState extends State < AppointmentCard > {
@ override
Widget build ( BuildContext context ) {
AppState appState = getIt . get < AppState > ( ) ;
final appState = getIt . get < AppState > ( ) ;
return InkWell (
onTap: ( ) {
Navigator . of ( context )
. push (
CustomPageRoute (
page: AppointmentDetailsPage ( patientAppointmentHistoryResponseModel: widget . patientAppointmentHistoryResponseModel ) ,
) ,
)
. then ( ( val ) {
widget . myAppointmentsViewModel . initAppointmentsViewModel ( ) ;
widget . myAppointmentsViewModel . getPatientAppointments ( true , false ) ;
} ) ;
} ,
onTap: ( ) = > _goToDetails ( context ) ,
child: Padding (
padding: EdgeInsets . all ( 14. h ) ,
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: [
Expanded (
child: Wrap (
alignment: WrapAlignment . start ,
direction: Axis . horizontal ,
spacing: 6. h ,
runSpacing: 6. h ,
children: [
AppCustomChipWidget (
icon: widget . isLoading
? AppAssets . walkin_appointment_icon
: ( ! widget . patientAppointmentHistoryResponseModel . isLiveCareAppointment ! ? AppAssets . walkin_appointment_icon : AppAssets . small_livecare_icon ) ,
iconColor: widget . isLoading
? AppColors . textColor
: ! widget . patientAppointmentHistoryResponseModel . isLiveCareAppointment !
? AppColors . textColor
: AppColors . whiteColor ,
labelText: widget . isLoading
? " Walk In "
: widget . patientAppointmentHistoryResponseModel . isLiveCareAppointment !
? LocaleKeys . livecare . tr ( context: context )
: " Walk In " . needTranslation ,
backgroundColor:
widget . isLoading ? AppColors . greyColor : ( ! widget . patientAppointmentHistoryResponseModel . isLiveCareAppointment ! ? AppColors . greyColor : AppColors . successColor ) ,
textColor: widget . isLoading ? AppColors . textColor : ( ! widget . patientAppointmentHistoryResponseModel . isLiveCareAppointment ! ? AppColors . textColor : AppColors . whiteColor ) ,
) . toShimmer2 ( isShow: widget . isLoading ) ,
AppCustomChipWidget (
labelText: widget . isLoading
? " OutPatient "
: appState . isArabic ( )
? widget . patientAppointmentHistoryResponseModel . isInOutPatientDescriptionN !
: widget . patientAppointmentHistoryResponseModel . isInOutPatientDescription ! ,
backgroundColor: AppColors . primaryRedColor . withOpacity ( 0.1 ) ,
textColor: AppColors . primaryRedColor ,
) . toShimmer2 ( isShow: widget . isLoading ) ,
AppCustomChipWidget (
labelText: widget . isLoading ? " Booked " : AppointmentType . getAppointmentStatusType ( widget . patientAppointmentHistoryResponseModel . patientStatusType ! ) ,
backgroundColor: AppColors . successColor . withOpacity ( 0.1 ) ,
textColor: AppColors . successColor ,
) . toShimmer2 ( isShow: widget . isLoading ) ,
] ,
) . toShimmer2 ( isShow: widget . isLoading ) ,
) ,
/ / TODO: Implement the logic to enable / disable the switch based on reminder status
/ / AppointmentType . isArrived ( widget . patientAppointmentHistoryResponseModel )
/ / ? SizedBox ( ) . toShimmer2 ( isShow: widget . isLoading )
/ / : Switch (
/ / activeColor: AppColors . successColor ,
/ / activeTrackColor: AppColors . successColor . withValues ( alpha: . 15 ) ,
/ / thumbIcon: WidgetStateProperty . resolveWith < Icon ? > (
/ / ( Set < WidgetState > states ) {
/ / if ( states . contains ( WidgetState . selected ) ) {
/ / return const Icon ( Icons . check ) ; / / Icon when switch is ON
/ / }
/ / return const Icon ( Icons . close ) ; / / Icon when switch is OFF
/ / } ,
/ / ) ,
/ / value: widget . isLoading ? false : widget . patientAppointmentHistoryResponseModel . hasReminder ! ,
/ / onChanged: ( newValue ) {
/ / setState ( ( ) {
/ / widget . myAppointmentsViewModel . setAppointmentReminder ( newValue , widget . patientAppointmentHistoryResponseModel ) ;
/ / } ) ;
/ / } ,
/ / ) . toShimmer2 ( isShow: widget . isLoading ) ,
] ,
) ,
_buildHeader ( context , appState ) ,
SizedBox ( height: 16. h ) ,
Row (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Image . network (
widget . isLoading ? " https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png " : widget . patientAppointmentHistoryResponseModel . doctorImageURL ! ,
width: 63. h ,
height: 63. h ,
fit: BoxFit . cover ,
) . circle ( 100 ) . toShimmer2 ( isShow: widget . isLoading ) ,
SizedBox ( width: 16. h ) ,
Expanded (
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
( widget . isLoading ? " https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png " : widget . patientAppointmentHistoryResponseModel . doctorNameObj ! )
. toText16 ( isBold: true , maxlines: 1 )
. toShimmer2 ( isShow: widget . isLoading ) ,
SizedBox ( height: 8. h ) ,
Wrap (
direction: Axis . horizontal ,
spacing: 3. h ,
runSpacing: 4. h ,
children: [
widget . isFromHomePage
? SizedBox . shrink ( )
: AppCustomChipWidget ( labelText: widget . isLoading ? " Cardiology " : widget . patientAppointmentHistoryResponseModel . clinicName ! ) . toShimmer2 ( isShow: widget . isLoading ) ,
widget . isFromHomePage
? SizedBox . shrink ( )
: AppCustomChipWidget ( labelText: widget . isLoading ? " Olaya " : widget . patientAppointmentHistoryResponseModel . projectName ! ) . toShimmer2 ( isShow: widget . isLoading ) ,
AppCustomChipWidget (
icon: AppAssets . appointment_calendar_icon ,
labelText:
widget . isLoading ? " Cardiology " : DateUtil . formatDateToDate ( DateUtil . convertStringToDate ( widget . patientAppointmentHistoryResponseModel . appointmentDate ) , false ) )
. toShimmer2 ( isShow: widget . isLoading ) ,
widget . isFromMedicalReport
? SizedBox . shrink ( )
: AppCustomChipWidget (
icon: AppAssets . appointment_time_icon ,
labelText: widget . isLoading
? " Cardiology "
: DateUtil . formatDateToTimeLang ( DateUtil . convertStringToDate ( widget . patientAppointmentHistoryResponseModel . appointmentDate ) , false ) )
. toShimmer2 ( isShow: widget . isLoading ) ,
] ,
) ,
] ,
) ,
) ,
] ,
) ,
_buildDoctorRow ( context ) ,
SizedBox ( height: 16. h ) ,
widget . isFromMedicalReport
? CustomButton (
text: " Select appointment " . needTranslation ,
onPressed: ( ) {
widget . medicalFileViewModel ! . setSelectedMedicalReportAppointment ( widget . patientAppointmentHistoryResponseModel ) ;
Navigator . pop ( context , false ) ;
} ,
backgroundColor: AppColors . secondaryLightRedColor ,
borderColor: AppColors . secondaryLightRedColor ,
textColor: AppColors . primaryRedColor ,
fontSize: 14 ,
fontWeight: FontWeight . w500 ,
borderRadius: 12 ,
padding: EdgeInsets . fromLTRB ( 10 , 0 , 10 , 0 ) ,
height: 40. h ,
icon: AppAssets . checkmark_icon ,
iconColor: AppColors . primaryRedColor ,
iconSize: 16. h ,
)
: Row (
children: [
Expanded (
flex: 6 ,
child: AppointmentType . isArrived ( widget . patientAppointmentHistoryResponseModel )
? getArrivedAppointmentButton ( ) . toShimmer2 ( isShow: widget . isLoading )
: CustomButton (
text: AppointmentType . getNextActionText ( widget . patientAppointmentHistoryResponseModel . nextAction ) ,
onPressed: ( ) {
Navigator . of ( context )
. push ( CustomPageRoute (
page: AppointmentDetailsPage ( patientAppointmentHistoryResponseModel: widget . patientAppointmentHistoryResponseModel ) ,
) )
. then ( ( val ) {
widget . myAppointmentsViewModel . initAppointmentsViewModel ( ) ;
widget . myAppointmentsViewModel . getPatientAppointments ( true , false ) ;
} ) ;
} ,
backgroundColor: AppointmentType . getNextActionButtonColor ( widget . patientAppointmentHistoryResponseModel . nextAction ) . withOpacity ( 0.15 ) ,
borderColor: AppointmentType . getNextActionButtonColor ( widget . patientAppointmentHistoryResponseModel . nextAction ) . withOpacity ( 0.01 ) ,
textColor: AppointmentType . getNextActionTextColor ( widget . patientAppointmentHistoryResponseModel . nextAction ) ,
fontSize: 14 ,
fontWeight: FontWeight . w500 ,
borderRadius: 12 ,
padding: EdgeInsets . fromLTRB ( 10 , 0 , 10 , 0 ) ,
height: 40. h ,
icon: AppointmentType . getNextActionIcon ( widget . patientAppointmentHistoryResponseModel . nextAction ) ,
iconColor: AppointmentType . getNextActionTextColor ( widget . patientAppointmentHistoryResponseModel . nextAction ) ,
iconSize: 15. h ,
) . toShimmer2 ( isShow: widget . isLoading ) ,
) ,
SizedBox ( width: 8. h ) ,
Expanded (
flex: 1 ,
child: Container (
height: 40. h ,
width: 40. h ,
decoration: RoundedRectangleBorder ( ) . toSmoothCornerDecoration (
color: AppColors . textColor ,
borderRadius: 10. h ,
) ,
child: Transform . flip (
flipX: appState . isArabic ( ) ,
child: Utils . buildSvgWithAssets (
icon: AppAssets . forward_arrow_icon ,
iconColor: AppColors . whiteColor ,
width: 40. h ,
height: 40. h ,
fit: BoxFit . cover ,
) ,
) ,
) . toShimmer2 ( isShow: widget . isLoading ) . onPress ( ( ) {
Navigator . of ( context )
. push (
CustomPageRoute (
page: AppointmentDetailsPage ( patientAppointmentHistoryResponseModel: widget . patientAppointmentHistoryResponseModel ) ,
) ,
)
. then ( ( val ) {
widget . myAppointmentsViewModel . initAppointmentsViewModel ( ) ;
widget . myAppointmentsViewModel . getPatientAppointments ( true , false ) ;
} ) ;
} ) ,
) ,
] ,
) ,
_buildActionArea ( context , appState ) ,
] ,
) ,
) ,
) ;
}
Widget getArrivedAppointmentButton ( ) {
return DateTime . now ( ) . difference ( DateUtil . convertStringToDate ( widget . patientAppointmentHistoryResponseModel . appointmentDate ) ) . inDays < = 15
? CustomButton (
text: LocaleKeys . askDoctor . tr ( context: context ) ,
onPressed: ( ) { } ,
backgroundColor: AppColors . secondaryLightRedColor ,
borderColor: AppColors . secondaryLightRedColor ,
textColor: AppColors . primaryRedColor ,
fontSize: 14 ,
fontWeight: FontWeight . w500 ,
borderRadius: 12 ,
padding: EdgeInsets . fromLTRB ( 10 , 0 , 10 , 0 ) ,
height: 40. h ,
icon: AppAssets . ask_doctor_icon ,
iconColor: AppColors . primaryRedColor ,
iconSize: 16. h ,
)
: CustomButton (
text: " Rebook with same doctor " . needTranslation ,
onPressed: ( ) {
openDoctorScheduleCalendar ( ) ;
} ,
backgroundColor: AppColors . greyColor ,
borderColor: AppColors . greyColor ,
textColor: AppColors . blackColor ,
fontSize: 14 ,
fontWeight: FontWeight . w500 ,
borderRadius: 12 ,
padding: EdgeInsets . fromLTRB ( 10 , 0 , 10 , 0 ) ,
height: 40. h ,
icon: AppAssets . rebook_appointment_icon ,
iconColor: AppColors . blackColor ,
iconSize: 16. h ,
) ;
Widget _buildHeader ( BuildContext context , AppState appState ) {
return Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: [
Expanded ( child: _buildChips ( context , appState ) ) ,
/ / Placeholder for future toggle / switch
] ,
) ;
}
openDoctorScheduleCalendar ( ) async {
DoctorsListResponseModel doctor = DoctorsListResponseModel (
clinicID: widget . patientAppointmentHistoryResponseModel . clinicID ,
projectID: widget . patientAppointmentHistoryResponseModel . projectID ,
doctorID: widget . patientAppointmentHistoryResponseModel . doctorID ,
doctorImageURL: widget . patientAppointmentHistoryResponseModel . doctorImageURL ,
doctorTitle: widget . patientAppointmentHistoryResponseModel . doctorTitle ,
name: widget . patientAppointmentHistoryResponseModel . doctorNameObj ,
nationalityFlagURL: " https://hmgwebservices.com/Images/flag/SYR.png " ,
speciality: [ ] ,
clinicName: widget . patientAppointmentHistoryResponseModel . clinicName ,
projectName: widget . patientAppointmentHistoryResponseModel . projectName ,
Widget _buildChips ( BuildContext context , AppState appState ) {
final isLiveCare = ! isLoading & & patientAppointmentHistoryResponseModel . isLiveCareAppointment ! ;
return Wrap (
alignment: WrapAlignment . start ,
direction: Axis . horizontal ,
spacing: 6. h ,
runSpacing: 6. h ,
children: [
AppCustomChipWidget (
icon: isLoading ? AppAssets . walkin_appointment_icon : ( isLiveCare ? AppAssets . small_livecare_icon : AppAssets . walkin_appointment_icon ) ,
iconColor: isLoading ? AppColors . textColor : ( isLiveCare ? AppColors . whiteColor : AppColors . textColor ) ,
labelText: isLoading ? ' Walk In ' . needTranslation : ( isLiveCare ? LocaleKeys . livecare . tr ( context: context ) : ' Walk In ' . needTranslation ) ,
backgroundColor: isLoading ? AppColors . greyColor : ( isLiveCare ? AppColors . successColor : AppColors . greyColor ) ,
textColor: isLoading ? AppColors . textColor : ( isLiveCare ? AppColors . whiteColor : AppColors . textColor ) ,
) . toShimmer2 ( isShow: isLoading ) ,
AppCustomChipWidget (
labelText: isLoading
? ' OutPatient ' . needTranslation
: ( appState . isArabic ( )
? patientAppointmentHistoryResponseModel . isInOutPatientDescriptionN !
: patientAppointmentHistoryResponseModel . isInOutPatientDescription ! ) ,
backgroundColor: AppColors . primaryRedColor . withValues ( alpha: 0.1 ) ,
textColor: AppColors . primaryRedColor ,
) . toShimmer2 ( isShow: isLoading ) ,
AppCustomChipWidget (
labelText: isLoading
? ' Booked ' . needTranslation
: AppointmentType . getAppointmentStatusType ( patientAppointmentHistoryResponseModel . patientStatusType ! ) ,
backgroundColor: AppColors . successColor . withValues ( alpha: 0.1 ) ,
textColor: AppColors . successColor ,
) . toShimmer2 ( isShow: isLoading ) ,
] ,
) . toShimmer2 ( isShow: isLoading ) ;
}
Widget _buildDoctorRow ( BuildContext context ) {
return Row (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Image . network (
isLoading
? ' https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png '
: patientAppointmentHistoryResponseModel . doctorImageURL ! ,
width: 63. h ,
height: 63. h ,
fit: BoxFit . cover ,
) . circle ( 100 ) . toShimmer2 ( isShow: isLoading ) ,
SizedBox ( width: 16. h ) ,
Expanded (
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
( isLoading
? ' https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png '
: patientAppointmentHistoryResponseModel . doctorNameObj ! )
. toText16 ( isBold: true , maxlines: 1 )
. toShimmer2 ( isShow: isLoading ) ,
SizedBox ( height: 8. h ) ,
Wrap (
direction: Axis . horizontal ,
spacing: 3. h ,
runSpacing: 4. h ,
children: [
if ( ! isFromHomePage )
AppCustomChipWidget ( labelText: isLoading ? ' Cardiology ' : patientAppointmentHistoryResponseModel . clinicName ! )
. toShimmer2 ( isShow: isLoading ) ,
if ( ! isFromHomePage )
AppCustomChipWidget ( labelText: isLoading ? ' Olaya ' : patientAppointmentHistoryResponseModel . projectName ! )
. toShimmer2 ( isShow: isLoading ) ,
AppCustomChipWidget (
icon: AppAssets . appointment_calendar_icon ,
labelText: isLoading
? ' Cardiology '
: DateUtil . formatDateToDate ( DateUtil . convertStringToDate ( patientAppointmentHistoryResponseModel . appointmentDate ) , false ) ,
) . toShimmer2 ( isShow: isLoading ) ,
if ( ! isFromMedicalReport )
AppCustomChipWidget (
icon: AppAssets . appointment_time_icon ,
labelText: isLoading
? ' Cardiology '
: DateUtil . formatDateToTimeLang (
DateUtil . convertStringToDate ( patientAppointmentHistoryResponseModel . appointmentDate ) , false ) ,
) . toShimmer2 ( isShow: isLoading ) ,
] ,
) ,
] ,
) ,
) ,
] ,
) ;
widget . bookAppointmentsViewModel . setSelectedDoctor ( doctor ) ;
LoaderBottomSheet . showLoader ( ) ;
await widget . bookAppointmentsViewModel . getDoctorFreeSlots (
isBookingForLiveCare: false ,
onSuccess: ( dynamic respData ) async {
LoaderBottomSheet . hideLoader ( ) ;
showCommonBottomSheetWithoutHeight (
title: " Pick a Date " . needTranslation ,
context ,
child: AppointmentCalendar ( ) ,
isFullScreen: false ,
isCloseButtonVisible: true ,
callBackFunc: ( ) { } ,
) ;
}
Widget _buildActionArea ( BuildContext context , AppState appState ) {
if ( isFromMedicalReport ) {
return CustomButton (
text: ' Select appointment ' . needTranslation ,
onPressed: ( ) {
medicalFileViewModel ! . setSelectedMedicalReportAppointment ( patientAppointmentHistoryResponseModel ) ;
Navigator . pop ( context , false ) ;
} ,
onError: ( err ) {
LoaderBottomSheet . hideLoader ( ) ;
showCommonBottomSheetWithoutHeight (
context ,
child: Utils . getErrorWidget ( loadingText: err ) ,
callBackFunc: ( ) { } ,
isFullScreen: false ,
isCloseButtonVisible: true ,
) ;
} ) ;
backgroundColor: AppColors . secondaryLightRedColor ,
borderColor: AppColors . secondaryLightRedColor ,
textColor: AppColors . primaryRedColor ,
fontSize: 14. f ,
fontWeight: FontWeight . w500 ,
borderRadius: 12. r ,
padding: EdgeInsets . symmetric ( horizontal: 10. w ) ,
height: isTablet | | isFoldable ? 46. h : 40. h ,
icon: AppAssets . checkmark_icon ,
iconColor: AppColors . primaryRedColor ,
iconSize: 16. h ,
) ;
}
return Row (
children: [
Expanded (
flex: 6 ,
child: ( AppointmentType . isArrived ( patientAppointmentHistoryResponseModel )
? _getArrivedButton ( context )
: CustomButton (
text: AppointmentType . getNextActionText ( patientAppointmentHistoryResponseModel . nextAction ) ,
onPressed: ( ) = > _goToDetails ( context ) ,
backgroundColor:
AppointmentType . getNextActionButtonColor ( patientAppointmentHistoryResponseModel . nextAction ) . withValues ( alpha: 0.15 ) ,
borderColor:
AppointmentType . getNextActionButtonColor ( patientAppointmentHistoryResponseModel . nextAction ) . withValues ( alpha: 0.01 ) ,
textColor: AppointmentType . getNextActionTextColor ( patientAppointmentHistoryResponseModel . nextAction ) ,
fontSize: 14. f ,
fontWeight: FontWeight . w500 ,
borderRadius: 12. r ,
padding: EdgeInsets . symmetric ( horizontal: 10. w ) ,
height: isTablet | | isFoldable ? 46. h : 40. h ,
icon: AppointmentType . getNextActionIcon ( patientAppointmentHistoryResponseModel . nextAction ) ,
iconColor: AppointmentType . getNextActionTextColor ( patientAppointmentHistoryResponseModel . nextAction ) ,
iconSize: 15. h ,
) )
. toShimmer2 ( isShow: isLoading ) ,
) ,
SizedBox ( width: 8. h ) ,
Expanded (
flex: 1 ,
child: Container (
height: ( isFoldable | | isTablet ) ? 50. h : 40. h ,
decoration: RoundedRectangleBorder ( ) . toSmoothCornerDecoration ( color: AppColors . textColor , borderRadius: 10. h ) ,
child: Transform . flip (
flipX: appState . isArabic ( ) ,
child: Utils . buildSvgWithAssets (
icon: AppAssets . forward_arrow_icon ,
iconColor: AppColors . whiteColor ,
width: 24. w ,
height: 24. h ,
fit: BoxFit . contain ,
) ,
) ,
) . toShimmer2 ( isShow: isLoading ) . onPress ( ( ) {
_goToDetails ( context ) ;
} ) ,
) ,
] ,
) ;
}
Widget _getArrivedButton ( BuildContext context ) {
final isRecent = DateTime . now ( ) . difference ( DateUtil . convertStringToDate ( patientAppointmentHistoryResponseModel . appointmentDate ) ) . inDays < = 15 ;
if ( isRecent ) {
return CustomButton (
text: LocaleKeys . askDoctor . tr ( context: context ) ,
onPressed: ( ) { } ,
backgroundColor: AppColors . secondaryLightRedColor ,
borderColor: AppColors . secondaryLightRedColor ,
textColor: AppColors . primaryRedColor ,
fontSize: 14. f ,
fontWeight: FontWeight . w500 ,
borderRadius: 12. r ,
padding: EdgeInsets . symmetric ( horizontal: 10. w ) ,
height: isTablet | | isFoldable ? 46. h : 40. h ,
icon: AppAssets . ask_doctor_icon ,
iconColor: AppColors . primaryRedColor ,
iconSize: 16. h ,
) ;
}
return CustomButton (
text: ' Rebook with same doctor ' . needTranslation ,
onPressed: ( ) = > openDoctorScheduleCalendar ( context ) ,
backgroundColor: AppColors . greyColor ,
borderColor: AppColors . greyColor ,
textColor: AppColors . blackColor ,
fontSize: 14. f ,
fontWeight: FontWeight . w500 ,
borderRadius: 12. r ,
padding: EdgeInsets . symmetric ( horizontal: 10. w ) ,
height: isTablet | | isFoldable ? 46. h : 40. h ,
icon: AppAssets . rebook_appointment_icon ,
iconColor: AppColors . blackColor ,
iconSize: 16. h ,
) ;
}
void _goToDetails ( BuildContext context ) {
Navigator . of ( context )
. push (
CustomPageRoute (
page: AppointmentDetailsPage ( patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel ) ,
) ,
)
. then ( ( _ ) {
myAppointmentsViewModel . initAppointmentsViewModel ( ) ;
myAppointmentsViewModel . getPatientAppointments ( true , false ) ;
} ) ;
}
void performAppointmentNextAction ( nextAction ) { }
void openDoctorScheduleCalendar ( BuildContext context ) async {
final doctor = DoctorsListResponseModel (
clinicID: patientAppointmentHistoryResponseModel . clinicID ,
projectID: patientAppointmentHistoryResponseModel . projectID ,
doctorID: patientAppointmentHistoryResponseModel . doctorID ,
doctorImageURL: patientAppointmentHistoryResponseModel . doctorImageURL ,
doctorTitle: patientAppointmentHistoryResponseModel . doctorTitle ,
name: patientAppointmentHistoryResponseModel . doctorNameObj ,
nationalityFlagURL: ' https://hmgwebservices.com/Images/flag/SYR.png ' ,
speciality: [ ] ,
clinicName: patientAppointmentHistoryResponseModel . clinicName ,
projectName: patientAppointmentHistoryResponseModel . projectName ,
) ;
bookAppointmentsViewModel . setSelectedDoctor ( doctor ) ;
LoaderBottomSheet . showLoader ( ) ;
await bookAppointmentsViewModel . getDoctorFreeSlots (
isBookingForLiveCare: false ,
onSuccess: ( respData ) async {
LoaderBottomSheet . hideLoader ( ) ;
showCommonBottomSheetWithoutHeight (
context ,
child: AppointmentCalendar ( ) ,
callBackFunc: ( ) { } ,
title: ' Pick a Date ' . needTranslation ,
isFullScreen: false ,
isCloseButtonVisible: true ,
) ;
} ,
onError: ( err ) {
LoaderBottomSheet . hideLoader ( ) ;
showCommonBottomSheetWithoutHeight (
context ,
child: Utils . getErrorWidget ( loadingText: err ) ,
callBackFunc: ( ) { } ,
isFullScreen: false ,
isCloseButtonVisible: true ,
) ;
} ,
) ;
}
}