Merge pull request 'haroon_dev' (#130) from haroon_dev into master

Reviewed-on: https://34.17.182.140/Haroon6138/HMG_Patient_App_New/pulls/130
pull/134/head
Haroon6138 3 weeks ago
commit 37574412a5

@ -66,6 +66,7 @@ class BloodDonationRepoImp implements BloodDonationRepo {
await apiClient.post( await apiClient.post(
GET_BLOOD_REQUEST, GET_BLOOD_REQUEST,
body: mapDevice, body: mapDevice,
isAllowAny: true,
onFailure: (error, statusCode, {messageStatus, failureType}) { onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType; failure = failureType;
}, },

@ -52,6 +52,8 @@ class BookAppointmentsViewModel extends ChangeNotifier {
int initialSlotDuration = 0; int initialSlotDuration = 0;
bool isNearestAppointmentSelected = false;
LocationUtils locationUtils; LocationUtils locationUtils;
List<GetClinicsListResponseModel> clinicsList = []; List<GetClinicsListResponseModel> clinicsList = [];
@ -201,6 +203,18 @@ class BookAppointmentsViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
setIsNearestAppointmentSelected(bool isNearestAppointmentSelected) {
this.isNearestAppointmentSelected = isNearestAppointmentSelected;
if (isNearestAppointmentSelected) {
doctorsList.sort((a, b) => DateUtil.convertStringToDate(a.nearestFreeSlot!).compareTo(DateUtil.convertStringToDate(b.nearestFreeSlot!)));
} else {
doctorsList.sort((a, b) => b.decimalDoctorRate!.compareTo(a.decimalDoctorRate!));
}
notifyListeners();
}
setIsWaitingAppointmentSelected(bool isWaitingAppointmentSelected) { setIsWaitingAppointmentSelected(bool isWaitingAppointmentSelected) {
this.isWaitingAppointmentSelected = isWaitingAppointmentSelected; this.isWaitingAppointmentSelected = isWaitingAppointmentSelected;
notifyListeners(); notifyListeners();
@ -401,6 +415,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
doctorsList = apiResponse.data!; doctorsList = apiResponse.data!;
filteredDoctorList = doctorsList; filteredDoctorList = doctorsList;
isDoctorsListLoading = false; isDoctorsListLoading = false;
doctorsList.sort((a, b) => b.decimalDoctorRate!.compareTo(a.decimalDoctorRate!));
initializeFilteredList(); initializeFilteredList();
clearSearchFilters(); clearSearchFilters();
getFiltersFromDoctorList(); getFiltersFromDoctorList();

@ -37,7 +37,9 @@ class LocationViewModel extends ChangeNotifier {
} }
GMSMapServices.CameraPosition getGMSLocation() { GMSMapServices.CameraPosition getGMSLocation() {
return GMSMapServices.CameraPosition(target: GMSMapServices.LatLng(getIt<AppState>().userLat, getIt<AppState>().userLong), zoom: 18); return GMSMapServices.CameraPosition(
target: GMSMapServices.LatLng(getIt<AppState>().userLat != 0.0 ? getIt<AppState>().userLat : 24.7248316, getIt<AppState>().userLong != 0.0 ? getIt<AppState>().userLong : 46.4928828),
zoom: 18);
} }
void placeValueInController() async { void placeValueInController() async {

@ -110,7 +110,7 @@ class PayfortViewModel extends ChangeNotifier {
onError!(failure.message); onError!(failure.message);
}, },
(apiResponse) { (apiResponse) {
log(apiResponse.data); log(apiResponse.data.toString());
if (onSuccess != null) { if (onSuccess != null) {
onSuccess(apiResponse); onSuccess(apiResponse);
} }
@ -134,7 +134,7 @@ class PayfortViewModel extends ChangeNotifier {
onError!(failure.message); onError!(failure.message);
}, },
(apiResponse) { (apiResponse) {
log(apiResponse.data); log(apiResponse.data.toString());
if (onSuccess != null) { if (onSuccess != null) {
onSuccess(apiResponse); onSuccess(apiResponse);
} }

@ -58,7 +58,7 @@ class AppointmentCheckinBottomSheet extends StatelessWidget {
double dist = Utils.distance(value.latitude, value.longitude, double.parse(projectDetailListModel.latitude!), double.parse(projectDetailListModel.longitude!)).ceilToDouble() * 1000; double dist = Utils.distance(value.latitude, value.longitude, double.parse(projectDetailListModel.latitude!), double.parse(projectDetailListModel.longitude!)).ceilToDouble() * 1000;
print(dist); print(dist);
if (dist <= projectDetailListModel.geofenceRadius!) { if (dist <= projectDetailListModel.geofenceRadius!) {
sendCheckInRequest(projectDetailListModel.checkInQrCode!, context); sendCheckInRequest(projectDetailListModel.checkInQrCode!, 3, context);
} else { } else {
showCommonBottomSheetWithoutHeight(context, showCommonBottomSheetWithoutHeight(context,
title: "Error".needTranslation, title: "Error".needTranslation,
@ -77,7 +77,7 @@ class AppointmentCheckinBottomSheet extends StatelessWidget {
Future.delayed(const Duration(milliseconds: 500), () { Future.delayed(const Duration(milliseconds: 500), () {
showNfcReader(context, onNcfScan: (String nfcId) { showNfcReader(context, onNcfScan: (String nfcId) {
Future.delayed(const Duration(milliseconds: 100), () { Future.delayed(const Duration(milliseconds: 100), () {
sendCheckInRequest(nfcId, context); sendCheckInRequest(nfcId, 1, context);
}); });
}, onCancel: () {}); }, onCancel: () {});
}); });
@ -90,7 +90,7 @@ class AppointmentCheckinBottomSheet extends StatelessWidget {
).onPress(() async { ).onPress(() async {
String onlineCheckInQRCode = (await BarcodeScanner.scan().then((value) => value.rawContent)); String onlineCheckInQRCode = (await BarcodeScanner.scan().then((value) => value.rawContent));
if (onlineCheckInQRCode != "") { if (onlineCheckInQRCode != "") {
sendCheckInRequest(onlineCheckInQRCode, context); sendCheckInRequest(onlineCheckInQRCode, 2, context);
} else {} } else {}
}), }),
], ],
@ -138,12 +138,12 @@ class AppointmentCheckinBottomSheet extends StatelessWidget {
); );
} }
void sendCheckInRequest(String scannedCode, BuildContext context) async { void sendCheckInRequest(String scannedCode, int checkInType, BuildContext context) async {
LoaderBottomSheet.showLoader(loadingText: "Processing Check-In...".needTranslation); LoaderBottomSheet.showLoader(loadingText: "Processing Check-In...".needTranslation);
await myAppointmentsViewModel.sendCheckInNfcRequest( await myAppointmentsViewModel.sendCheckInNfcRequest(
patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel, patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel,
scannedCode: scannedCode, scannedCode: scannedCode,
checkInType: 2, checkInType: checkInType,
onSuccess: (apiResponse) { onSuccess: (apiResponse) {
LoaderBottomSheet.hideLoader(); LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(context, title: "Success".needTranslation, child: Utils.getSuccessWidget(loadingText: LocaleKeys.success.tr()), callBackFunc: () async { showCommonBottomSheetWithoutHeight(context, title: "Success".needTranslation, child: Utils.getSuccessWidget(loadingText: LocaleKeys.success.tr()), callBackFunc: () async {

@ -1,4 +1,6 @@
import 'dart:io';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart';
@ -321,15 +323,29 @@ class ImmediateLiveCarePaymentDetails extends StatelessWidget {
} }
Future<bool> askVideoCallPermission() async { Future<bool> askVideoCallPermission() async {
Map<Permission, PermissionStatus> statuses = await [Permission.camera, Permission.microphone, Permission.notification].request(); bool hasPermission = false;
if (Platform.isIOS) {
Map<Permission, PermissionStatus> statuses = await [Permission.camera, Permission.microphone].request();
if (statuses[Permission.camera] == PermissionStatus.granted && statuses[Permission.microphone] == PermissionStatus.granted && statuses[Permission.notification] == PermissionStatus.granted) { if (statuses[Permission.camera] == PermissionStatus.granted && statuses[Permission.microphone] == PermissionStatus.granted) {
// Camera permission granted // Camera permission granted
return true; hasPermission = true;
} else {
hasPermission = false;
}
} else { } else {
return false; Map<Permission, PermissionStatus> statuses = await [Permission.camera, Permission.microphone, Permission.notification].request();
if (statuses[Permission.camera] == PermissionStatus.granted && statuses[Permission.microphone] == PermissionStatus.granted && statuses[Permission.notification] == PermissionStatus.granted) {
// Camera permission granted
hasPermission = true;
} else {
hasPermission = false;
}
} }
return hasPermission;
// if (!(await Permission.camera.request().isGranted) || !(await Permission.microphone.request().isGranted)) { // if (!(await Permission.camera.request().isGranted) || !(await Permission.microphone.request().isGranted)) {
// return false; // return false;
// } // }

@ -43,6 +43,7 @@ class _SelectDoctorPageState extends State<SelectDoctorPage> {
@override @override
void initState() { void initState() {
scheduleMicrotask(() { scheduleMicrotask(() {
bookAppointmentsViewModel.setIsNearestAppointmentSelected(false);
if (bookAppointmentsViewModel.isLiveCareSchedule) { if (bookAppointmentsViewModel.isLiveCareSchedule) {
bookAppointmentsViewModel.getLiveCareDoctorsList(); bookAppointmentsViewModel.getLiveCareDoctorsList();
} else { } else {
@ -143,8 +144,32 @@ class _SelectDoctorPageState extends State<SelectDoctorPage> {
), ),
], ],
).paddingSymmetrical(0.h, 0.h), ).paddingSymmetrical(0.h, 0.h),
SizedBox(height: 16.h),
Row(
mainAxisSize: MainAxisSize.max,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.nearestAppo.tr(context: context).toText13(isBold: true),
SizedBox(height: 4.h),
"View nearest available appointments".needTranslation.toText11(color: AppColors.textColorLight, weight: FontWeight.w500),
],
),
const Spacer(),
Switch(
activeThumbColor: AppColors.successColor,
activeTrackColor: AppColors.successColor.withValues(alpha: .15),
value: bookAppointmentsVM.isNearestAppointmentSelected,
onChanged: (newValue) async {
bookAppointmentsVM.setIsNearestAppointmentSelected(newValue);
},
),
],
),
ListView.separated( ListView.separated(
padding: EdgeInsets.only(top: 24.h), padding: EdgeInsets.only(top: 16.h),
shrinkWrap: true, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemCount: bookAppointmentsVM.isDoctorsListLoading itemCount: bookAppointmentsVM.isDoctorsListLoading

@ -115,12 +115,14 @@ class DoctorCard extends StatelessWidget {
iconColor: AppColors.ratingColorYellow, iconColor: AppColors.ratingColorYellow,
labelText: "Rating: ${isLoading ? 4.78 : doctorsListResponseModel.decimalDoctorRate}".needTranslation, labelText: "Rating: ${isLoading ? 4.78 : doctorsListResponseModel.decimalDoctorRate}".needTranslation,
).toShimmer2(isShow: isLoading) : SizedBox(), ).toShimmer2(isShow: isLoading) : SizedBox(),
doctorsListResponseModel.nearestFreeSlot != null bookAppointmentsViewModel.isNearestAppointmentSelected
? doctorsListResponseModel.nearestFreeSlot != null
? AppCustomChipWidget( ? AppCustomChipWidget(
labelText: (isLoading ? "Cardiologist" : DateUtil.getDateStringForNearestSlot(doctorsListResponseModel.nearestFreeSlot)).needTranslation, labelText: (isLoading ? "Cardiologist" : DateUtil.getDateStringForNearestSlot(doctorsListResponseModel.nearestFreeSlot)).needTranslation,
backgroundColor: AppColors.successColor, backgroundColor: AppColors.successColor,
textColor: AppColors.whiteColor, textColor: AppColors.whiteColor,
).toShimmer2(isShow: isLoading) ).toShimmer2(isShow: isLoading)
: SizedBox.shrink()
: SizedBox.shrink(), : SizedBox.shrink(),
], ],
), ),

@ -86,14 +86,16 @@ class ServicesPage extends StatelessWidget {
route: null, onTap: () async { route: null, onTap: () async {
LoaderBottomSheet.showLoader(loadingText: "Fetching Data..."); LoaderBottomSheet.showLoader(loadingText: "Fetching Data...");
await bloodDonationViewModel.getRegionSelectedClinics(onSuccess: (val) async { await bloodDonationViewModel.getRegionSelectedClinics(onSuccess: (val) async {
await bloodDonationViewModel.getPatientBloodGroupDetails(onSuccess: (val) { // await bloodDonationViewModel.getPatientBloodGroupDetails(onSuccess: (val) {
LoaderBottomSheet.hideLoader(); LoaderBottomSheet.hideLoader();
Navigator.of(GetIt.instance<NavigationService>().navigatorKey.currentContext!).push( Navigator.of(GetIt.instance<NavigationService>().navigatorKey.currentContext!).push(
CustomPageRoute( CustomPageRoute(
page: BloodDonationPage(), page: BloodDonationPage(),
), ),
); );
}); // }, onError: (err) {
// LoaderBottomSheet.hideLoader();
// });
}, onError: (err) { }, onError: (err) {
LoaderBottomSheet.hideLoader(); LoaderBottomSheet.hideLoader();
}); });

@ -409,15 +409,15 @@ class _LandingPageState extends State<LandingPage> {
SizedBox(height: 10.h), SizedBox(height: 10.h),
"Hala ${appState.getAuthenticatedUser()!.firstName}!!!".needTranslation.toText16(isBold: true), "Hala ${appState.getAuthenticatedUser()!.firstName}!!!".needTranslation.toText16(isBold: true),
SizedBox(height: 8.h), SizedBox(height: 8.h),
"Your turn is after ${immediateLiveCareVM.patientLiveCareHistoryList[0].patCount} patients.".toText14(isBold: true), "Your turn is after ${immediateLiveCareVM.patientLiveCareHistoryList[0].patCount} patients.".needTranslation.toText14(isBold: true),
SizedBox(height: 8.h), SizedBox(height: 8.h),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
"Expected waiting time: ".toText12(isBold: true), "Expected waiting time: ".needTranslation.toText12(isBold: true),
SizedBox(height: 8.h), SizedBox(height: 7.h),
ValueListenableBuilder<Duration>( ValueListenableBuilder<Duration>(
valueListenable: immediateLiveCareVM.durationNotifier, valueListenable: immediateLiveCareVM.durationNotifier,
builder: (context, duration, child) { builder: (context, duration, child) {
return Column( return Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -427,9 +427,8 @@ class _LandingPageState extends State<LandingPage> {
); );
}, },
), ),
SizedBox(height: 12.h), ],
], ),
),
// CustomButton( // CustomButton(
// text: "View Details".needTranslation, // text: "View Details".needTranslation,
// onPressed: () async { // onPressed: () async {

@ -108,7 +108,7 @@ class _PatientSickleavesListPageState extends State<PatientSickleavesListPage> {
? PatientSickLeaveCard( ? PatientSickLeaveCard(
patientSickLeavesResponseModel: PatientSickLeavesResponseModel(), patientSickLeavesResponseModel: PatientSickLeavesResponseModel(),
isLoading: true, isLoading: true,
).paddingSymmetrical(24.h, 0.0) ).paddingSymmetrical(0.h, 12.h)
: model.patientSickLeaveList.isNotEmpty : model.patientSickLeaveList.isNotEmpty
? AnimationConfiguration.staggeredList( ? AnimationConfiguration.staggeredList(
position: index, position: index,

@ -207,8 +207,8 @@ class ScrollAnimatedTitle extends StatefulWidget implements PreferredSizeWidget
} }
class _ScrollAnimatedTitleState extends State<ScrollAnimatedTitle> { class _ScrollAnimatedTitleState extends State<ScrollAnimatedTitle> {
static const double _maxFont = 24; static const double _maxFont = 26;
static const double _minFont = 14; static const double _minFont = 18;
static const double _maxHeight = 80; static const double _maxHeight = 80;
static const double _minHeight = 56; static const double _minHeight = 56;

Loading…
Cancel
Save