Added sharedpref on no thanks option in symptom checker bottom sheet

pull/318/head
Haroon Amjad 1 month ago
parent c29632ffc0
commit b49e1a222b

@ -76,6 +76,7 @@ class CacheConst {
static const String hasEnabledQuickLogin = 'has-enabled-quick-login'; static const String hasEnabledQuickLogin = 'has-enabled-quick-login';
static const String quickLoginEnabled = 'quick-login-enabled'; static const String quickLoginEnabled = 'quick-login-enabled';
static const String isMonthlyReportEnabled = 'is-monthly-report-enabled'; static const String isMonthlyReportEnabled = 'is-monthly-report-enabled';
static const String isShowSymptomCheckerBottomSheet = 'is-show-symptom-checker-bottom-sheet';
static const String zoomRoomID = 'zoom-room-id'; static const String zoomRoomID = 'zoom-room-id';
static const String callTypeID = 'call-type-id'; static const String callTypeID = 'call-type-id';

@ -6,6 +6,7 @@ import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/app_export.dart';
import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/cache_consts.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/location_util.dart'; import 'package:hmg_patient_app_new/core/location_util.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart';
@ -132,12 +133,12 @@ class _BookAppointmentPageState extends State<BookAppointmentPage> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Image.network( Image.network(
"https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png",
width: 64.h, width: 64.h,
height: 64.h, height: 64.h,
fit: BoxFit.cover, fit: BoxFit.cover,
).circle(100).toShimmer2(isShow: true, radius: 50.r), ).circle(100).toShimmer2(isShow: true, radius: 50.r),
SizedBox(height: 8.h), SizedBox(height: 8.h),
("Dr. John").toString().toText12(isBold: true, isCenter: true, maxLine: 2).toShimmer2(isShow: true), ("Dr. John").toString().toText12(isBold: true, isCenter: true, maxLine: 2).toShimmer2(isShow: true),
], ],
); );
@ -337,96 +338,99 @@ class _BookAppointmentPageState extends State<BookAppointmentPage> {
], ],
) )
: Column( : Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox(height: 24.h), SizedBox(height: 24.h),
LocaleKeys.favourites.tr(context: context).toText18(isBold: true).paddingSymmetrical(24.w, 0.h), LocaleKeys.favourites.tr(context: context).toText18(isBold: true).paddingSymmetrical(24.w, 0.h),
SizedBox(height: 16.h), SizedBox(height: 16.h),
SizedBox( SizedBox(
height: 110.h, height: 110.h,
child: ListView.separated( child: ListView.separated(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemCount: myAppointmentsVM.patientFavouriteDoctorsList.length + 1, itemCount: myAppointmentsVM.patientFavouriteDoctorsList.length + 1,
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.only(left: 24.w, right: 24.w), padding: EdgeInsets.only(left: 24.w, right: 24.w),
itemBuilder: (context, index) { itemBuilder: (context, index) {
// Last item: static "Add" button // Last item: static "Add" button
if (index == myAppointmentsVM.patientFavouriteDoctorsList.length) { if (index == myAppointmentsVM.patientFavouriteDoctorsList.length) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Utils.buildSvgWithAssets(icon: AppAssets.add_new_family_icon, height: 64.h, width: 64.h, applyThemeColor: false), Utils.buildSvgWithAssets(icon: AppAssets.add_new_family_icon, height: 64.h, width: 64.h, applyThemeColor: false),
SizedBox( SizedBox(
width: 80.w, width: 80.w,
child: LocaleKeys.add.tr(context: context).toText12( child: LocaleKeys.add
.tr(context: context)
.toText12(
color: AppColors.textColor, color: AppColors.textColor,
isBold: true, isBold: true,
isCenter: true, isCenter: true,
).paddingOnly(top: 4.h), )
), .paddingOnly(top: 4.h),
], ),
).onPress(() { ],
Navigator.of(context).push(CustomPageRoute(page: SearchDoctorByName())); ).onPress(() {
}); Navigator.of(context).push(CustomPageRoute(page: SearchDoctorByName()));
} });
return AnimationConfiguration.staggeredList( }
position: index, return AnimationConfiguration.staggeredList(
duration: const Duration(milliseconds: 1000), position: index,
child: SlideAnimation( duration: const Duration(milliseconds: 1000),
horizontalOffset: 100.0, child: SlideAnimation(
child: FadeInAnimation( horizontalOffset: 100.0,
child: SizedBox( child: FadeInAnimation(
child: Column( child: SizedBox(
crossAxisAlignment: CrossAxisAlignment.center, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.center,
Image.network( children: [
myAppointmentsVM.patientFavouriteDoctorsList[index].doctorImageUrl!, Image.network(
width: 64.h, myAppointmentsVM.patientFavouriteDoctorsList[index].doctorImageUrl!,
height: 64.h, width: 64.h,
fit: BoxFit.cover, height: 64.h,
).circle(100).toShimmer2(isShow: false, radius: 50.r), fit: BoxFit.cover,
SizedBox(height: 8.h), ).circle(100).toShimmer2(isShow: false, radius: 50.r),
SizedBox( SizedBox(height: 8.h),
width: 80.w, SizedBox(
child: (myAppointmentsVM.patientFavouriteDoctorsList[index].doctorName) width: 80.w,
.toString() child: (myAppointmentsVM.patientFavouriteDoctorsList[index].doctorName)
.toText12(isBold: true, isCenter: true, maxLine: 2) .toString()
.toShimmer2(isShow: false), .toText12(isBold: true, isCenter: true, maxLine: 2)
), .toShimmer2(isShow: false),
],
), ),
).onPress(() async { ],
bookAppointmentsViewModel.setSelectedDoctor(DoctorsListResponseModel(
clinicID: myAppointmentsVM.patientFavouriteDoctorsList[index].clinicId,
projectID: myAppointmentsVM.patientFavouriteDoctorsList[index].projectId,
doctorID: myAppointmentsVM.patientFavouriteDoctorsList[index].doctorId,
));
LoaderBottomSheet.showLoader();
await bookAppointmentsViewModel.getDoctorProfile(onSuccess: (dynamic respData) {
LoaderBottomSheet.hideLoader();
Navigator.of(context).push(
CustomPageRoute(
page: DoctorProfilePage(isDoctorAllowedToBook: true),
),
);
}, onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: err),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
});
}),
), ),
), ).onPress(() async {
); bookAppointmentsViewModel.setSelectedDoctor(DoctorsListResponseModel(
}, clinicID: myAppointmentsVM.patientFavouriteDoctorsList[index].clinicId,
separatorBuilder: (BuildContext cxt, int index) => SizedBox(width: 8.h), projectID: myAppointmentsVM.patientFavouriteDoctorsList[index].projectId,
), doctorID: myAppointmentsVM.patientFavouriteDoctorsList[index].doctorId,
), ));
LoaderBottomSheet.showLoader();
await bookAppointmentsViewModel.getDoctorProfile(onSuccess: (dynamic respData) {
LoaderBottomSheet.hideLoader();
Navigator.of(context).push(
CustomPageRoute(
page: DoctorProfilePage(isDoctorAllowedToBook: true),
),
);
}, onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: err),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
});
}),
),
),
);
},
separatorBuilder: (BuildContext cxt, int index) => SizedBox(width: 8.h),
),
),
], ],
); );
}), }),
@ -552,96 +556,98 @@ class _BookAppointmentPageState extends State<BookAppointmentPage> {
], ],
).paddingSymmetrical(24.h, 0.h); ).paddingSymmetrical(24.h, 0.h);
case 1: case 1:
//TODO: Get LiveCare type Select UI from Hussain //TODO: Get LiveCare type Select UI from Hussain
return appState.isAuthenticated return appState.isAuthenticated
? Column( ? Column(
children: [ children: [
Container( Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor, color: AppColors.whiteColor,
borderRadius: 24.h, borderRadius: 24.h,
hasShadow: false, hasShadow: false,
), ),
child: Padding( child: Padding(
padding: EdgeInsets.all(16.h), padding: EdgeInsets.all(16.h),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Row( Row(
children: [ children: [
Utils.buildSvgWithAssets(icon: AppAssets.search_by_clinic_icon, width: 40.h, height: 40.h, applyThemeColor: false), Utils.buildSvgWithAssets(icon: AppAssets.search_by_clinic_icon, width: 40.h, height: 40.h, applyThemeColor: false),
SizedBox(width: 12.h), SizedBox(width: 12.h),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.immediateConsultation.tr(context: context).toText14(color: AppColors.textColor, isBold: true), LocaleKeys.immediateConsultation.tr(context: context).toText14(color: AppColors.textColor, isBold: true),
LocaleKeys.tapToSelectClinic.tr(context: context).toText12(color: AppColors.primaryRedColor, isBold: true), LocaleKeys.tapToSelectClinic.tr(context: context).toText12(color: AppColors.primaryRedColor, isBold: true),
], ],
), ),
], ],
), ),
Transform.flip(flipX: appState.isArabic(), child: Utils.buildSvgWithAssets(icon: AppAssets.forward_arrow_icon, iconColor: AppColors.textColor, width: 40.h, height: 40.h)), Transform.flip(
], flipX: appState.isArabic(), child: Utils.buildSvgWithAssets(icon: AppAssets.forward_arrow_icon, iconColor: AppColors.textColor, width: 40.h, height: 40.h)),
).onPress(() async { ],
//TODO Implement API to check for existing LiveCare Requests ).onPress(() async {
//TODO Implement API to check for existing LiveCare Requests
LoaderBottomSheet.showLoader(); LoaderBottomSheet.showLoader();
await immediateLiveCareViewModel.getPatientLiveCareHistory(); await immediateLiveCareViewModel.getPatientLiveCareHistory();
LoaderBottomSheet.hideLoader(); LoaderBottomSheet.hideLoader();
if (immediateLiveCareViewModel.patientHasPendingLiveCareRequest) { if (immediateLiveCareViewModel.patientHasPendingLiveCareRequest) {
Navigator.of(context).push( Navigator.of(context).push(
CustomPageRoute( CustomPageRoute(
page: ImmediateLiveCarePendingRequestPage(), page: ImmediateLiveCarePendingRequestPage(),
), ),
); );
} else { } else {
Navigator.of(context).push( Navigator.of(context).push(
CustomPageRoute( CustomPageRoute(
page: SelectImmediateLiveCareClinicPage(), page: SelectImmediateLiveCareClinicPage(),
), ),
); );
} }
}), }),
SizedBox(height: 16.h), SizedBox(height: 16.h),
Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.1), height: 1.h), Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.1), height: 1.h),
SizedBox(height: 16.h), SizedBox(height: 16.h),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Row( Row(
children: [ children: [
Utils.buildSvgWithAssets(icon: AppAssets.search_by_doctor_icon, width: 40.h, height: 40.h, applyThemeColor: false), Utils.buildSvgWithAssets(icon: AppAssets.search_by_doctor_icon, width: 40.h, height: 40.h, applyThemeColor: false),
SizedBox(width: 12.h), SizedBox(width: 12.h),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.scheduledConsultation.tr(context: context).toText14(color: AppColors.textColor, isBold: true), LocaleKeys.scheduledConsultation.tr(context: context).toText14(color: AppColors.textColor, isBold: true),
LocaleKeys.tapToSelectClinic.tr(context: context).toText12(color: AppColors.primaryRedColor, isBold: true), LocaleKeys.tapToSelectClinic.tr(context: context).toText12(color: AppColors.primaryRedColor, isBold: true),
], ],
), ),
], ],
), ),
Transform.flip(flipX: appState.isArabic(), child: Utils.buildSvgWithAssets(icon: AppAssets.forward_arrow_icon, iconColor: AppColors.textColor, width: 40.h, height: 40.h)), Transform.flip(
], flipX: appState.isArabic(), child: Utils.buildSvgWithAssets(icon: AppAssets.forward_arrow_icon, iconColor: AppColors.textColor, width: 40.h, height: 40.h)),
).onPress(() { ],
bookAppointmentsViewModel.setIsClinicsListLoading(true); ).onPress(() {
bookAppointmentsViewModel.setIsLiveCareSchedule(true); bookAppointmentsViewModel.setIsClinicsListLoading(true);
Navigator.of(context).push( bookAppointmentsViewModel.setIsLiveCareSchedule(true);
CustomPageRoute( Navigator.of(context).push(
page: SelectClinicPage(), CustomPageRoute(
), page: SelectClinicPage(),
); ),
}), );
], }),
), ],
), ),
), ),
], ),
).paddingSymmetrical(24.h, 0.h) ],
).paddingSymmetrical(24.h, 0.h)
: getLiveCareNotLoggedInUI(); : getLiveCareNotLoggedInUI();
default: default:
SizedBox.shrink(); SizedBox.shrink();
@ -657,28 +663,28 @@ class _BookAppointmentPageState extends State<BookAppointmentPage> {
children: [ children: [
Expanded( Expanded(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.notSureHelpMeChooseClinic.tr(context: context).toText16(isBold: true, color: AppColors.textColor), LocaleKeys.notSureHelpMeChooseClinic.tr(context: context).toText16(isBold: true, color: AppColors.textColor),
SizedBox(height: 8.h), SizedBox(height: 8.h),
LocaleKeys.checkYourSymptomsWithScale.tr(context: context).toText12( LocaleKeys.checkYourSymptomsWithScale.tr(context: context).toText12(
isBold: true, isBold: true,
color: AppColors.greyTextColor, color: AppColors.greyTextColor,
),
],
),
), ),
SizedBox(width: 16.w),
CustomButton(
height: 42.h,
width: 42.w,
text: "",
onPressed: () => context.navigateWithName(AppRoutes.userInfoSelection),
icon: getIt.get<AppState>().isArabic() ? AppAssets.arrow_back : AppAssets.arrow_forward,
)
], ],
), ).paddingAll(24.w),
),
SizedBox(width: 16.w),
CustomButton(
height: 42.h,
width: 42.w,
text: "",
onPressed: () => context.navigateWithName(AppRoutes.userInfoSelection),
icon: getIt.get<AppState>().isArabic() ? AppAssets.arrow_back : AppAssets.arrow_forward,
)
],
).paddingAll(24.w),
) )
: SizedBox.shrink(); : SizedBox.shrink();
} }
@ -687,13 +693,10 @@ class _BookAppointmentPageState extends State<BookAppointmentPage> {
regionalViewModel.flush(); regionalViewModel.flush();
regionalViewModel.setBottomSheetType(type); regionalViewModel.setBottomSheetType(type);
// AppointmentViaRegionViewmodel? viewmodel = null; // AppointmentViaRegionViewmodel? viewmodel = null;
showCommonBottomSheetWithoutHeight(context, title: "", showCommonBottomSheetWithoutHeight(context, title: "", titleWidget: Consumer<AppointmentViaRegionViewmodel>(builder: (_, data, __) => getTitle(data)), isDismissible: false,
titleWidget: Consumer<AppointmentViaRegionViewmodel>(builder: (_, data, __) => getTitle(data)),
isDismissible: false,
child: Consumer<AppointmentViaRegionViewmodel>(builder: (_, data, __) { child: Consumer<AppointmentViaRegionViewmodel>(builder: (_, data, __) {
return getRegionalSelectionWidget(data); return getRegionalSelectionWidget(data);
}), }), callBackFunc: () {});
callBackFunc: () {});
} }
Widget getRegionalSelectionWidget(AppointmentViaRegionViewmodel data) { Widget getRegionalSelectionWidget(AppointmentViaRegionViewmodel data) {
@ -749,7 +752,7 @@ class _BookAppointmentPageState extends State<BookAppointmentPage> {
return SizedBox.shrink(); return SizedBox.shrink();
} }
void _handleSortByLocationToggle(bool value, AppointmentViaRegionViewmodel regionVM) { void _handleSortByLocationToggle(bool value, AppointmentViaRegionViewmodel regionVM) {
if (value) { if (value) {
final locationUtils = getIt.get<LocationUtils>(); final locationUtils = getIt.get<LocationUtils>();
locationUtils.getLocation( locationUtils.getLocation(
@ -817,6 +820,7 @@ class _BookAppointmentPageState extends State<BookAppointmentPage> {
} }
} }
} }
bookAppointmentsViewModel.addListener(listener); bookAppointmentsViewModel.addListener(listener);
bookAppointmentsViewModel.getRegionMappedProjectList(); bookAppointmentsViewModel.getRegionMappedProjectList();
} }
@ -927,52 +931,58 @@ class _BookAppointmentPageState extends State<BookAppointmentPage> {
).paddingSymmetrical(24.h, 0.h); ).paddingSymmetrical(24.h, 0.h);
} }
void showUnKnownClinicBottomSheet() { void showUnKnownClinicBottomSheet() async {
showCommonBottomSheetWithoutHeight( if (await Utils.getBoolFromPrefs(CacheConst.isShowSymptomCheckerBottomSheet)) {
context, showCommonBottomSheetWithoutHeight(
title: "", context,
isDismissible: true, title: "",
isDismissible: true,
isCloseButtonVisible: false, isCloseButtonVisible: false,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.notSureHelpMeChooseClinic.tr(context: context).toText28(color: AppColors.textColor, isBold: true, height: 1.5), LocaleKeys.notSureHelpMeChooseClinic.tr(context: context).toText28(color: AppColors.textColor, isBold: true, height: 1.5),
SizedBox(height: 4.h), SizedBox(height: 4.h),
LocaleKeys.mentionYourSymptomsAndFindDoctors.tr(context: context).toText12(color: AppColors.greyTextColor, isBold: true,), LocaleKeys.mentionYourSymptomsAndFindDoctors.tr(context: context).toText12(
SizedBox(height: 24.h), color: AppColors.greyTextColor,
CustomButton( isBold: true,
text: LocaleKeys.yesPleaseINeedHelp.tr(context: context), ),
onPressed: () { SizedBox(height: 24.h),
context.pop(); CustomButton(
context.navigateWithName(AppRoutes.userInfoSelection); text: LocaleKeys.yesPleaseINeedHelp.tr(context: context),
}, onPressed: () {
backgroundColor: AppColors.primaryRedColor, context.pop();
borderColor: AppColors.primaryRedColor, context.navigateWithName(AppRoutes.userInfoSelection);
textColor: AppColors.whiteColor, },
fontSize: 16.f, backgroundColor: AppColors.primaryRedColor,
isBold: true, borderColor: AppColors.primaryRedColor,
borderRadius: 12.r, textColor: AppColors.whiteColor,
// padding: EdgeInsets.fromLTRB(10, 0, 10, 0), fontSize: 16.f,
height: 56.h, isBold: true,
), borderRadius: 12.r,
SizedBox(height: 8.h), // padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
CustomButton( height: 56.h,
text: LocaleKeys.noThanksIKnowTheClinic.tr(context: context), ),
onPressed: () { SizedBox(height: 8.h),
context.pop(); CustomButton(
}, text: LocaleKeys.noThanksIKnowTheClinic.tr(context: context),
backgroundColor: AppColors.chipSecondaryLightRedColor, onPressed: () {
borderColor: AppColors.chipSecondaryLightRedColor, Utils.saveBoolFromPrefs(CacheConst.isShowSymptomCheckerBottomSheet, false);
textColor: AppColors.primaryRedColor, context.pop();
fontSize: 16.f, },
isBold: true, backgroundColor: AppColors.chipSecondaryLightRedColor,
borderRadius: 12.r, borderColor: AppColors.chipSecondaryLightRedColor,
// padding: EdgeInsets.fromLTRB(10, 0, 10, 0), textColor: AppColors.primaryRedColor,
height: 56.h, fontSize: 16.f,
), isBold: true,
], borderRadius: 12.r,
).paddingSymmetrical(24.w, 20.h), // padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
callBackFunc: () {}, height: 56.h,
); ),
],
).paddingSymmetrical(24.w, 20.h),
callBackFunc: () {},
);
}
} }
} }

Loading…
Cancel
Save