pull/156/head
haroon amjad 3 days ago
parent fc750174fe
commit 44ce353dac

@ -160,6 +160,7 @@ dependencies {
annotationProcessor("com.github.bumptech.glide:compiler:4.16.0") annotationProcessor("com.github.bumptech.glide:compiler:4.16.0")
implementation("com.mapbox.maps:android:11.5.0") implementation("com.mapbox.maps:android:11.5.0")
implementation("com.mapbox.mapboxsdk:mapbox-sdk-turf:7.3.1")
// implementation("com.mapbox.maps:android:11.4.0") // implementation("com.mapbox.maps:android:11.4.0")
// AARs // AARs

@ -55,11 +55,12 @@ class Utils {
"IsActive": true, "IsActive": true,
"IsHmg": true, "IsHmg": true,
"IsVidaPlus": false, "IsVidaPlus": false,
"Latitude": "24.8113774", "Latitude": "24.8111548",
"Longitude": "46.6239813", "Longitude": "46.6217912",
"MainProjectID": 130, "MainProjectID": 130,
"ProjectOutSA": false, "ProjectOutSA": false,
"UsingInDoctorApp": false "UsingInDoctorApp": false,
"IsHMC": false
},{ },{
"Desciption": "Jeddah Fayhaa Hospital", "Desciption": "Jeddah Fayhaa Hospital",
"DesciptionN": "مستشفى جدة الفيحاء", "DesciptionN": "مستشفى جدة الفيحاء",
@ -75,11 +76,12 @@ class Utils {
"IsActive": true, "IsActive": true,
"IsHmg": true, "IsHmg": true,
"IsVidaPlus": false, "IsVidaPlus": false,
"Latitude": "24.8113774", "Latitude": "21.5086703",
"Longitude": "46.6239813", "Longitude": "39.2121855",
"MainProjectID": 130, "MainProjectID": 130,
"ProjectOutSA": false, "ProjectOutSA": false,
"UsingInDoctorApp": false "UsingInDoctorApp": false,
"IsHMC": false
} }
]; ];

@ -1,5 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.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/dependencies.dart';
import 'package:hmg_patient_app_new/core/location_util.dart';
import 'package:hmg_patient_app_new/core/utils/penguin_method_channel.dart'; import 'package:hmg_patient_app_new/core/utils/penguin_method_channel.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/features/hospital/AppPermission.dart'; import 'package:hmg_patient_app_new/features/hospital/AppPermission.dart';
@ -17,10 +19,17 @@ class HospitalSelectionBottomSheetViewModel extends ChangeNotifier {
int hmgCount = 0; int hmgCount = 0;
TextEditingController searchController = TextEditingController(); TextEditingController searchController = TextEditingController();
final AppState appState; final AppState appState;
LocationUtils locationUtils = getIt.get<LocationUtils>();
HospitalSelectionBottomSheetViewModel(this.appState) { HospitalSelectionBottomSheetViewModel(this.appState) {
locationUtils.getCurrentLocation(onSuccess: (value) {
Utils.navigationProjectsList.forEach((element) { Utils.navigationProjectsList.forEach((element) {
HospitalsModel model = HospitalsModel.fromJson(element); HospitalsModel model = HospitalsModel.fromJson(element);
double dist = Utils.distance(value.latitude, value.longitude, double.parse(model.latitude!), double.parse(model.longitude!)).ceilToDouble();
print(dist);
model.distanceInKilometers = dist;
if (model.isHMC == true) { if (model.isHMC == true) {
hmcHospitalList.add(model); hmcHospitalList.add(model);
} else { } else {
@ -30,7 +39,12 @@ class HospitalSelectionBottomSheetViewModel extends ChangeNotifier {
}); });
hmgCount = hmgHospitalList.length; hmgCount = hmgHospitalList.length;
hmcCount = hmcHospitalList.length; hmcCount = hmcHospitalList.length;
listOfData.sort((a, b) => a.distanceInKilometers.compareTo(b.distanceInKilometers));
hmgHospitalList.sort((a, b) => a.distanceInKilometers.compareTo(b.distanceInKilometers));
getDisplayList(); getDisplayList();
});
} }
getDisplayList() { getDisplayList() {

@ -4,15 +4,18 @@ import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:get_it/get_it.dart'; import 'package:get_it/get_it.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/enums.dart'; import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/route_extensions.dart'; import 'package:hmg_patient_app_new/extensions/route_extensions.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart';
import 'package:hmg_patient_app_new/features/blood_donation/blood_donation_view_model.dart'; import 'package:hmg_patient_app_new/features/blood_donation/blood_donation_view_model.dart';
import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_model.dart'; import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_model.dart';
import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart'; import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/ui_models/hmg_services_component_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/ui_models/hmg_services_component_model.dart';
import 'package:hmg_patient_app_new/features/hospital/hospital_selection_view_model.dart';
import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart';
import 'package:hmg_patient_app_new/features/water_monitor/water_monitor_view_model.dart'; import 'package:hmg_patient_app_new/features/water_monitor/water_monitor_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
@ -36,6 +39,7 @@ import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../core/dependencies.dart' show getIt; import '../../core/dependencies.dart' show getIt;
import '../emergency_services/call_ambulance/widgets/HospitalBottomSheetBody.dart';
class ServicesPage extends StatelessWidget { class ServicesPage extends StatelessWidget {
ServicesPage({super.key}); ServicesPage({super.key});
@ -44,14 +48,8 @@ class ServicesPage extends StatelessWidget {
late MedicalFileViewModel medicalFileViewModel; late MedicalFileViewModel medicalFileViewModel;
late final List<HmgServicesComponentModel> hmgServices = [ late final List<HmgServicesComponentModel> hmgServices = [
HmgServicesComponentModel( HmgServicesComponentModel(11, "Emergency Services".needTranslation, "".needTranslation, AppAssets.emergency_services_icon, bgColor: AppColors.primaryRedColor, true, route: null, onTap: () async {
11, if (getIt.get<AppState>().isAuthenticated) {
"Emergency Services".needTranslation,
"".needTranslation,
AppAssets.emergency_services_icon,
bgColor: AppColors.primaryRedColor,
true,
route: null, onTap: () {
getIt.get<EmergencyServicesViewModel>().flushData(); getIt.get<EmergencyServicesViewModel>().flushData();
getIt.get<EmergencyServicesViewModel>().getTransportationOrders( getIt.get<EmergencyServicesViewModel>().getTransportationOrders(
showLoader: false, showLoader: false,
@ -65,6 +63,9 @@ class ServicesPage extends StatelessWidget {
settings: const RouteSettings(name: '/EmergencyServicesPage'), settings: const RouteSettings(name: '/EmergencyServicesPage'),
), ),
); );
} else {
await getIt.get<AuthenticationViewModel>().onLoginPressed();
}
}), }),
HmgServicesComponentModel( HmgServicesComponentModel(
11, 11,
@ -75,15 +76,13 @@ class ServicesPage extends StatelessWidget {
true, true,
route: AppRoutes.bookAppointmentPage, route: AppRoutes.bookAppointmentPage,
), ),
HmgServicesComponentModel( HmgServicesComponentModel(5, "Complete Checkup".needTranslation, "".needTranslation, AppAssets.comprehensiveCheckup, bgColor: AppColors.bgGreenColor, true, route: null, onTap: () async {
5, if (getIt.get<AppState>().isAuthenticated) {
"Complete Checkup".needTranslation, getIt.get<NavigationService>().pushPageRoute(AppRoutes.comprehensiveCheckupPage);
"".needTranslation, } else {
AppAssets.comprehensiveCheckup, await getIt.get<AuthenticationViewModel>().onLoginPressed();
bgColor: AppColors.bgGreenColor, }
true, }),
route: AppRoutes.comprehensiveCheckupPage,
),
HmgServicesComponentModel( HmgServicesComponentModel(
11, 11,
"Indoor Navigation".needTranslation, "Indoor Navigation".needTranslation,
@ -92,17 +91,51 @@ class ServicesPage extends StatelessWidget {
bgColor: Color(0xff45A2F8), bgColor: Color(0xff45A2F8),
true, true,
route: null, route: null,
onTap: () {}, onTap: () {
showCommonBottomSheetWithoutHeight(
title: LocaleKeys.selectHospital.tr(),
GetIt.instance<NavigationService>().navigatorKey.currentContext!,
child: ChangeNotifierProvider(
create: (context) => HospitalSelectionBottomSheetViewModel(getIt()),
child: Consumer<HospitalSelectionBottomSheetViewModel>(
builder: (_, vm, __) => HospitalBottomSheetBody(
searchText: vm.searchController,
displayList: vm.displayList,
onFacilityClicked: (value) {
vm.setSelectedFacility(value);
vm.getDisplayList();
},
onHospitalClicked: (hospital) {
Navigator.pop(GetIt.instance<NavigationService>().navigatorKey.currentContext!);
vm.openPenguin(hospital);
},
onHospitalSearch: (value) {
vm.searchHospitals(value ?? "");
},
selectedFacility: vm.selectedFacility,
hmcCount: vm.hmcCount,
hmgCount: vm.hmgCount,
), ),
HmgServicesComponentModel( ),
11, ),
"E-Referral Services".needTranslation, isFullScreen: false,
"".needTranslation, isCloseButtonVisible: true,
AppAssets.eReferral, hasBottomPadding: false,
bgColor: AppColors.eReferralCardColor, backgroundColor: AppColors.bottomSheetBgColor,
true, callBackFunc: () {
route: AppRoutes.eReferralPage, GetIt.instance<NavigationService>().navigatorKey.currentContext!.read<EmergencyServicesViewModel>().clearSearchText();
},
);
},
), ),
HmgServicesComponentModel(
11, "E-Referral Services".needTranslation, "".needTranslation, AppAssets.eReferral, bgColor: AppColors.eReferralCardColor, true, route: null, onTap: () async {
if (getIt.get<AppState>().isAuthenticated) {
getIt.get<NavigationService>().pushPageRoute(AppRoutes.eReferralPage);
} else {
await getIt.get<AuthenticationViewModel>().onLoginPressed();
}
}),
HmgServicesComponentModel( HmgServicesComponentModel(
3, 3,
"Blood Donation".needTranslation, "Blood Donation".needTranslation,
@ -180,7 +213,14 @@ class ServicesPage extends StatelessWidget {
AppAssets.general_health, AppAssets.general_health,
bgColor: AppColors.whiteColor, bgColor: AppColors.whiteColor,
true, true,
route: AppRoutes.healthTrackersPage, route: null,
onTap: () async {
if (getIt.get<AppState>().isAuthenticated) {
getIt.get<NavigationService>().pushPageRoute(AppRoutes.healthTrackersPage);
} else {
await getIt.get<AuthenticationViewModel>().onLoginPressed();
}
},
), ),
HmgServicesComponentModel( HmgServicesComponentModel(
11, 11,
@ -191,6 +231,7 @@ class ServicesPage extends StatelessWidget {
true, true,
route: null, // Set to null since we handle navigation in onTap route: null, // Set to null since we handle navigation in onTap
onTap: () async { onTap: () async {
if (getIt.get<AppState>().isAuthenticated) {
LoaderBottomSheet.showLoader(loadingText: "Fetching your water intake details.".needTranslation); LoaderBottomSheet.showLoader(loadingText: "Fetching your water intake details.".needTranslation);
final waterMonitorVM = getIt.get<WaterMonitorViewModel>(); final waterMonitorVM = getIt.get<WaterMonitorViewModel>();
final context = getIt.get<NavigationService>().navigatorKey.currentContext!; final context = getIt.get<NavigationService>().navigatorKey.currentContext!;
@ -209,6 +250,9 @@ class ServicesPage extends StatelessWidget {
context.navigateWithName(AppRoutes.waterConsumptionPage); context.navigateWithName(AppRoutes.waterConsumptionPage);
}, },
); );
} else {
await getIt.get<AuthenticationViewModel>().onLoginPressed();
}
}, },
), ),
HmgServicesComponentModel( HmgServicesComponentModel(
@ -236,7 +280,14 @@ class ServicesPage extends StatelessWidget {
AppAssets.smartwatch_icon, AppAssets.smartwatch_icon,
bgColor: AppColors.whiteColor, bgColor: AppColors.whiteColor,
true, true,
route: AppRoutes.smartWatches, route: null,
onTap: () async {
if (getIt.get<AppState>().isAuthenticated) {
getIt.get<NavigationService>().pushPageRoute(AppRoutes.smartWatches);
} else {
await getIt.get<AuthenticationViewModel>().onLoginPressed();
}
},
// route: AppRoutes.huaweiHealthExample, // route: AppRoutes.huaweiHealthExample,
), ),
]; ];
@ -329,12 +380,15 @@ class ServicesPage extends StatelessWidget {
], ],
), ),
Spacer(), Spacer(),
Consumer<HabibWalletViewModel>(builder: (context, habibWalletVM, child) { getIt.get<AppState>().isAuthenticated
? Consumer<HabibWalletViewModel>(builder: (context, habibWalletVM, child) {
return Utils.getPaymentAmountWithSymbol2(habibWalletVM.habibWalletAmount, isExpanded: false) return Utils.getPaymentAmountWithSymbol2(habibWalletVM.habibWalletAmount, isExpanded: false)
.toShimmer2(isShow: habibWalletVM.isWalletAmountLoading, radius: 12.r, width: 80.w, height: 24.h); .toShimmer2(isShow: habibWalletVM.isWalletAmountLoading, radius: 12.r, width: 80.w, height: 24.h);
}), })
: "Login to view your wallet balance".needTranslation.toText12(fontWeight: FontWeight.w500, maxLine: 2),
Spacer(), Spacer(),
CustomButton( getIt.get<AppState>().isAuthenticated
? CustomButton(
height: 40.h, height: 40.h,
icon: AppAssets.recharge_icon, icon: AppAssets.recharge_icon,
iconSize: 16.w, iconSize: 16.w,
@ -350,10 +404,15 @@ class ServicesPage extends StatelessWidget {
onPressed: () { onPressed: () {
Navigator.of(context).push(CustomPageRoute(page: RechargeWalletPage())); Navigator.of(context).push(CustomPageRoute(page: RechargeWalletPage()));
}, },
), )
: SizedBox.shrink(),
], ],
).onPress(() { ).onPress(() async {
if (getIt.get<AppState>().isAuthenticated) {
Navigator.of(context).push(CustomPageRoute(page: HabibWalletPage())); Navigator.of(context).push(CustomPageRoute(page: HabibWalletPage()));
} else {
await getIt.get<AuthenticationViewModel>().onLoginPressed();
}
}), }),
), ),
), ),
@ -375,12 +434,13 @@ class ServicesPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Utils.buildSvgWithAssets(icon: AppAssets.services_medical_file_icon, width: 30.w, height: 30.h), Utils.buildSvgWithAssets(icon: AppAssets.services_medical_file_icon, width: 30.w, height: 30.h),
"Medical Files".needTranslation.toText14(weight: FontWeight.w600, maxlines: 2).expanded, LocaleKeys.medicalFile.tr().toText14(weight: FontWeight.w600, maxlines: 2).expanded,
Utils.buildSvgWithAssets(icon: AppAssets.arrow_forward), Utils.buildSvgWithAssets(icon: AppAssets.arrow_forward),
], ],
), ),
Spacer(), Spacer(),
Wrap( getIt.get<AppState>().isAuthenticated
? Wrap(
spacing: -8.h, spacing: -8.h,
// runSpacing: 0.h, // runSpacing: 0.h,
children: [ children: [
@ -409,9 +469,11 @@ class ServicesPage extends StatelessWidget {
fit: BoxFit.contain, fit: BoxFit.contain,
), ),
], ],
), )
: "Login to view your medical file".needTranslation.toText12(fontWeight: FontWeight.w500, maxLine: 2),
Spacer(), Spacer(),
CustomButton( getIt.get<AppState>().isAuthenticated
? CustomButton(
height: 40.h, height: 40.h,
icon: AppAssets.add_icon, icon: AppAssets.add_icon,
iconSize: 16.w, iconSize: 16.w,
@ -434,14 +496,19 @@ class ServicesPage extends StatelessWidget {
medicalFileViewModel.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms); medicalFileViewModel.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms);
}); });
}, },
), )
: SizedBox.shrink(),
], ],
).onPress(() { ).onPress(() async {
if (getIt.get<AppState>().isAuthenticated) {
Navigator.of(context).push( Navigator.of(context).push(
CustomPageRoute( CustomPageRoute(
page: MedicalFilePage(), page: MedicalFilePage(),
), ),
); );
} else {
await getIt.get<AuthenticationViewModel>().onLoginPressed();
}
}), }),
), ),
), ),

@ -42,15 +42,15 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
? RotatedBox( ? RotatedBox(
quarterTurns: 90, quarterTurns: 90,
child: Utils.buildSvgWithAssets( child: Utils.buildSvgWithAssets(
icon: AppAssets.arrow_back, icon: AppAssets.forward_top_nav_icon,
width: 32.w, width: 24.w,
height: 32.h, height: 24.h,
), ),
) )
: Utils.buildSvgWithAssets( : Utils.buildSvgWithAssets(
icon: AppAssets.arrow_back, icon: AppAssets.forward_top_nav_icon,
width: 32.w, width: 24.w,
height: 32.h, height: 24.h,
), ),
), ),
), ),

Loading…
Cancel
Save